]> SALOME platform Git repositories - modules/yacs.git/blob - src/hmi/commandsProc.hxx
Salome HOME
merge from branch DEV tag mergeto_trunk_04apr08
[modules/yacs.git] / src / hmi / commandsProc.hxx
1
2 #ifndef _COMMANDSPROC_HXX_
3 #define _COMMANDSPROC_HXX_
4
5 #include "commands.hxx"
6
7 #include <list>
8 #include <stack>
9 #include <string>
10 #include <map>
11
12 namespace YACS
13 {
14   namespace ENGINE
15   {
16     class Proc;
17     class Node;
18     class TypeCode;
19     class Catalog;
20     class DataPort;
21     class InputPort;
22     class OutputPort;
23     class InputDataStreamPort;
24     class OutputDataStreamPort;
25     class Container;
26     class ComponentInstance;
27   }
28
29   namespace HMI
30   {
31
32     typedef enum
33       {
34         SALOMEPROC,
35         BLOC,
36         FOREACHLOOP,
37         OPTIMIZERLOOP,
38         FORLOOP,
39         WHILELOOP,
40         SWITCH,
41         PYTHONNODE,
42         PYFUNCNODE,
43         CORBANODE,
44         SALOMENODE,
45         CPPNODE,
46         SALOMEPYTHONNODE,
47         XMLNODE,
48         SPLITTERNODE,
49         DFTODSFORLOOPNODE,
50         DSTODFFORLOOPNODE,
51         PRESETNODE,
52         OUTNODE,
53         STUDYINNODE,
54         STUDYOUTNODE,
55         INPUTPORT,
56         OUTPUTPORT,
57         INPUTDATASTREAMPORT,
58         OUTPUTDATASTREAMPORT,
59         DATALINK,
60         CONTROLLINK,
61         CONTAINER,
62         COMPONENT,
63         REFERENCE,
64         DATATYPE,
65         UNKNOWN
66       } TypeOfElem;
67    
68     class ProcInvoc: public Invocator
69     {
70     public:
71       ProcInvoc();
72       static TypeOfElem getTypeOfNode(YACS::ENGINE::Node* node);
73       static TypeOfElem getTypeOfPort(YACS::ENGINE::DataPort* port);
74       static std::string getTypeName(TypeOfElem type);
75     protected:
76       static std::map<int, std::string> _typeNameMap;
77     };
78     
79
80     class CommandAddNodeFromCatalog: public Command
81     {
82     public:
83       CommandAddNodeFromCatalog(YACS::ENGINE::Catalog *catalog,
84                                 std::string compo,
85                                 std::string type,
86                                 std::string position,
87                                 std::string name,
88                                 int swCase =0);
89       YACS::ENGINE::Node *getNode();
90     protected:
91       virtual bool localExecute();
92       virtual bool localReverse();
93       YACS::ENGINE::Catalog* _catalog;
94       YACS::ENGINE::Node *_nodeToClone;
95       TypeOfElem  _typeNode;
96       std::string _compoName;
97       std::string _typeName;
98       std::string _position;
99       std::string _name;
100       int _swCase;
101       YACS::ENGINE::Node *_node;
102     };
103
104     class CommandRenameNode: public Command
105     {
106     public:
107       CommandRenameNode(std::string position, std::string name);
108     protected:
109       virtual bool localExecute();
110       virtual bool localReverse();
111       std::string _position;
112       std::string _name;
113     };
114
115     class CommandAddDataTypeFromCatalog: public Command
116     {
117     public:
118       CommandAddDataTypeFromCatalog(YACS::ENGINE::Catalog* catalog,
119                                     std::string typeName);
120       YACS::ENGINE::TypeCode *getTypeCode();
121     protected:
122       virtual bool localExecute();
123       virtual bool localReverse();
124       YACS::ENGINE::Catalog* _catalog;
125       std::string _typeName;
126     };
127
128     class CommandAddInputPortFromCatalog: public Command
129     {
130     public:
131       CommandAddInputPortFromCatalog(YACS::ENGINE::Catalog *catalog,
132                                      std::string type,
133                                      std::string node,
134                                      std::string name);
135       YACS::ENGINE::InputPort *getInputPort();
136     protected:
137       virtual bool localExecute();
138       virtual bool localReverse();
139       YACS::ENGINE::Catalog* _catalog;
140       std::string _typePort;
141       std::string _node;
142       std::string _name;
143       YACS::ENGINE::InputPort *_inputPort;
144     };
145
146     class CommandAddOutputPortFromCatalog: public Command
147     {
148     public:
149       CommandAddOutputPortFromCatalog(YACS::ENGINE::Catalog *catalog,
150                                       std::string type,
151                                       std::string node,
152                                       std::string name);
153       YACS::ENGINE::OutputPort *getOutputPort();
154     protected:
155       virtual bool localExecute();
156       virtual bool localReverse();
157       YACS::ENGINE::Catalog* _catalog;
158       std::string _typePort;
159       std::string _node;
160       std::string _name;
161       YACS::ENGINE::OutputPort *_outputPort;
162     };
163
164     class CommandAddIDSPortFromCatalog: public Command
165     {
166     public:
167       CommandAddIDSPortFromCatalog(YACS::ENGINE::Catalog *catalog,
168                                    std::string type,
169                                    std::string node,
170                                    std::string name);
171       YACS::ENGINE::InputDataStreamPort *getIDSPort();
172     protected:
173       virtual bool localExecute();
174       virtual bool localReverse();
175       YACS::ENGINE::Catalog* _catalog;
176       std::string _typePort;
177       std::string _node;
178       std::string _name;
179       YACS::ENGINE::InputDataStreamPort *_IDSPort;
180     };
181
182     class CommandAddODSPortFromCatalog: public Command
183     {
184     public:
185       CommandAddODSPortFromCatalog(YACS::ENGINE::Catalog *catalog,
186                                    std::string type,
187                                    std::string node,
188                                    std::string name);
189       YACS::ENGINE::OutputDataStreamPort *getODSPort();
190     protected:
191       virtual bool localExecute();
192       virtual bool localReverse();
193       YACS::ENGINE::Catalog* _catalog;
194       std::string _typePort;
195       std::string _node;
196       std::string _name;
197       YACS::ENGINE::OutputDataStreamPort *_ODSPort;
198     };
199
200     class CommandAddLink: public Command
201     {
202     public:
203       CommandAddLink(std::string outNode, std::string outPort,
204                      std::string inNode, std::string inPort);
205     protected:
206       virtual bool localExecute();
207       virtual bool localReverse();
208       std::string _outNode;
209       std::string _outPort;
210       std::string _inNode;
211       std::string _inPort;
212     };
213
214     class CommandAddControlLink: public Command
215     {
216     public:
217       CommandAddControlLink(std::string outNode, std::string inNode);
218     protected:
219       virtual bool localExecute();
220       virtual bool localReverse();
221       std::string _outNode;
222       std::string _inNode;
223     };
224
225     class CommandAddContainer: public Command
226     {
227     public:
228       CommandAddContainer(std::string name,
229                           std::string refContainer ="");
230       virtual YACS::ENGINE::Container* getContainer();
231     protected:
232       virtual bool localExecute();
233       virtual bool localReverse();
234       std::string _name;
235       std::string _containerToClone;
236       YACS::ENGINE::Container* _container;
237     };
238
239     class CommandSetContainerProperties: public Command
240     {
241     public:
242       CommandSetContainerProperties(std::string container,
243                                     std::map<std::string,std::string> properties);
244     protected:
245       virtual bool localExecute();
246       virtual bool localReverse();
247       std::string _container;
248       std::map<std::string,std::string> _properties;
249     };
250
251     class CommandSetDSPortProperties: public Command
252     {
253     public:
254       CommandSetDSPortProperties(std::string node, std::string port, bool isInport,
255                                  std::map<std::string,std::string> properties);
256     protected:
257       virtual bool localExecute();
258       virtual bool localReverse();
259       std::string _nodeName;
260       std::string _portName;
261       bool _isInport;
262       std::map<std::string,std::string> _properties;
263     };
264
265     class CommandSetFuncNodeFunctionName: public Command
266     {
267     public:
268       CommandSetFuncNodeFunctionName(std::string node, std::string funcName);
269     protected:
270       virtual bool localExecute();
271       virtual bool localReverse();
272       std::string _nodeName;
273       std::string _funcName;
274     };
275
276     class CommandSetInlineNodeScript: public Command
277     {
278     public:
279       CommandSetInlineNodeScript(std::string node, std::string script);
280     protected:
281       virtual bool localExecute();
282       virtual bool localReverse();
283       std::string _nodeName;
284       std::string _script;
285     };
286
287     class CommandAddComponentInstance: public Command
288     {
289     public:
290       CommandAddComponentInstance(std::string compoName);
291       virtual YACS::ENGINE::ComponentInstance* getComponentInstance();
292     protected:
293       virtual bool localExecute();
294       virtual bool localReverse();
295       std::string _compoName;
296       YACS::ENGINE::ComponentInstance *_compoInst;
297     };
298
299     class CommandAssociateComponentToContainer: public Command
300     {
301     public:
302       CommandAssociateComponentToContainer(std::pair<std::string,int> key,
303                                            std::string container);
304     protected:
305       virtual bool localExecute();
306       virtual bool localReverse();
307       std::pair<std::string,int>  _key;
308       std::string _container;
309     };
310
311     class CommandAssociateServiceToComponent: public Command
312     {
313     public:
314       CommandAssociateServiceToComponent(std::string service,
315                                          std::pair<std::string,int> key);
316     protected:
317       virtual bool localExecute();
318       virtual bool localReverse();
319       std::string _service;
320       std::pair<std::string,int>  _key;
321     };
322
323     class Subject;
324     class CommandDestroy: public Command
325     {
326     public:
327       CommandDestroy(std::string position, Subject* subject);
328     protected:
329       virtual bool localExecute();
330       virtual bool localReverse();
331     protected:
332       std::string _position;
333       Subject* _subject;
334     };
335
336     class CommandDeleteNode: public Command
337     {
338     public:
339       CommandDeleteNode(std::string node);
340     protected:
341       virtual bool localExecute();
342       virtual bool localReverse();
343       std::string _node;
344     };
345
346     class CommandCutNode: public Command
347     {
348     public:
349       CommandCutNode(std::string node);
350     protected:
351       virtual bool localExecute();
352       virtual bool localReverse();
353       std::string _node;
354     };
355
356     class CommandCopyNode: public Command
357     {
358     public:
359       CommandCopyNode(std::string node);
360     protected:
361       virtual bool localExecute();
362       virtual bool localReverse();
363       std::string _node;
364     };
365
366     class CommandPasteNode: public Command
367     {
368     public:
369       CommandPasteNode(std::string position);
370     protected:
371       virtual bool localExecute();
372       virtual bool localReverse();
373       std::string _node;
374     };
375
376     class CommandDeleteInPort: public Command
377     {
378     public:
379       CommandDeleteInPort(std::string node, std::string port);
380     protected:
381       virtual bool localExecute();
382       virtual bool localReverse();
383       std::string _node;
384       std::string _port;
385     };
386
387     class CommandDeleteOutPort: public Command
388     {
389     public:
390       CommandDeleteOutPort(std::string node, std::string port);
391     protected:
392       virtual bool localExecute();
393       virtual bool localReverse();
394       std::string _node;
395       std::string _port;
396     };
397
398   }
399 }
400 #endif