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 _COMMANDSPROC_HXX_
20 #define _COMMANDSPROC_HXX_
22 #include "commands.hxx"
40 class InputDataStreamPort;
41 class OutputDataStreamPort;
43 class ComponentInstance;
85 class ProcInvoc: public Invocator
89 static TypeOfElem getTypeOfNode(YACS::ENGINE::Node* node);
90 static TypeOfElem getTypeOfPort(YACS::ENGINE::DataPort* port);
91 static std::string getTypeName(TypeOfElem type);
93 static std::map<int, std::string> _typeNameMap;
97 class CommandAddNodeFromCatalog: public Command
100 CommandAddNodeFromCatalog(YACS::ENGINE::Catalog *catalog,
103 std::string position,
106 YACS::ENGINE::Node *getNode();
108 virtual bool localExecute();
109 virtual bool localReverse();
110 YACS::ENGINE::Catalog* _catalog;
111 YACS::ENGINE::Node *_nodeToClone;
112 TypeOfElem _typeNode;
113 std::string _compoName;
114 std::string _typeName;
115 std::string _position;
118 YACS::ENGINE::Node *_node;
121 class CommandReparentNode: public Command
124 CommandReparentNode(std::string position,
125 std::string newParent);
127 virtual bool localExecute();
128 virtual bool localReverse();
129 std::string _position;
130 std::string _newParent;
133 class CommandCopyNode: public Command
136 CommandCopyNode(std::string position,
137 std::string newParent);
138 YACS::ENGINE::Node *getNode();
140 virtual bool localExecute();
141 virtual bool localReverse();
142 std::string _position;
143 std::string _newParent;
144 YACS::ENGINE::Node *_clone;
147 class CommandRenameNode: public Command
150 CommandRenameNode(std::string position, std::string name);
152 virtual bool localExecute();
153 virtual bool localReverse();
154 std::string _position;
158 class CommandRenameContainer: public Command
161 CommandRenameContainer(std::string oldName, std::string newName);
163 virtual bool localExecute();
164 virtual bool localReverse();
165 std::string _oldName;
166 std::string _newName;
169 class CommandRenameInDataPort: public Command
172 CommandRenameInDataPort(std::string position,
174 std::string newName);
176 virtual bool localExecute();
177 virtual bool localReverse();
178 std::string _position;
179 std::string _oldName;
180 std::string _newName;
183 class CommandRenameOutDataPort: public Command
186 CommandRenameOutDataPort(std::string position,
188 std::string newName);
190 virtual bool localExecute();
191 virtual bool localReverse();
192 std::string _position;
193 std::string _oldName;
194 std::string _newName;
197 class CommandAddDataTypeFromCatalog: public Command
200 CommandAddDataTypeFromCatalog(YACS::ENGINE::Catalog* catalog,
201 std::string typeName);
202 YACS::ENGINE::TypeCode *getTypeCode();
204 virtual bool localExecute();
205 virtual bool localReverse();
206 YACS::ENGINE::Catalog* _catalog;
207 std::string _typeName;
210 class CommandAddInputPortFromCatalog: public Command
213 CommandAddInputPortFromCatalog(YACS::ENGINE::Catalog *catalog,
217 YACS::ENGINE::InputPort *getInputPort();
219 virtual bool localExecute();
220 virtual bool localReverse();
221 YACS::ENGINE::Catalog* _catalog;
222 std::string _typePort;
225 YACS::ENGINE::InputPort *_inputPort;
228 class CommandAddOutputPortFromCatalog: public Command
231 CommandAddOutputPortFromCatalog(YACS::ENGINE::Catalog *catalog,
235 YACS::ENGINE::OutputPort *getOutputPort();
237 virtual bool localExecute();
238 virtual bool localReverse();
239 YACS::ENGINE::Catalog* _catalog;
240 std::string _typePort;
243 YACS::ENGINE::OutputPort *_outputPort;
246 class CommandAddIDSPortFromCatalog: public Command
249 CommandAddIDSPortFromCatalog(YACS::ENGINE::Catalog *catalog,
253 YACS::ENGINE::InputDataStreamPort *getIDSPort();
255 virtual bool localExecute();
256 virtual bool localReverse();
257 YACS::ENGINE::Catalog* _catalog;
258 std::string _typePort;
261 YACS::ENGINE::InputDataStreamPort *_IDSPort;
264 class CommandAddODSPortFromCatalog: public Command
267 CommandAddODSPortFromCatalog(YACS::ENGINE::Catalog *catalog,
271 YACS::ENGINE::OutputDataStreamPort *getODSPort();
273 virtual bool localExecute();
274 virtual bool localReverse();
275 YACS::ENGINE::Catalog* _catalog;
276 std::string _typePort;
279 YACS::ENGINE::OutputDataStreamPort *_ODSPort;
282 class CommandOrderInputPorts: public Command
285 CommandOrderInputPorts(std::string node,
288 int getRank() {return _rank; };
290 virtual bool localExecute();
291 virtual bool localReverse();
298 class CommandOrderOutputPorts: public Command
301 CommandOrderOutputPorts(std::string node,
304 int getRank() {return _rank; };
306 virtual bool localExecute();
307 virtual bool localReverse();
314 class CommandSetInPortValue: public Command
317 CommandSetInPortValue(std::string node,
321 virtual bool localExecute();
322 virtual bool localReverse();
328 class CommandSetOutPortValue: public Command
331 CommandSetOutPortValue(std::string node,
335 virtual bool localExecute();
336 virtual bool localReverse();
342 class CommandSetSwitchSelect: public Command
345 CommandSetSwitchSelect(std::string aSwitch,
348 virtual bool localExecute();
349 virtual bool localReverse();
354 class CommandSetSwitchCase: public Command
357 CommandSetSwitchCase(std::string aSwitch,
361 virtual bool localExecute();
362 virtual bool localReverse();
368 class CommandSetForLoopSteps: public Command
371 CommandSetForLoopSteps(std::string forLoop,
374 virtual bool localExecute();
375 virtual bool localReverse();
376 std::string _forLoop;
380 class CommandSetWhileCondition: public Command
383 CommandSetWhileCondition(std::string whileLoop,
386 virtual bool localExecute();
387 virtual bool localReverse();
388 std::string _whileLoop;
392 class CommandSetForEachBranch: public Command
395 CommandSetForEachBranch(std::string forEach,
398 virtual bool localExecute();
399 virtual bool localReverse();
400 std::string _forEach;
404 class CommandAddLink: public Command
407 CommandAddLink(std::string outNode, std::string outPort,
408 std::string inNode, std::string inPort,bool control=true);
410 virtual bool localExecute();
411 virtual bool localReverse();
412 std::string _outNode;
413 std::string _outPort;
419 class CommandAddControlLink: public Command
422 CommandAddControlLink(std::string outNode, std::string inNode);
424 virtual bool localExecute();
425 virtual bool localReverse();
426 std::string _outNode;
430 class CommandAddContainer: public Command
433 CommandAddContainer(std::string name,
434 std::string refContainer ="");
435 virtual YACS::ENGINE::Container* getContainer();
437 virtual bool localExecute();
438 virtual bool localReverse();
440 std::string _containerToClone;
441 YACS::ENGINE::Container* _container;
444 class CommandSetContainerProperties: public Command
447 CommandSetContainerProperties(std::string container,
448 std::map<std::string,std::string> properties);
450 virtual bool localExecute();
451 virtual bool localReverse();
452 std::string _container;
453 std::map<std::string,std::string> _properties;
456 class CommandSetDSPortProperties: public Command
459 CommandSetDSPortProperties(std::string node, std::string port, bool isInport,
460 std::map<std::string,std::string> properties);
462 virtual bool localExecute();
463 virtual bool localReverse();
464 std::string _nodeName;
465 std::string _portName;
467 std::map<std::string,std::string> _properties;
470 class CommandSetFuncNodeFunctionName: public Command
473 CommandSetFuncNodeFunctionName(std::string node, std::string funcName);
475 virtual bool localExecute();
476 virtual bool localReverse();
477 std::string _nodeName;
478 std::string _funcName;
481 class CommandSetInlineNodeScript: public Command
484 CommandSetInlineNodeScript(std::string node, std::string script);
486 virtual bool localExecute();
487 virtual bool localReverse();
488 std::string _nodeName;
492 class CommandAddComponentInstance: public Command
495 CommandAddComponentInstance(std::string compoName);
496 virtual YACS::ENGINE::ComponentInstance* getComponentInstance();
498 virtual bool localExecute();
499 virtual bool localReverse();
500 std::string _compoName;
501 YACS::ENGINE::ComponentInstance *_compoInst;
504 class CommandAssociateComponentToContainer: public Command
507 CommandAssociateComponentToContainer(std::pair<std::string,int> key,
508 std::string container);
510 virtual bool localExecute();
511 virtual bool localReverse();
512 std::pair<std::string,int> _key;
513 std::string _container;
516 class CommandAssociateServiceToComponent: public Command
519 CommandAssociateServiceToComponent(std::string service,
520 std::pair<std::string,int> key);
522 virtual bool localExecute();
523 virtual bool localReverse();
524 std::string _service;
525 std::pair<std::string,int> _key;
529 class CommandDestroy: public Command
532 CommandDestroy(std::string position, Subject* subject);
534 virtual bool localExecute();
535 virtual bool localReverse();
537 std::string _position;