Version: 8.3.0
commandsProc.hxx
Go to the documentation of this file.
1 // Copyright (C) 2006-2016 CEA/DEN, EDF R&D
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 _COMMANDSPROC_HXX_
21 #define _COMMANDSPROC_HXX_
22 
23 #include "HMIExport.hxx"
24 #include "commands.hxx"
25 
26 #include <list>
27 #include <stack>
28 #include <string>
29 #include <map>
30 
31 namespace YACS
32 {
33  namespace ENGINE
34  {
35  class Proc;
36  class Node;
37  class TypeCode;
38  class Catalog;
39  class DataPort;
40  class InputPort;
41  class OutputPort;
42  class InputDataStreamPort;
43  class OutputDataStreamPort;
44  class Container;
45  class ComponentInstance;
46  }
47 
48  namespace HMI
49  {
50  class SubjectNode;
51  class SubjectInputPort;
52  class SubjectOutputPort;
53  class SubjectInputDataStreamPort;
54  class SubjectOutputDataStreamPort;
55  class SubjectLink;
56  class SubjectControlLink;
57  class SubjectContainerBase;
58  class SubjectComponent;
59 
60  typedef enum
61  {
94  } TypeOfElem;
95 
97  {
98  public:
99  ProcInvoc();
100  static TypeOfElem getTypeOfNode(YACS::ENGINE::Node* node);
101  static TypeOfElem getTypeOfPort(YACS::ENGINE::DataPort* port);
102  static std::string getTypeName(TypeOfElem type);
103  protected:
104  static std::map<int, std::string> _typeNameMap;
105  };
106 
107 
109  {
110  public:
112  std::string compo,
113  std::string type,
114  std::string position,
115  std::string name,
116  bool newCompoInst=true,
117  int swCase =0);
120  protected:
121  virtual bool localExecute();
122  virtual bool localReverse();
123  virtual std::string dump();
126  std::string _compoName;
127  std::string _typeName;
128  std::string _position;
129  std::string _name;
131  int _swCase;
134  };
135 
137  {
138  public:
139  CommandReparentNode(std::string position,
140  std::string newParent);
141  protected:
142  virtual bool localExecute();
143  virtual bool localReverse();
144  virtual std::string dump();
145  std::string _position;
146  std::string _newParent;
147  std::string _oldParent;
148  std::string _newpos;
149  };
150 
152  {
153  public:
154  CommandPutInComposedNode(std::string position,
155  std::string newParent,
156  std::string type,
157  bool toSaveRestoreLinks=true);
158  protected:
159  virtual bool localExecute();
160  virtual bool localReverse();
161  virtual std::string dump();
162  std::string _position;
163  std::string _newParent;
164  std::string _type;
165  std::string _newpos;
167  };
168 
169  class CommandCopyNode: public Command
170  {
171  public:
173  std::string position,
174  std::string newParent,
175  int acase=0);
177  protected:
178  virtual bool localExecute();
179  virtual bool localReverse();
180  virtual std::string dump();
181  std::string _position;
182  std::string _newParent;
183  std::string _newName;
184  int _case;
187  };
188 
190  {
191  public:
192  CommandRenameNode(std::string position, std::string name);
193  protected:
194  virtual bool localExecute();
195  virtual bool localReverse();
196  virtual std::string dump();
197  std::string _position;
198  std::string _name;
199  std::string _oldName;
200  std::string _newpos;
201  };
202 
204  {
205  public:
206  CommandRenameContainer(std::string oldName, std::string newName);
207  protected:
208  virtual bool localExecute();
209  virtual bool localReverse();
210  virtual std::string dump();
211  std::string _oldName;
212  std::string _newName;
213  };
214 
216  {
217  public:
218  CommandRenameInDataPort(std::string position,
219  std::string oldName,
220  std::string newName, TypeOfElem portType);
221  protected:
222  virtual bool localExecute();
223  virtual bool localReverse();
224  virtual std::string dump();
225  std::string _position;
226  std::string _oldName;
227  std::string _newName;
229  };
230 
232  {
233  public:
234  CommandRenameOutDataPort(std::string position,
235  std::string oldName,
236  std::string newName, TypeOfElem portType);
237  protected:
238  virtual bool localExecute();
239  virtual bool localReverse();
240  virtual std::string dump();
241  std::string _position;
242  std::string _oldName;
243  std::string _newName;
245  };
246 
248  {
249  public:
251  std::string typeName);
253  protected:
254  virtual bool localExecute();
255  virtual bool localReverse();
256  virtual std::string dump();
258  std::string _typeName;
259  };
260 
262  {
263  public:
265  std::string type,
266  std::string node,
267  std::string name);
270  protected:
271  virtual bool localExecute();
272  virtual bool localReverse();
273  virtual std::string dump();
275  std::string _typePort;
276  std::string _node;
277  std::string _name;
280  };
281 
283  {
284  public:
286  std::string type,
287  std::string node,
288  std::string name);
291  protected:
292  virtual bool localExecute();
293  virtual bool localReverse();
294  virtual std::string dump();
296  std::string _typePort;
297  std::string _node;
298  std::string _name;
301  };
302 
304  {
305  public:
307  std::string type,
308  std::string node,
309  std::string name);
312  protected:
313  virtual bool localExecute();
314  virtual bool localReverse();
315  virtual std::string dump();
317  std::string _typePort;
318  std::string _node;
319  std::string _name;
322  };
323 
325  {
326  public:
328  std::string type,
329  std::string node,
330  std::string name);
333  protected:
334  virtual bool localExecute();
335  virtual bool localReverse();
336  virtual std::string dump();
338  std::string _typePort;
339  std::string _node;
340  std::string _name;
343  };
344 
346  {
347  public:
348  CommandOrderInputPorts(std::string node,
349  std::string port,
350  int isUp);
351  int getRank() {return _rank; };
352  protected:
353  virtual bool localExecute();
354  virtual bool localReverse();
355  virtual std::string dump();
356  std::string _node;
357  std::string _port;
358  int _isUp;
359  int _rank;
360  };
361 
363  {
364  public:
365  CommandOrderOutputPorts(std::string node,
366  std::string port,
367  int isUp);
368  int getRank() {return _rank; };
369  protected:
370  virtual bool localExecute();
371  virtual bool localReverse();
372  virtual std::string dump();
373  std::string _node;
374  std::string _port;
375  int _isUp;
376  int _rank;
377  };
378 
380  {
381  public:
382  CommandSetInPortValue(std::string node,
383  std::string port,
384  std::string value);
385  protected:
386  virtual bool localExecute();
387  virtual bool localReverse();
388  virtual std::string dump();
389  std::string _node;
390  std::string _port;
391  std::string _value;
392  std::string _oldValue;
393  };
394 
396  {
397  public:
398  CommandSetOutPortValue(std::string node,
399  std::string port,
400  std::string value);
401  protected:
402  virtual bool localExecute();
403  virtual bool localReverse();
404  virtual std::string dump();
405  std::string _node;
406  std::string _port;
407  std::string _value;
408  std::string _oldValue;
409  };
410 
412  {
413  public:
414  CommandSetSwitchSelect(std::string aSwitch,
415  std::string value);
416  protected:
417  virtual bool localExecute();
418  virtual bool localReverse();
419  virtual std::string dump();
420  std::string _switch;
421  std::string _value;
422  std::string _oldValue;
423  };
424 
426  {
427  public:
428  CommandSetSwitchCase(std::string aSwitch,
429  std::string node,
430  std::string value);
431  protected:
432  virtual bool localExecute();
433  virtual bool localReverse();
434  virtual std::string dump();
435  std::string _switch;
436  std::string _node;
437  std::string _oldNode;
438  std::string _value;
440  };
441 
443  {
444  public:
445  CommandSetForLoopSteps(std::string forLoop,
446  std::string value);
447  protected:
448  virtual bool localExecute();
449  virtual bool localReverse();
450  virtual std::string dump();
451  std::string _forLoop;
452  std::string _value;
454  };
455 
457  {
458  public:
459  CommandSetWhileCondition(std::string whileLoop,
460  std::string value);
461  protected:
462  virtual bool localExecute();
463  virtual bool localReverse();
464  virtual std::string dump();
465  std::string _whileLoop;
466  std::string _value;
467  bool _oldValue;
468  };
469 
471  {
472  public:
473  CommandSetForEachBranch(std::string forEach,
474  std::string value);
475  protected:
476  virtual bool localExecute();
477  virtual bool localReverse();
478  virtual std::string dump();
479  std::string _forEach;
480  std::string _value;
482  };
483 
484  class CommandSetAlgo: public Command
485  {
486  public:
487  CommandSetAlgo(std::string optimizer, std::string alglib, std::string symbol);
488  protected:
489  virtual bool localExecute();
490  virtual bool localReverse();
491  virtual std::string dump();
492  std::string _optimizer;
493  std::string _alglib;
494  std::string _symbol;
495  std::string _oldAlglib;
496  std::string _oldSymbol;
497  };
498 
499  class CommandAddLink: public Command
500  {
501  public:
502  CommandAddLink(std::string outNode, std::string outPort, TypeOfElem outPortType,
503  std::string inNode, std::string inPort, TypeOfElem inPortType, bool control=true);
504  protected:
505  virtual bool localExecute();
506  virtual bool localReverse();
507  virtual std::string dump();
508  std::string _outNode;
509  std::string _outPort;
511  std::string _inNode;
512  std::string _inPort;
514  bool _control;
516  };
517 
519  {
520  public:
521  CommandAddControlLink(std::string outNode, std::string inNode);
522  protected:
523  virtual bool localExecute();
524  virtual bool localReverse();
525  virtual std::string dump();
526  std::string _outNode;
527  std::string _inNode;
528  };
529 
531  {
532  public:
533  CommandAddContainerBase(std::string name, std::string refContainer);
534  virtual ~CommandAddContainerBase();
536  protected:
537  virtual bool localExecute();
538  virtual bool localReverse();
539  virtual YACS::ENGINE::Container *createNewInstance() const = 0;
540  std::string _name;
541  std::string _containerToClone;
543  };
544 
546  {
547  public:
548  CommandAddContainer(std::string name, std::string refContainer ="");
549  protected:
550  std::string dump();
552  };
553 
555  {
556  public:
557  CommandAddHPContainer(std::string name, std::string refContainer ="");
558  protected:
559  std::string dump();
561  };
562 
564  {
565  public:
566  CommandSetContainerProperties(std::string container,
567  std::map<std::string,std::string> properties);
568  protected:
569  virtual bool localExecute();
570  virtual bool localReverse();
571  virtual std::string dump();
572  std::string _container;
573  std::map<std::string,std::string> _properties;
574  std::map<std::string,std::string> _oldProp;
575  };
576 
578  {
579  public:
580  CommandSetNodeProperties(std::string position,
581  std::map<std::string,std::string> properties);
582  protected:
583  virtual bool localExecute();
584  virtual bool localReverse();
585  virtual std::string dump();
586  std::string _position;
587  std::map<std::string,std::string> _properties;
588  std::map<std::string,std::string> _oldProp;
589  };
590 
592  {
593  public:
594  CommandSetComponentInstanceProperties(std::string compoinstance,
595  std::map<std::string,std::string> properties);
596  protected:
597  virtual bool localExecute();
598  virtual bool localReverse();
599  virtual std::string dump();
600  std::string _compoinstance;
601  std::map<std::string,std::string> _properties;
602  std::map<std::string,std::string> _oldProp;
603  bool _oldAnon;
604  };
605 
607  {
608  public:
609  CommandSetDSPortProperties(std::string node, std::string port, bool isInport,
610  std::map<std::string,std::string> properties);
611  protected:
612  virtual bool localExecute();
613  virtual bool localReverse();
614  virtual std::string dump();
615  std::string _nodeName;
616  std::string _portName;
617  bool _isInport;
618  std::map<std::string,std::string> _properties;
619  std::map<std::string,std::string> _oldProp;
620  };
621 
623  {
624  public:
625  CommandSetLinkProperties(std::string startnode, std::string startport,
626  std::string endnode, std::string endport,
627  std::map<std::string,std::string> properties);
628  protected:
629  virtual bool localExecute();
630  virtual bool localReverse();
631  virtual std::string dump();
632  std::string _startNodeName;
633  std::string _startPortName;
634  std::string _endNodeName;
635  std::string _endPortName;
636  std::map<std::string,std::string> _properties;
637  std::map<std::string,std::string> _oldProp;
638  };
639 
641  {
642  public:
643  CommandSetFuncNodeFunctionName(std::string node, std::string funcName);
644  protected:
645  virtual bool localExecute();
646  virtual bool localReverse();
647  virtual std::string dump();
648  std::string _nodeName;
649  std::string _funcName;
650  std::string _oldName;
651  };
652 
654  {
655  public:
656  CommandSetInlineNodeScript(std::string node, std::string script);
657  protected:
658  virtual bool localExecute();
659  virtual bool localReverse();
660  virtual std::string dump();
661  std::string _nodeName;
662  std::string _script;
663  std::string _oldScript;
664  };
665 
667  {
668  public:
669  CommandAddComponentInstance(std::string compoName,
670  std::string container,
671  std::string name ="");
673  protected:
674  virtual bool localExecute();
675  virtual bool localReverse();
676  virtual std::string dump();
677  std::string _compoName;
678  std::string _container;
679  std::string _name;
681  };
682 
684  {
685  public:
686  CommandSetExecutionMode(std::string nodeName, std::string mode);
687  protected:
688  virtual bool localExecute();
689  virtual bool localReverse();
690  virtual std::string dump();
691  std::string _mode;
692  std::string _nodeName;
693  std::string _oldmode;
694  };
695 
697  {
698  public:
699  CommandSetContainer(std::string nodeName, std::string container);
700  protected:
701  virtual bool localExecute();
702  virtual bool localReverse();
703  virtual std::string dump();
704  std::string _container;
705  std::string _nodeName;
706  std::string _oldcont;
707  };
708 
710  {
711  public:
712  CommandAssociateComponentToContainer(std::string instanceName,
713  std::string container);
714  protected:
715  virtual bool localExecute();
716  virtual bool localReverse();
717  virtual std::string dump();
718  std::string _container;
719  std::string _instanceName;
720  std::string _oldcont;
721  };
722 
724  {
725  public:
726  CommandAssociateServiceToComponent(std::string service,
727  std::string instanceName);
728  protected:
729  virtual bool localExecute();
730  virtual bool localReverse();
731  virtual std::string dump();
732  std::string _service;
733  std::string _instanceName;
734  std::string _oldInstance;
735  std::string _oldcont;
736  };
737 
739  {
740  public:
742  std::string position,
743  std::string compo,
744  std::string service);
745  protected:
746  virtual bool localExecute();
747  virtual bool localReverse();
748  virtual std::string dump();
750  std::string _position;
751  std::string _compo;
752  std::string _service;
753  std::string _nameInProc;
755  };
756 
757 
758  class Subject;
759  class CommandDestroy: public Command
760  {
761  public:
762  CommandDestroy(TypeOfElem elemType,
763  std::string startnode, std::string startport, TypeOfElem startportType,
764  std::string endnode, std::string endport, TypeOfElem endportType);
765  protected:
766  virtual bool localExecute();
767  virtual bool localReverse();
768  virtual std::string dump();
769  protected:
771  std::string _startnode;
772  std::string _startport;
774  std::string _endnode;
775  std::string _endport;
777 
778 // std::string _position;
779 // Subject* _subject;
780 // std::string _name;
781  };
782 
783  }
784 }
785 #endif