1 // Copyright (C) 2006-2014 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, or (at your option) any later version.
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
20 #ifndef __VISITOR_SAVESCHEMA_HXX__
21 #define __VISITOR_SAVESCHEMA_HXX__
23 #include "YACSlibEngineExport.hxx"
24 #include "Visitor.hxx"
25 #include "Exception.hxx"
37 class OutputDataStreamPort;
39 class ComponentInstance;
54 OutputDataStreamPort* outp;
59 class YACSLIBENGINE_EXPORT VisitorSaveSchema: public Visitor
62 VisitorSaveSchema(ComposedNode *root);
63 virtual ~VisitorSaveSchema();
64 void openFileSchema(std::string xmlDump) throw(Exception);
65 void closeFileSchema();
66 virtual void visitBloc(Bloc *node);
67 virtual void visitElementaryNode(ElementaryNode *node);
68 virtual void visitForEachLoop(ForEachLoop *node);
69 virtual void visitOptimizerLoop(OptimizerLoop *node);
70 virtual void visitDynParaLoop(DynParaLoop *node);
71 virtual void visitForLoop(ForLoop *node);
72 virtual void visitInlineNode(InlineNode *node);
73 virtual void visitInlineFuncNode(InlineFuncNode *node);
74 virtual void visitLoop(Loop *node);
75 virtual void visitProc(Proc *node);
76 virtual void visitServiceNode(ServiceNode *node);
77 virtual void visitServerNode(ServerNode *node);
78 virtual void visitServiceInlineNode(ServiceInlineNode *node);
79 virtual void visitSwitch(Switch *node);
80 virtual void visitWhileLoop(WhileLoop *node);
81 virtual void visitPresetNode(DataNode *node);
82 virtual void visitOutNode(DataNode *node);
83 virtual void visitStudyInNode(DataNode *node);
84 virtual void visitStudyOutNode(DataNode *node);
87 virtual void writeProperties(Node *node);
88 virtual void dumpTypeCode(TypeCode* type, std::set<std::string>& typeNames,std::map<std::string, TypeCode*>& typeMap,int depth);
89 virtual void writeTypeCodes(Proc *proc);
90 virtual void writeContainers(Proc *proc);
91 virtual void writeComponentInstances(Proc *proc);
92 virtual void writeInputPorts(Node *node);
93 virtual void writeInputDataStreamPorts(Node *node); // OCC : mkr : add possibility to write input data stream ports
94 virtual void writeOutputPorts(Node *node);
95 virtual void writeOutputDataStreamPorts(Node *node); // OCC : mkr : add possibility to write output data stream ports
96 virtual void writeControls(ComposedNode *node);
97 virtual void writeSimpleDataLinks(ComposedNode *node);
98 virtual void writeSimpleStreamLinks(ComposedNode *node); // OCC : mkr : add possibility to write stream links
99 virtual void writeParameters(Proc *proc);
100 virtual void writeParametersNode(ComposedNode *proc, Node *node);
101 virtual void beginCase(Node* node);
102 virtual void endCase(Node* node);
103 std::set<Node*> getAllNodes(ComposedNode *node);
104 int depthNode(Node* node);
105 inline std::string indent(int val)
106 {std::string white; white.append(3*val,' '); return white;};
109 std::map<int, std::string> _nodeStateName;
110 std::map<std::string, Container*> _containerMap;
111 std::map<ComponentInstance*, std::string> _componentInstanceMap;
113 std::multimap<int, DataLinkInfo> _mapOfDLtoCreate;
114 std::multimap<int, StreamLinkInfo> _mapOfSLtoCreate;
117 class YACSLIBENGINE_EXPORT SchemaSave
120 SchemaSave(Proc* proc);
121 virtual void save(std::string xmlSchemaFile);