2 // Created: Jan 03 2002
5 // Copyright : CEA/DEN/DMSS/LGLS
8 /*! \file SUPERV.idl This file contains a set of interfaces of the %SUPERVISION module
11 \defgroup Supervision SALOME SUPERVISION module
13 #ifndef __SUPERV_IDL__
14 #define __SUPERV_IDL__
16 #include "SALOME_ModuleCatalog.idl"
17 #include "SALOME_Component.idl"
18 #include "SALOMEDS.idl"
19 /*! \ingroup Supervision
20 The main package of interfaces of %SUPERVISION module
25 This enumeration contains a set of elements defining the type of the port.
26 \note <BR>In general, ports represent <STRONG>input or output parameters</STRONG> of the functions,
27 implemented in different kinds of nodes of the graph.
29 enum KindOfPort { UndefinedParameter , ServiceParameter , GateParameter ,
30 InLineParameter , LoopParameter , SwitchParameter ,
31 EndSwitchParameter , GOTOParameter } ;
34 This enumeration contains a set of elements defining the type of the node.
36 enum KindOfNode { FactoryNode , DataFlowNode , ComputingNode ,
37 InLineNode , LoopNode , EndLoopNode ,
38 SwitchNode , EndSwitchNode , GOTONode , UnknownNode };
41 This struct contains fields defining the date.
52 This enumeration contains a set of elements defining the type of operation, which has been performed
56 enum GraphEvent { UndefinedEvent , NoEvent , NewThreadEvent ,
57 WaitingEvent , ReadyEvent ,
58 RunningEvent , DoneEvent , ErroredEvent ,
59 SuspendEvent , ResumeEvent ,
60 KillEvent , StopEvent ,
61 ReRunEvent , ReStartEvent } ;
63 // UndefinedState : Non existing Node, Port etc...
65 This enumeration contains a set of elements defining the current state of the node(graph).
68 enum GraphState { UndefinedState , NoState , EditingState , SuspendState ,
69 WaitingState , ReadyState , SuspendReadyState ,
71 DoneState , ErrorState ,
72 SuspendDoneState , SuspendErroredState ,
73 KillState , StopState ,
74 ReRunState , ReStartState ,
75 NumberOfGraphStates } ;
77 typedef sequence<string> ListOfStrings ;
83 typedef sequence<Link> ListOfLinks ;
87 typedef sequence<Port> ListOfPorts ;
97 typedef sequence<CNode> ListOfCNodes ;
98 typedef sequence<FNode> ListOfFNodes ;
99 typedef sequence<INode> ListOfINodes ;
100 typedef sequence<GNode> ListOfGNodes ;
101 typedef sequence<LNode> ListOfLNodes ;
102 typedef sequence<ELNode> ListOfELNodes ;
103 typedef sequence<SNode> ListOfSNodes ;
104 typedef sequence<ESNode> ListOfESNodes ;
107 ListOfCNodes CNodes ;
108 ListOfFNodes FNodes ;
109 ListOfINodes INodes ;
110 ListOfGNodes GNodes ;
111 ListOfLNodes LNodes ;
112 ListOfELNodes ELNodes ;
113 ListOfSNodes SNodes ;
114 ListOfESNodes ESNodes ;
119 typedef sequence<Graph> ListOfGraphs ;
121 // ToSuspendState : will be Suspended before running if waiting or
122 // will be Suspended while running or
123 // will be Suspended after run
124 // ToSuspendStartState : will be Suspended at the beginning of execution
125 // ToSuspendDoneState : will be Suspended after run
127 This enumeration contains a set of elements defining the %ControlState of the node.
128 The %ControlState gives a possibility to determine the "control actions" which have been done by
129 the user (Suspend, SuspendDone, Kill, etc...).
131 enum ControlState { VoidState , ToSuspendStartState ,
132 ToSuspendState , ToSuspendDoneState ,
133 ToKillState , ToKillDoneState , ToStopState ,
134 NumberOfControlStates } ;
136 The AutomatonState is an internal state of the automaton of the Executor
137 of the %SuperVision %Engine. It is used for inner debugging purposes only.
140 enum AutomatonState { UnKnownState ,
145 SuspendedReadyToResumeState ,
150 SuspendedExecutingState ,
151 ResumedExecutingState ,
152 KilledExecutingState ,
153 StoppedExecutingState ,
154 SuccessedExecutingState ,
155 ErroredExecutingState ,
156 SuspendedSuccessedState ,
157 SuspendedErroredState,
158 ResumedSuccessedState ,
159 ResumedErroredState ,
160 KilledSuccessedState ,
162 StoppedSuccessedState ,
163 StoppedErroredState ,
169 SuspendedSuccessedToReStartState ,
170 SuspendedErroredToReStartState ,
173 NumberOfAutomatonStates
184 /*! \brief interface %SuperG
186 This interface contains a set of methods necessary for management of a %graph.
188 interface SuperG : Engines::Component, SALOMEDS::Driver {
191 Constructs a graph with possibility to read/edit it
192 \param aGraph %aGraphName or %aGraphXmlFile
194 SUPERV::Graph Graph(in string aGraph ) ; // aGraphName or aGraphXmlFile
197 Constructs a read Only graph ( for execution ).
198 \note <BR>In this graph there is also a possibility to update nodes, coordinates of the links,
199 of container names and input data.
200 \param aGraph %aGraphName or %aGraphXmlFile
202 SUPERV::Graph GraphE(in string aGraph ) ; // aGraphName or aGraphXmlFile
205 Creates a value for %Input method in interface %Node.
207 SUPERV::Value StringValue( in string aString ) ;
208 SUPERV::Value AnyValue( in any anAny ) ;
210 Gets a graph from its %IOR
212 SUPERV::Graph getGraph(in string ior); // get Graph from is IOR
216 /*! \brief Interface of a node
218 This interface includes a set of methods used for management of the nodes in the graph.
222 interface CNode : Engines::Component {
227 Returns the name of the node(graph).
231 Returns the service of this node .
233 SALOME_ModuleCatalog::Service Service() ;
235 Returns the type of the node.
237 SUPERV::KindOfNode Kind() ;
239 Returns the date of creation of the node(graph).
241 SUPERV::SDate CreationDate() ;
243 Returns the date of last update of the node(graph).
245 SUPERV::SDate LastUpdateDate() ;
247 Returns the name of the version of the node(graph).
251 Returns the name of the author of the node(graph).
255 Returns the string containing comments about this node(graph).
261 Sets the name of the node(graph). Returns True if it is updated.
263 boolean SetName(in string aNewName ) ;
265 Sets the name of the author. Returns True if it is updated.
267 boolean SetAuthor(in string anAuthor ) ;
269 Allows to update the comments about this node(graph).
271 boolean SetComment(in string aComment ) ;
274 Gets a port of the node.
276 SUPERV::Port Port( in string aParameterName ) ;
279 Enters a value into an Input %Port
281 SUPERV::Port Input( in string InputParameterName ,
285 // Create an Input %Port and an Output Port in LabelNode or ControlNode
286 // boolean BusPort( in string InOutParameterName ,
287 // in string InOutParameterType ,
288 // out SUPERV::Port InputPort ,
289 // out SUPERV::Port OutputPort ) ;
290 // boolean BusPorts( in string InputParameterName ,
291 // in string InputParameterType ,
292 // in string OutputParameterName ,
293 // in string OutputParameterType ,
294 // out SUPERV::Port InputPort ,
295 // out SUPERV::Port OutputPort ) ;
298 Gets a list of ports of the node(graph)
300 SUPERV::ListOfPorts Ports() ;
303 SUPERV::ListOfLinks Links() ;
306 Returns True if this node is a graph.
307 \note <BR>A node of the graph can also represent in its turn another graph.
311 Returns True if the node appears to be a %computing node.
313 boolean IsComputing() ;
314 boolean IsFactory() ;
318 boolean IsEndLoop() ;
320 boolean IsEndSwitch() ;
323 Returns the number of SubGraphs
328 Returns nuber of threads.
333 Returns True if the node(graph) is waiting for Data input
335 boolean IsWaiting() ;
338 Returns True if the node(graph) is ready for execution
343 Returns True if the node(graph) is running
345 boolean IsRunning() ;
348 Returns True if execution is finished
353 Returns True if execution is suspended
356 boolean IsSuspended() ;
358 Returns the current state of the graph.
360 SUPERV::GraphState State() ;
362 // wait for ready_to_run state, Suspend and return
365 // wait for running state, Suspend and return
368 // wait for done state, Suspend and return
371 // wait for Suspend state and return
372 boolean SuspendedW() ;
376 // if not running : will be killed when ready to run
377 // if running : Kill immediatly
380 // will be killed only just after running (only for nodes)
383 // if not running : will be stopped when ready to run
384 // if running : Stop immediatly
387 // if not running : will be Suspended when ready to run
388 // if running : Suspend immediatly
391 // will be Suspended only just after running
392 boolean SuspendDone();
394 // if Suspended : running will continue
395 // if not Suspended : cancel current ControlState ( Suspend, Kill, ...)
399 Restarts execution of the node(graph).
403 Restarts execution of the graph beginning from a definite node.
405 boolean ReRunAt( in string aNodeName );
408 Restarts and suspends execution of the node(graph).
412 Restarts and suspends execution of the graph beginning from a definite node.
414 boolean ReStartAt( in string aNodeName );
417 Returns automaton execution state of the node(graph).
419 SUPERV::AutomatonState AutoState() ;
421 // Control state required : Kill, Suspend, Stop
422 SUPERV::ControlState Control() ;
424 Clears the control state of the node(graph).
426 void ControlClear() ;
428 boolean ContainerKill();
430 Sets the position of the node in the window.
432 void Coords( in long X , in long Y ) ;
434 Returns the position of the node along X-axis.
438 Returns the position of the node along Y-axis.
445 interface FNode : CNode {
448 string GetComponentName() ;
449 string GetInterfaceName() ;
450 string GetContainer() ;
451 boolean SetComponentName(in string aComponentName ) ;
452 boolean SetInterfaceName(in string anInterfaceName ) ;
453 boolean SetContainer(in string aContainer ) ;
458 interface INode : CNode {
461 void SetPyFunction( in string FuncName ,
462 in SUPERV::ListOfStrings aPyInitFunction ) ;
463 SUPERV::ListOfStrings PyFunction() ;
464 string PyFuncName() ;
466 // Create Input/Output Port in InLineNodes
467 SUPERV::Port InPort( in string aParameterName , in string aParameterType ) ;
468 SUPERV::Port OutPort( in string aParameterName , in string aParameterType ) ;
471 // GOTO/EndLoop/EndSwitch Nodes
473 interface GNode : INode {
476 boolean SetCoupled( in string anInLineNode ) ;
477 SUPERV::INode Coupled() ;
482 interface LNode : GNode {
485 void SetPyInit( in string MoreName ,
486 in SUPERV::ListOfStrings aPyMoreFunction ) ;
487 SUPERV::ListOfStrings PyInit() ;
488 string PyInitName() ;
490 void SetPyMore( in string MoreName ,
491 in SUPERV::ListOfStrings aPyMoreFunction ) ;
492 SUPERV::ListOfStrings PyMore() ;
493 string PyMoreName() ;
495 void SetPyNext( in string NextName ,
496 in SUPERV::ListOfStrings aPyNextFunction ) ;
497 SUPERV::ListOfStrings PyNext() ;
498 string PyNextName() ;
504 interface ELNode : GNode {
510 interface SNode : GNode {
516 interface ESNode : GNode {
520 /*! \brief Interface of a graph
522 This interface includes a set of methods used for management of the graphs in %SUPERVISION module.
526 interface Graph : INode {
529 // Create a Computing Node in a Graph
530 SUPERV::CNode CNode( in SALOME_ModuleCatalog::Service aService ) ;
532 // Create a Factory Node in a Graph
533 SUPERV::FNode FNode( in string aComponentName ,
534 in string anInterfaceName ,
535 in SALOME_ModuleCatalog::Service aService ) ;
537 // Create an InLine Node in a Graph
538 SUPERV::INode INode( in string FuncName , in ListOfStrings aPythonFunction ) ;
540 // Create a GOTO node and link to the corresponding InLine node
541 SUPERV::GNode GNode( in string FuncName , in ListOfStrings aPythonFunction ,
542 in string anINode ) ;
544 // Create a "for" or "while" node and the corresponding end of loop node
545 SUPERV::LNode LNode( in string InitName , in ListOfStrings InitFunction ,
546 in string MoreName , in ListOfStrings MoreFunction ,
547 in string NextName , in ListOfStrings NextFunction ,
548 out SUPERV::INode anEndOfLoop ) ;
550 // Create a "if/elseif/else" or "switch" node and the corresponding end node
551 SUPERV::SNode SNode( in string FuncName , in ListOfStrings aPythonFunction ,
552 out SUPERV::INode anEndOfSwitch ) ;
554 // Create a CORBA Component Object Reference
555 Engines::Component ComponentRef( in string aComputerContainer ,
556 in string aComponentName ) ;
559 Creates a link connecting two ports (%Output %Port and %Input %Port) of the nodes in a Graph
561 SUPERV::Link Link( in SUPERV::Port OutputPort ,
562 in SUPERV::Port InputPort ) ;
565 Imports a graph into a file with XML format
567 boolean Import( in string anXmlFile ) ;
569 Exports a graph from a file with XML format
571 boolean Export( in string anXmlFile ) ;
573 Returns True if the graph is read Only.
575 boolean IsReadOnly() ;
578 Starts asynchronous execution of the graph.
583 Assigns to the %Node an %Event and a %State of the %Node, if the Event is
584 available. And returns immediately Nil, NoEvent and NoState if not.
585 Returns false if the graph is finished, suspended, killed or stopped.
586 \param aNode %Node for which this method is called
587 \param anEvent An operation, which has been performed on this node(graph).
588 \param aState Current state of the graph
590 boolean EventNoW( out SUPERV::CNode aNode , out SUPERV::GraphEvent anEvent ,
591 out SUPERV::GraphState aState ) ;
594 Assigns to the %Node an %Event and a %State of the %Node, if the Event is
595 available. Waits if it is not available at the current moment.
596 Returns false if the graph is finished, suspended, killed or stopped.
597 \param aNode %Node for which this method is called
598 \param anEvent An operation, which has been performed on this node(graph).
599 \param aState Current state of the graph
601 boolean Event( out SUPERV::CNode aNode , out SUPERV::GraphEvent anEvent ,
602 out SUPERV::GraphState aState ) ;
604 // Same as Event but execution of the thread is suspended between the
605 // return of EventW and the next call to EventW
607 Assigns to the %Node an %Event and a %State of the %Node, if the Event is
608 available. And returns immediately Nil, NoEvent and NoState if not.
609 Returns false if the graph is finished, suspended, killed or stopped.
610 \note <BR>Execution of the thread is suspended between the return of this
611 method and its next usage.
612 \param aNode %Node for which this method is called
613 \param anEvent An operation, which has been performed on this node(graph).
614 \param aState Current state of the graph
616 boolean EventW( out SUPERV::CNode aNode , out SUPERV::GraphEvent anEvent ,
617 out SUPERV::GraphState aState ) ;
620 SUPERV::ListOfNodes LevelNodes( in long aLevel ) ;
623 Returns the number of independent subgraphs
625 long GraphsNumber() ;
627 Returns the number of currently running threads.
631 Returns the number of suspended threads.
633 long SuspendedThreads();
635 Returns True if the graph is valid.
639 Returns True if the graph can be executed.
641 boolean IsExecutable() ;
643 Returns True if the graph represents a working algorithm.
645 boolean IsDataFlow() ;
648 Returns True if the graph is being currently edited.
650 boolean IsEditing() ;
652 Returns True if the graph is being currently executed.
654 boolean IsExecuting() ;
656 long LastLevelDone() ;
659 Launches step-by-step execution of the graph.
660 \note The execution is suspended immediatly after performance of operations of the first node and
661 user can specify the nodes, where execution will be again suspended after its resuming.
665 Allows to copy one graph into another.
667 SUPERV::Graph Copy() ;
671 boolean Merge( in Graph aGraph ) ;
673 Returns a list of nodes of the graph.
675 SUPERV::ListOfNodes Nodes() ;
677 Returns a list of links of the graph.
679 SUPERV::ListOfLinks GLinks() ;
681 Gets IOR of the garph.
686 Returns a list of graphs.
687 \note Not implemented
689 SUPERV::ListOfGraphs Graphs() ;
697 /*! \brief Interface of the %link
699 This interface contains a set of methods used for representation and management of the links
700 connecting nodes in a %graph.
704 interface Link : Engines::Component {
707 Associates an %Output %Port to the Link
709 SUPERV::Port OutPort() ;
712 Associates an %Input %Port to the Link
714 SUPERV::Port InPort() ;
717 /*! \name Methods used for representation of links in GUI of %SALOME application :
721 Returns the number of coordinate points which are included in the link.
722 \note <BR>Every link can contain a set of coordinate points which constitute it. These points have
723 index numbers (beginning from 1) and coordinates defining their position in the window. Indexing of
724 the points starts from input port to output port of the corresponding link.
728 Adds a coordinate point to the link.
729 \param index Index of the point.
730 \param X Coordinates of the point.
731 \param Y Coordinates of the point.
733 boolean AddCoord( in long index , in long X , in long Y ) ;
735 Changes the location of a definite coordinate point of the link.
736 \param index Index of the point.
737 \param X Coordinates of the point.
738 \param Y Coordinates of the point.
741 boolean ChangeCoord( in long index , in long X , in long Y ) ;
743 Removes a coordinate point of the link.
744 \param index Index of the point.
747 boolean RemoveCoord( in long index ) ;
750 Sets the location of a coordinate point of the link.
751 \param index Index of the point.
752 \param X Coordinates of the point.
753 \param Y Coordinates of the point.
756 boolean Coords( in long index , out long X , out long Y ) ;
763 /*! \brief %Value interface
765 This interface contains a set of methods used for setting initial parameters of the ports
769 interface Value : Engines::Component {
772 Converts the given value into a value of string type.
776 Converts the given value into a value of independant data type.
780 Returns True if the value represents an IOR.
784 Gets data type of the component.
786 string ComponentDataType() ;
791 /*! \brief %Port interface
793 This interface contains a set of methods used for management of the ports.
797 interface Port : Value {
801 Gives a value to an Input %Port
803 boolean Input( in SUPERV::Value aValue ) ;
806 Returns the node of the port
808 SUPERV::CNode Node() ;
810 Sets the name of the port.
817 // Link of an Input Port
819 Returns the link of an %Input %Port
821 SUPERV::Link Link() ;
824 Returns a list of links of an Input %Port of an EndSwitchNode
826 SUPERV::ListOfLinks Links() ;
829 Returns True if this port appears to be an %Input %Port of a Node
834 Returns True if an %Input %Value exists for that %Input %Port (without link)
839 Returns True if the %Port is linked (without value)
841 // Port with link (without Value)
845 SUPERV::KindOfPort Kind() ;
847 // Port from the service of the node
849 Returns True if the %Port is a parameter of a service
852 // Port is a Gate of the node
854 Returns True if the %Port appears to be a GatePort of the node
857 // Port is a parameter of an InLineNode
859 // Port is a LoopParameter (InitLoop or DoLoop) of an LoopNode
861 // Port is an output parameter of a SwitchNode connected to an InGate
863 Returns True if the %Port appears to be a parameter of a switch node
865 // Port is a parameter of a switch node
867 // Port is an Input parameter of a EndSwitchNode connected to several output ports
868 boolean IsEndSwitch() ;
870 SUPERV::GraphState State() ;