Version: 9.16.0
VisitorSaveSchema.hxx
Go to the documentation of this file.
1// Copyright (C) 2006-2026 CEA, EDF
2//
3// This library is free software; you can redistribute it and/or
4// modify it under the terms of the GNU Lesser General Public
5// License as published by the Free Software Foundation; either
6// version 2.1 of the License, or (at your option) any later version.
7//
8// This library is distributed in the hope that it will be useful,
9// but WITHOUT ANY WARRANTY; without even the implied warranty of
10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11// Lesser General Public License for more details.
12//
13// You should have received a copy of the GNU Lesser General Public
14// License along with this library; if not, write to the Free Software
15// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16//
17// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18//
19
20#ifndef __VISITOR_SAVESCHEMA_HXX__
21#define __VISITOR_SAVESCHEMA_HXX__
22
24#include "Visitor.hxx"
25#include "Exception.hxx"
26
27#include <fstream>
28#include <string>
29#include <map>
30#include <set>
31
32namespace YACS
33{
34 namespace ENGINE
35 {
36 class OutputPort;
37 class OutputDataStreamPort;
38 class InPort;
39 class ComponentInstance;
40
42 {
48 };
49
51 {
57 };
58
60 {
61 public:
63 virtual ~VisitorSaveSchema();
64 void openFileSchema(std::string xmlDump) ;
65 void closeFileSchema();
66 virtual void visitBloc(Bloc *node);
67 virtual void visitElementaryNode(ElementaryNode *node);
68 void visitForEachLoop(ForEachLoop *node) override;
69 void visitForEachLoopDyn(ForEachLoopDyn *node) override;
70 virtual void visitOptimizerLoop(OptimizerLoop *node);
71 virtual void visitDynParaLoop(DynParaLoop *node);
72 virtual void visitForLoop(ForLoop *node);
73 virtual void visitInlineNode(InlineNode *node);
74 virtual void visitInlineFuncNode(InlineFuncNode *node);
75 virtual void visitLoop(Loop *node);
76 virtual void visitProc(Proc *node);
77 virtual void visitServiceNode(ServiceNode *node);
78 virtual void visitServerNode(ServerNode *node);
79 virtual void visitServiceInlineNode(ServiceInlineNode *node);
80 virtual void visitSwitch(Switch *node);
81 virtual void visitWhileLoop(WhileLoop *node);
82 virtual void visitPresetNode(DataNode *node);
83 virtual void visitOutNode(DataNode *node);
84 virtual void visitStudyInNode(DataNode *node);
85 virtual void visitStudyOutNode(DataNode *node);
86
87 protected:
88 virtual void writeProperties(Node *node);
89 virtual void dumpTypeCode(TypeCode* type, std::set<std::string>& typeNames,std::map<std::string, TypeCode*>& typeMap,int depth);
90 virtual void writeTypeCodes(Proc *proc);
91 virtual void writeContainers(Proc *proc);
92 virtual void writeComponentInstances(Proc *proc);
93 virtual void writeInputPorts(Node *node);
94 virtual void writeInputDataStreamPorts(Node *node); // OCC : mkr : add possibility to write input data stream ports
95 virtual void writeOutputPorts(Node *node);
96 virtual void writeOutputDataStreamPorts(Node *node); // OCC : mkr : add possibility to write output data stream ports
97 virtual void writeControls(ComposedNode *node);
98 virtual void writeSimpleDataLinks(ComposedNode *node);
99 virtual void writeSimpleStreamLinks(ComposedNode *node); // OCC : mkr : add possibility to write stream links
100 virtual void writeParameters(Proc *proc);
101 virtual void writeParametersNode(ComposedNode *proc, Node *node);
102 virtual void beginCase(Node* node);
103 virtual void endCase(Node* node);
104 std::set<Node*> getAllNodes(ComposedNode *node);
105 int depthNode(Node* node);
106 inline std::string indent(int val)
107 {std::string white; white.append(3*val,' '); return white;};
108
109 std::ofstream _out;
110 std::map<int, std::string> _nodeStateName;
111 std::map<std::string, Container*> _containerMap;
112 std::map<ComponentInstance*, std::string> _componentInstanceMap;
114 std::multimap<int, DataLinkInfo> _mapOfDLtoCreate;
115 std::multimap<int, StreamLinkInfo> _mapOfSLtoCreate;
116 };
117
119 {
120 public:
121 SchemaSave(Proc* proc);
122 virtual void save(std::string xmlSchemaFile);
123 protected:
125 };
126 }
127}
128#endif
#define YACSLIBENGINE_EXPORT
Composed node to group elementary and composed nodes.
Definition: Bloc.hxx:36
Base class for all composed nodes.
Class for data parameters specification.
Definition: DataNode.hxx:38
Base class for dynamically (fully or semifully) built graphs.
Definition: DynParaLoop.hxx:41
Base class for all calculation nodes.
Loop node for parametric calculation.
Class for for loop node.
Definition: ForLoop.hxx:33
Class for calculation node (function) inlined (and executed) in the schema.
Definition: InlineNode.hxx:93
Class for calculation node (script) inlined (and executed) in the schema.
Definition: InlineNode.hxx:44
Base class for loop node.
Definition: Loop.hxx:147
Base class for all nodes.
Definition: Node.hxx:70
class to build optimization loops
Base class for all schema objects.
Definition: Proc.hxx:44
Class for calculation node associated with a component service.
Definition: ServiceNode.hxx:35
Control node that emulates the C switch.
Definition: Switch.hxx:85
Base class for all type objects.
Definition: TypeCode.hxx:68
Base class for all visitors that save a schema.
std::multimap< int, DataLinkInfo > _mapOfDLtoCreate
std::multimap< int, StreamLinkInfo > _mapOfSLtoCreate
std::map< int, std::string > _nodeStateName
std::map< std::string, Container * > _containerMap
std::map< ComponentInstance *, std::string > _componentInstanceMap
Class for a while loop.
Definition: WhileLoop.hxx:39
OutputDataStreamPort * outp