1 // Copyright (C) 2006-2012 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
20 #ifndef _COMMANDSPROC_HXX_
21 #define _COMMANDSPROC_HXX_
23 #include "HMIExport.hxx"
24 #include "commands.hxx"
42 class InputDataStreamPort;
43 class OutputDataStreamPort;
45 class ComponentInstance;
51 class SubjectInputPort;
52 class SubjectOutputPort;
53 class SubjectInputDataStreamPort;
54 class SubjectOutputDataStreamPort;
56 class SubjectControlLink;
57 class SubjectContainer;
58 class SubjectComponent;
96 class HMI_EXPORT ProcInvoc: public Invocator
100 static TypeOfElem getTypeOfNode(YACS::ENGINE::Node* node);
101 static TypeOfElem getTypeOfPort(YACS::ENGINE::DataPort* port);
102 static std::string getTypeName(TypeOfElem type);
104 static std::map<int, std::string> _typeNameMap;
108 class CommandAddNodeFromCatalog: public Command
111 CommandAddNodeFromCatalog(YACS::ENGINE::Catalog *catalog,
114 std::string position,
116 bool newCompoInst=true,
118 YACS::ENGINE::Node *getNode();
119 YACS::HMI::SubjectNode *getSubjectNode();
121 virtual bool localExecute();
122 virtual bool localReverse();
123 virtual std::string dump();
124 YACS::ENGINE::Catalog* _catalog;
125 TypeOfElem _typeNode;
126 std::string _compoName;
127 std::string _typeName;
128 std::string _position;
132 YACS::ENGINE::Node *_node;
133 YACS::HMI::SubjectNode *_snode;
136 class CommandReparentNode: public Command
139 CommandReparentNode(std::string position,
140 std::string newParent);
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;
151 class CommandPutInComposedNode: public Command
154 CommandPutInComposedNode(std::string position,
155 std::string newParent,
157 bool toSaveRestoreLinks=true);
159 virtual bool localExecute();
160 virtual bool localReverse();
161 virtual std::string dump();
162 std::string _position;
163 std::string _newParent;
166 bool _toSaveRestoreLinks;
169 class CommandCopyNode: public Command
172 CommandCopyNode(YACS::ENGINE::Proc* fromproc,
173 std::string position,
174 std::string newParent,
176 YACS::ENGINE::Node *getNode();
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;
185 YACS::ENGINE::Node *_clone;
186 YACS::ENGINE::Proc *_fromproc;
189 class CommandRenameNode: public Command
192 CommandRenameNode(std::string position, std::string name);
194 virtual bool localExecute();
195 virtual bool localReverse();
196 virtual std::string dump();
197 std::string _position;
199 std::string _oldName;
203 class CommandRenameContainer: public Command
206 CommandRenameContainer(std::string oldName, std::string newName);
208 virtual bool localExecute();
209 virtual bool localReverse();
210 virtual std::string dump();
211 std::string _oldName;
212 std::string _newName;
215 class CommandRenameInDataPort: public Command
218 CommandRenameInDataPort(std::string position,
220 std::string newName, TypeOfElem portType);
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;
228 TypeOfElem _portType;
231 class CommandRenameOutDataPort: public Command
234 CommandRenameOutDataPort(std::string position,
236 std::string newName, TypeOfElem portType);
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;
244 TypeOfElem _portType;
247 class CommandAddDataTypeFromCatalog: public Command
250 CommandAddDataTypeFromCatalog(YACS::ENGINE::Catalog* catalog,
251 std::string typeName);
252 YACS::ENGINE::TypeCode *getTypeCode();
254 virtual bool localExecute();
255 virtual bool localReverse();
256 virtual std::string dump();
257 YACS::ENGINE::Catalog* _catalog;
258 std::string _typeName;
261 class CommandAddInputPortFromCatalog: public Command
264 CommandAddInputPortFromCatalog(YACS::ENGINE::Catalog *catalog,
268 YACS::ENGINE::InputPort *getInputPort();
269 SubjectInputPort* getSubjectInputPort();
271 virtual bool localExecute();
272 virtual bool localReverse();
273 virtual std::string dump();
274 YACS::ENGINE::Catalog* _catalog;
275 std::string _typePort;
278 YACS::ENGINE::InputPort *_inputPort;
279 SubjectInputPort* _sip;
282 class CommandAddOutputPortFromCatalog: public Command
285 CommandAddOutputPortFromCatalog(YACS::ENGINE::Catalog *catalog,
289 YACS::ENGINE::OutputPort *getOutputPort();
290 SubjectOutputPort* getSubjectOutputPort();
292 virtual bool localExecute();
293 virtual bool localReverse();
294 virtual std::string dump();
295 YACS::ENGINE::Catalog* _catalog;
296 std::string _typePort;
299 YACS::ENGINE::OutputPort *_outputPort;
300 SubjectOutputPort* _sop;
303 class CommandAddIDSPortFromCatalog: public Command
306 CommandAddIDSPortFromCatalog(YACS::ENGINE::Catalog *catalog,
310 YACS::ENGINE::InputDataStreamPort *getIDSPort();
311 SubjectInputDataStreamPort* getSubjectIDSPort();
313 virtual bool localExecute();
314 virtual bool localReverse();
315 virtual std::string dump();
316 YACS::ENGINE::Catalog* _catalog;
317 std::string _typePort;
320 YACS::ENGINE::InputDataStreamPort *_IDSPort;
321 SubjectInputDataStreamPort* _sip;
324 class CommandAddODSPortFromCatalog: public Command
327 CommandAddODSPortFromCatalog(YACS::ENGINE::Catalog *catalog,
331 YACS::ENGINE::OutputDataStreamPort *getODSPort();
332 SubjectOutputDataStreamPort* getSubjectODSPort();
334 virtual bool localExecute();
335 virtual bool localReverse();
336 virtual std::string dump();
337 YACS::ENGINE::Catalog* _catalog;
338 std::string _typePort;
341 YACS::ENGINE::OutputDataStreamPort *_ODSPort;
342 SubjectOutputDataStreamPort* _sop;
345 class CommandOrderInputPorts: public Command
348 CommandOrderInputPorts(std::string node,
351 int getRank() {return _rank; };
353 virtual bool localExecute();
354 virtual bool localReverse();
355 virtual std::string dump();
362 class CommandOrderOutputPorts: public Command
365 CommandOrderOutputPorts(std::string node,
368 int getRank() {return _rank; };
370 virtual bool localExecute();
371 virtual bool localReverse();
372 virtual std::string dump();
379 class CommandSetInPortValue: public Command
382 CommandSetInPortValue(std::string node,
386 virtual bool localExecute();
387 virtual bool localReverse();
388 virtual std::string dump();
392 std::string _oldValue;
395 class CommandSetOutPortValue: public Command
398 CommandSetOutPortValue(std::string node,
402 virtual bool localExecute();
403 virtual bool localReverse();
404 virtual std::string dump();
408 std::string _oldValue;
411 class CommandSetSwitchSelect: public Command
414 CommandSetSwitchSelect(std::string aSwitch,
417 virtual bool localExecute();
418 virtual bool localReverse();
419 virtual std::string dump();
422 std::string _oldValue;
425 class CommandSetSwitchCase: public Command
428 CommandSetSwitchCase(std::string aSwitch,
432 virtual bool localExecute();
433 virtual bool localReverse();
434 virtual std::string dump();
437 std::string _oldNode;
442 class CommandSetForLoopSteps: public Command
445 CommandSetForLoopSteps(std::string forLoop,
448 virtual bool localExecute();
449 virtual bool localReverse();
450 virtual std::string dump();
451 std::string _forLoop;
456 class CommandSetWhileCondition: public Command
459 CommandSetWhileCondition(std::string whileLoop,
462 virtual bool localExecute();
463 virtual bool localReverse();
464 virtual std::string dump();
465 std::string _whileLoop;
470 class CommandSetForEachBranch: public Command
473 CommandSetForEachBranch(std::string forEach,
476 virtual bool localExecute();
477 virtual bool localReverse();
478 virtual std::string dump();
479 std::string _forEach;
484 class CommandSetAlgo: public Command
487 CommandSetAlgo(std::string optimizer, std::string alglib, std::string symbol);
489 virtual bool localExecute();
490 virtual bool localReverse();
491 virtual std::string dump();
492 std::string _optimizer;
495 std::string _oldAlglib;
496 std::string _oldSymbol;
499 class CommandAddLink: public Command
502 CommandAddLink(std::string outNode, std::string outPort, TypeOfElem outPortType,
503 std::string inNode, std::string inPort, TypeOfElem inPortType, bool control=true);
505 virtual bool localExecute();
506 virtual bool localReverse();
507 virtual std::string dump();
508 std::string _outNode;
509 std::string _outPort;
510 TypeOfElem _outPortType;
513 TypeOfElem _inPortType;
515 bool _controlCreatedWithDF;
518 class CommandAddControlLink: public Command
521 CommandAddControlLink(std::string outNode, std::string inNode);
523 virtual bool localExecute();
524 virtual bool localReverse();
525 virtual std::string dump();
526 std::string _outNode;
530 class CommandAddContainer: public Command
533 CommandAddContainer(std::string name,
534 std::string refContainer ="");
535 SubjectContainer* getSubjectContainer() { return _subcont; };
537 virtual bool localExecute();
538 virtual bool localReverse();
539 virtual std::string dump();
541 std::string _containerToClone;
542 SubjectContainer *_subcont;
545 class CommandSetContainerProperties: public Command
548 CommandSetContainerProperties(std::string container,
549 std::map<std::string,std::string> properties);
551 virtual bool localExecute();
552 virtual bool localReverse();
553 virtual std::string dump();
554 std::string _container;
555 std::map<std::string,std::string> _properties;
556 std::map<std::string,std::string> _oldProp;
559 class CommandSetNodeProperties: public Command
562 CommandSetNodeProperties(std::string position,
563 std::map<std::string,std::string> properties);
565 virtual bool localExecute();
566 virtual bool localReverse();
567 virtual std::string dump();
568 std::string _position;
569 std::map<std::string,std::string> _properties;
570 std::map<std::string,std::string> _oldProp;
573 class CommandSetComponentInstanceProperties: public Command
576 CommandSetComponentInstanceProperties(std::string compoinstance,
577 std::map<std::string,std::string> properties);
579 virtual bool localExecute();
580 virtual bool localReverse();
581 virtual std::string dump();
582 std::string _compoinstance;
583 std::map<std::string,std::string> _properties;
584 std::map<std::string,std::string> _oldProp;
588 class CommandSetDSPortProperties: public Command
591 CommandSetDSPortProperties(std::string node, std::string port, bool isInport,
592 std::map<std::string,std::string> properties);
594 virtual bool localExecute();
595 virtual bool localReverse();
596 virtual std::string dump();
597 std::string _nodeName;
598 std::string _portName;
600 std::map<std::string,std::string> _properties;
601 std::map<std::string,std::string> _oldProp;
604 class CommandSetLinkProperties: public Command
607 CommandSetLinkProperties(std::string startnode, std::string startport,
608 std::string endnode, std::string endport,
609 std::map<std::string,std::string> properties);
611 virtual bool localExecute();
612 virtual bool localReverse();
613 virtual std::string dump();
614 std::string _startNodeName;
615 std::string _startPortName;
616 std::string _endNodeName;
617 std::string _endPortName;
618 std::map<std::string,std::string> _properties;
619 std::map<std::string,std::string> _oldProp;
622 class CommandSetFuncNodeFunctionName: public Command
625 CommandSetFuncNodeFunctionName(std::string node, std::string funcName);
627 virtual bool localExecute();
628 virtual bool localReverse();
629 virtual std::string dump();
630 std::string _nodeName;
631 std::string _funcName;
632 std::string _oldName;
635 class CommandSetInlineNodeScript: public Command
638 CommandSetInlineNodeScript(std::string node, std::string script);
640 virtual bool localExecute();
641 virtual bool localReverse();
642 virtual std::string dump();
643 std::string _nodeName;
645 std::string _oldScript;
648 class CommandAddComponentInstance: public Command
651 CommandAddComponentInstance(std::string compoName,
652 std::string container,
653 std::string name ="");
654 SubjectComponent* getSubjectComponent() {return _subcompo; };
656 virtual bool localExecute();
657 virtual bool localReverse();
658 virtual std::string dump();
659 std::string _compoName;
660 std::string _container;
662 SubjectComponent *_subcompo;
665 class CommandSetExecutionMode: public Command
668 CommandSetExecutionMode(std::string nodeName, std::string mode);
670 virtual bool localExecute();
671 virtual bool localReverse();
672 virtual std::string dump();
674 std::string _nodeName;
675 std::string _oldmode;
678 class CommandSetContainer: public Command
681 CommandSetContainer(std::string nodeName, std::string container);
683 virtual bool localExecute();
684 virtual bool localReverse();
685 virtual std::string dump();
686 std::string _container;
687 std::string _nodeName;
688 std::string _oldcont;
691 class CommandAssociateComponentToContainer: public Command
694 CommandAssociateComponentToContainer(std::string instanceName,
695 std::string container);
697 virtual bool localExecute();
698 virtual bool localReverse();
699 virtual std::string dump();
700 std::string _container;
701 std::string _instanceName;
702 std::string _oldcont;
705 class CommandAssociateServiceToComponent: public Command
708 CommandAssociateServiceToComponent(std::string service,
709 std::string instanceName);
711 virtual bool localExecute();
712 virtual bool localReverse();
713 virtual std::string dump();
714 std::string _service;
715 std::string _instanceName;
716 std::string _oldInstance;
717 std::string _oldcont;
720 class CommandAddComponentFromCatalog: public Command
723 CommandAddComponentFromCatalog(YACS::ENGINE::Catalog* catalog,
724 std::string position,
726 std::string service);
728 virtual bool localExecute();
729 virtual bool localReverse();
730 virtual std::string dump();
731 YACS::ENGINE::Catalog* _catalog;
732 std::string _position;
734 std::string _service;
735 std::string _nameInProc;
736 bool _createdInstance;
741 class CommandDestroy: public Command
744 CommandDestroy(TypeOfElem elemType,
745 std::string startnode, std::string startport, TypeOfElem startportType,
746 std::string endnode, std::string endport, TypeOfElem endportType);
748 virtual bool localExecute();
749 virtual bool localReverse();
750 virtual std::string dump();
752 TypeOfElem _elemType;
753 std::string _startnode;
754 std::string _startport;
755 TypeOfElem _startportType;
756 std::string _endnode;
757 std::string _endport;
758 TypeOfElem _endportType;
760 // std::string _position;
761 // Subject* _subject;
762 // std::string _name;