1 // Copyright (C) 2006-2008 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #ifndef __VISITOR_SAVESCHEMA_HXX__
20 #define __VISITOR_SAVESCHEMA_HXX__
22 #include "Visitor.hxx"
23 #include "Exception.hxx"
35 class OutputDataStreamPort;
37 class ComponentInstance;
52 OutputDataStreamPort* outp;
57 class VisitorSaveSchema: public Visitor
60 VisitorSaveSchema(ComposedNode *root);
61 virtual ~VisitorSaveSchema();
62 void openFileSchema(std::string xmlDump) throw(Exception);
63 void closeFileSchema();
64 virtual void visitBloc(Bloc *node);
65 virtual void visitElementaryNode(ElementaryNode *node);
66 virtual void visitForEachLoop(ForEachLoop *node);
67 virtual void visitForLoop(ForLoop *node);
68 virtual void visitInlineNode(InlineNode *node);
69 virtual void visitInlineFuncNode(InlineFuncNode *node);
70 virtual void visitLoop(Loop *node);
71 virtual void visitProc(Proc *node);
72 virtual void visitServiceNode(ServiceNode *node);
73 virtual void visitServiceInlineNode(ServiceInlineNode *node);
74 virtual void visitSwitch(Switch *node);
75 virtual void visitWhileLoop(WhileLoop *node);
76 virtual void visitPresetNode(DataNode *node);
77 virtual void visitOutNode(DataNode *node);
78 virtual void visitStudyInNode(DataNode *node);
79 virtual void visitStudyOutNode(DataNode *node);
82 virtual void writeProperties(Node *node);
83 virtual void dumpTypeCode(TypeCode* type, std::set<std::string>& typeNames,std::map<std::string, TypeCode*>& typeMap,int depth);
84 virtual void writeTypeCodes(Proc *proc);
85 virtual void writeContainers(Proc *proc);
86 virtual void writeInputPorts(Node *node);
87 virtual void writeInputDataStreamPorts(Node *node); // OCC : mkr : add possibility to write input data stream ports
88 virtual void writeOutputPorts(Node *node);
89 virtual void writeOutputDataStreamPorts(Node *node); // OCC : mkr : add possibility to write output data stream ports
90 virtual void writeControls(ComposedNode *node);
91 virtual void writeSimpleDataLinks(ComposedNode *node);
92 virtual void writeSimpleStreamLinks(ComposedNode *node); // OCC : mkr : add possibility to write stream links
93 virtual void writeParameters(Proc *proc);
94 virtual void writeParametersNode(ComposedNode *proc, Node *node);
95 virtual void beginCase(Node* node);
96 virtual void endCase(Node* node);
97 std::set<Node*> getAllNodes(ComposedNode *node);
98 int depthNode(Node* node);
99 inline std::string indent(int val)
100 {std::string white; white.append(3*val,' '); return white;};
103 std::map<int, std::string> _nodeStateName;
104 std::map<std::string, Container*> _containerMap;
105 std::map<ComponentInstance*, std::string> _componentInstanceMap;
107 std::multimap<int, DataLinkInfo> _mapOfDLtoCreate;
108 std::multimap<int, StreamLinkInfo> _mapOfSLtoCreate;
114 SchemaSave(Proc* proc);
115 virtual void save(std::string xmlSchemaFile);