1 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License.
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
23 // Author : Jean Rahuel
26 /*! \file SUPERV.idl This file contains a set of interfaces of the %SUPERVISION module
29 #ifndef __SUPERV_IDL__
30 #define __SUPERV_IDL__
32 #include "SALOME_ModuleCatalog.idl"
33 #include "SALOME_Component.idl"
34 #include "SALOMEDS.idl"
36 The main package of interfaces of %SUPERVISION module
41 This enumeration contains a set of elements defining the type of the port.
42 \note <BR>In general, ports represent <STRONG>input or output parameters</STRONG> of the functions,
43 implemented in different kinds of nodes of the graph.
45 enum KindOfPort { UndefinedParameter , ServiceParameter , GateParameter ,
46 InLineParameter , LoopParameter , SwitchParameter ,
47 EndSwitchParameter , GOTOParameter } ;
50 This enumeration contains a set of elements defining the type of the node.
52 enum KindOfNode { FactoryNode , DataFlowNode , ComputingNode ,
53 InLineNode , LoopNode , EndLoopNode ,
54 SwitchNode , EndSwitchNode , GOTONode , UnknownNode };
57 This struct contains fields defining the date.
68 This enumeration contains a set of elements defining the type of operation, which has been performed
72 enum GraphEvent { UndefinedEvent , NoEvent , NewThreadEvent ,
73 WaitingEvent , ReadyEvent ,
74 RunningEvent , DoneEvent , ErroredEvent ,
75 SuspendEvent , ResumeEvent ,
76 KillEvent , StopEvent ,
77 ReRunEvent , ReStartEvent } ;
79 // UndefinedState : Non existing Node, Port etc...
81 This enumeration contains a set of elements defining the current state of the node(graph).
84 enum GraphState { UndefinedState , NoState , EditingState , SuspendState ,
85 WaitingState , ReadyState , SuspendReadyState ,
87 DoneState , ErrorState ,
88 SuspendDoneState , SuspendErroredState ,
89 KillState , StopState ,
90 ReRunState , ReStartState ,
91 NumberOfGraphStates } ;
93 typedef sequence<string> ListOfStrings ;
99 typedef sequence<Link> ListOfLinks ;
103 typedef sequence<Port> ListOfPorts ;
113 typedef sequence<CNode> ListOfCNodes ;
114 typedef sequence<FNode> ListOfFNodes ;
115 typedef sequence<INode> ListOfINodes ;
116 typedef sequence<GNode> ListOfGNodes ;
117 typedef sequence<LNode> ListOfLNodes ;
118 typedef sequence<ELNode> ListOfELNodes ;
119 typedef sequence<SNode> ListOfSNodes ;
120 typedef sequence<ESNode> ListOfESNodes ;
123 ListOfCNodes CNodes ;
124 ListOfFNodes FNodes ;
125 ListOfINodes INodes ;
126 ListOfGNodes GNodes ;
127 ListOfLNodes LNodes ;
128 ListOfELNodes ELNodes ;
129 ListOfSNodes SNodes ;
130 ListOfESNodes ESNodes ;
135 typedef sequence<Graph> ListOfGraphs ;
137 // ToSuspendState : will be Suspended before running if waiting or
138 // will be Suspended while running or
139 // will be Suspended after run
140 // ToSuspendStartState : will be Suspended at the beginning of execution
141 // ToSuspendDoneState : will be Suspended after run
143 This enumeration contains a set of elements defining the %ControlState of the node.
144 The %ControlState gives a possibility to determine the "control actions" which have been done by
145 the user (Suspend, SuspendDone, Kill, etc...).
147 enum ControlState { VoidState , ToSuspendStartState ,
148 ToSuspendState , ToSuspendDoneState ,
149 ToKillState , ToKillDoneState , ToStopState ,
150 NumberOfControlStates } ;
152 The AutomatonState is an internal state of the automaton of the Executor
153 of the %SuperVision %Engine. It is used for inner debugging purposes only.
156 enum AutomatonState { UnKnownState ,
161 SuspendedReadyToResumeState ,
166 SuspendedExecutingState ,
167 ResumedExecutingState ,
168 KilledExecutingState ,
169 StoppedExecutingState ,
170 SuccessedExecutingState ,
171 ErroredExecutingState ,
172 SuspendedSuccessedState ,
173 SuspendedErroredState,
174 ResumedSuccessedState ,
175 ResumedErroredState ,
176 KilledSuccessedState ,
178 StoppedSuccessedState ,
179 StoppedErroredState ,
185 SuspendedSuccessedToReStartState ,
186 SuspendedErroredToReStartState ,
189 NumberOfAutomatonStates
200 /*! \brief interface %SuperG
202 This interface contains a set of methods necessary for management of a %graph.
204 interface SuperG : Engines::Component, SALOMEDS::Driver {
207 Constructs a graph with possibility to read/edit it
208 \param aGraph %aGraphName or %aGraphXmlFile
210 SUPERV::Graph Graph(in string aGraph ) ; // aGraphName or aGraphXmlFile
213 Constructs a read Only graph ( for execution ).
214 \note <BR>In this graph there is also a possibility to update nodes, coordinates of the links,
215 of container names and input data.
216 \param aGraph %aGraphName or %aGraphXmlFile
218 SUPERV::Graph GraphE(in string aGraph ) ; // aGraphName or aGraphXmlFile
221 Creates a value for %Input method in interface %Node.
223 SUPERV::Value StringValue( in string aString ) ;
224 SUPERV::Value AnyValue( in any anAny ) ;
226 Gets a graph from its %IOR
228 SUPERV::Graph getGraph(in string ior); // get Graph from is IOR
232 /*! \brief Interface of a node
234 This interface includes a set of methods used for management of the nodes in the graph.
238 interface CNode : Engines::Component {
243 Returns the name of the node(graph).
247 Returns the service of this node .
249 SALOME_ModuleCatalog::Service Service() ;
251 Returns the type of the node.
253 SUPERV::KindOfNode Kind() ;
255 Returns the date of creation of the node(graph).
257 SUPERV::SDate CreationDate() ;
259 Returns the date of last update of the node(graph).
261 SUPERV::SDate LastUpdateDate() ;
263 Returns the name of the version of the node(graph).
267 Returns the name of the author of the node(graph).
271 Returns the string containing comments about this node(graph).
277 Sets the name of the node(graph). Returns True if it is updated.
279 boolean SetName(in string aNewName ) ;
281 Sets the name of the author. Returns True if it is updated.
283 boolean SetAuthor(in string anAuthor ) ;
285 Allows to update the comments about this node(graph).
287 boolean SetComment(in string aComment ) ;
290 Gets a port of the node.
292 SUPERV::Port Port( in string aParameterName ) ;
295 Enters a value into an Input %Port
297 SUPERV::Port Input( in string InputParameterName ,
301 // Create an Input %Port and an Output Port in LabelNode or ControlNode
302 // boolean BusPort( in string InOutParameterName ,
303 // in string InOutParameterType ,
304 // out SUPERV::Port InputPort ,
305 // out SUPERV::Port OutputPort ) ;
306 // boolean BusPorts( in string InputParameterName ,
307 // in string InputParameterType ,
308 // in string OutputParameterName ,
309 // in string OutputParameterType ,
310 // out SUPERV::Port InputPort ,
311 // out SUPERV::Port OutputPort ) ;
314 Gets a list of ports of the node(graph)
316 SUPERV::ListOfPorts Ports() ;
319 SUPERV::ListOfLinks Links() ;
322 Returns True if this node is a graph.
323 \note <BR>A node of the graph can also represent in its turn another graph.
327 Returns True if the node appears to be a %computing node.
329 boolean IsComputing() ;
330 boolean IsFactory() ;
334 boolean IsEndLoop() ;
336 boolean IsEndSwitch() ;
339 Returns the number of SubGraphs
344 Returns nuber of threads.
349 Returns True if the node(graph) is waiting for Data input
351 boolean IsWaiting() ;
354 Returns True if the node(graph) is ready for execution
359 Returns True if the node(graph) is running
361 boolean IsRunning() ;
364 Returns True if execution is finished
369 Returns True if execution is suspended
372 boolean IsSuspended() ;
374 Returns the current state of the graph.
376 SUPERV::GraphState State() ;
378 // wait for ready_to_run state, Suspend and return
381 // wait for running state, Suspend and return
384 // wait for done state, Suspend and return
387 // wait for Suspend state and return
388 boolean SuspendedW() ;
392 // if not running : will be killed when ready to run
393 // if running : Kill immediatly
396 // will be killed only just after running (only for nodes)
399 // if not running : will be stopped when ready to run
400 // if running : Stop immediatly
403 // if not running : will be Suspended when ready to run
404 // if running : Suspend immediatly
407 // will be Suspended only just after running
408 boolean SuspendDone();
410 // if Suspended : running will continue
411 // if not Suspended : cancel current ControlState ( Suspend, Kill, ...)
415 Restarts execution of the node.
419 Restarts execution of the graph beginning from a definite node.
421 boolean ReRunAt( in string aNodeName );
424 Restarts and suspends execution of the node(graph).
428 Restarts and suspends execution of the graph beginning from a defined node.
430 boolean ReStartAt( in string aNodeName );
433 Returns automaton execution state of the node(graph).
435 SUPERV::AutomatonState AutoState() ;
437 // Control state required : Kill, Suspend, Stop
438 SUPERV::ControlState Control() ;
440 Clears the control state of the node(graph).
442 void ControlClear() ;
444 boolean ContainerKill();
446 Sets the position of the node in the window.
448 void Coords( in long X , in long Y ) ;
450 Returns the position of the node along X-axis.
454 Returns the position of the node along Y-axis.
458 Returns the Cpu used by a node in seconds.
465 interface FNode : CNode {
468 string GetComponentName() ;
469 string GetInterfaceName() ;
470 string GetContainer() ;
471 boolean SetComponentName(in string aComponentName ) ;
472 boolean SetInterfaceName(in string anInterfaceName ) ;
473 boolean SetContainer(in string aContainer ) ;
478 interface INode : CNode {
481 void SetPyFunction( in string FuncName ,
482 in SUPERV::ListOfStrings aPyInitFunction ) ;
483 SUPERV::ListOfStrings PyFunction() ;
484 string PyFuncName() ;
486 // Create Input/Output Port in InLineNodes
487 SUPERV::Port InPort( in string aParameterName , in string aParameterType ) ;
488 SUPERV::Port OutPort( in string aParameterName , in string aParameterType ) ;
491 // GOTO/EndLoop/EndSwitch Nodes
493 interface GNode : INode {
496 boolean SetCoupled( in string anInLineNode ) ;
497 SUPERV::INode Coupled() ;
502 interface LNode : GNode {
505 void SetPyInit( in string MoreName ,
506 in SUPERV::ListOfStrings aPyMoreFunction ) ;
507 SUPERV::ListOfStrings PyInit() ;
508 string PyInitName() ;
510 void SetPyMore( in string MoreName ,
511 in SUPERV::ListOfStrings aPyMoreFunction ) ;
512 SUPERV::ListOfStrings PyMore() ;
513 string PyMoreName() ;
515 void SetPyNext( in string NextName ,
516 in SUPERV::ListOfStrings aPyNextFunction ) ;
517 SUPERV::ListOfStrings PyNext() ;
518 string PyNextName() ;
524 interface ELNode : GNode {
530 interface SNode : GNode {
536 interface ESNode : GNode {
540 /*! \brief Interface of a graph
542 This interface includes a set of methods used for management of the graphs in %SUPERVISION module.
546 interface Graph : INode {
549 // Create a Computing Node in a Graph
550 SUPERV::CNode CNode( in SALOME_ModuleCatalog::Service aService ) ;
552 // Create a Factory Node in a Graph
553 SUPERV::FNode FNode( in string aComponentName ,
554 in string anInterfaceName ,
555 in SALOME_ModuleCatalog::Service aService ) ;
557 // Create an InLine Node in a Graph
558 SUPERV::INode INode( in string FuncName , in ListOfStrings aPythonFunction ) ;
560 // Create a GOTO node and link to the corresponding InLine node
561 SUPERV::GNode GNode( in string FuncName , in ListOfStrings aPythonFunction ,
562 in string anINode ) ;
564 // Create a "for" or "while" node and the corresponding end of loop node
565 SUPERV::LNode LNode( in string InitName , in ListOfStrings InitFunction ,
566 in string MoreName , in ListOfStrings MoreFunction ,
567 in string NextName , in ListOfStrings NextFunction ,
568 out SUPERV::INode anEndOfLoop ) ;
570 // Create a "if/elseif/else" or "switch" node and the corresponding end node
571 SUPERV::SNode SNode( in string FuncName , in ListOfStrings aPythonFunction ,
572 out SUPERV::INode anEndOfSwitch ) ;
574 // Create a CORBA Component Object Reference
575 Engines::Component ComponentRef( in string aComputerContainer ,
576 in string aComponentName ) ;
579 Creates a link connecting two ports (%Output %Port and %Input %Port) of the nodes in a Graph
581 SUPERV::Link Link( in SUPERV::Port OutputPort ,
582 in SUPERV::Port InputPort ) ;
585 Imports a graph into a file with XML format
587 boolean Import( in string anXmlFile ) ;
589 Exports a graph from a file with XML format
591 boolean Export( in string anXmlFile ) ;
593 Returns True if the graph is read Only.
595 boolean IsReadOnly() ;
598 Starts asynchronous execution of the graph.
603 Assigns to the %Node an %Event and a %State of the %Node, if the Event is
604 available. And returns immediately Nil, NoEvent and NoState if not.
605 Returns false if the graph is finished, suspended, killed or stopped.
606 \param aNode %Node for which this method is called
607 \param anEvent An operation, which has been performed on this node(graph).
608 \param aState Current state of the graph
610 boolean EventNoW( out SUPERV::CNode aNode , out SUPERV::GraphEvent anEvent ,
611 out SUPERV::GraphState aState ) ;
614 Assigns to the %Node an %Event and a %State of the %Node, if the Event is
615 available. Waits if it is not available at the current moment.
616 Returns false if the graph is finished, suspended, killed or stopped.
617 \param aNode %Node for which this method is called
618 \param anEvent An operation, which has been performed on this node(graph).
619 \param aState Current state of the graph
621 boolean Event( out SUPERV::CNode aNode , out SUPERV::GraphEvent anEvent ,
622 out SUPERV::GraphState aState ) ;
624 // Same as Event but execution of the thread is suspended between the
625 // return of EventW and the next call to EventW
627 Assigns to the %Node an %Event and a %State of the %Node, if the Event is
628 available. And returns immediately Nil, NoEvent and NoState if not.
629 Returns false if the graph is finished, suspended, killed or stopped.
630 \note <BR>Execution of the thread is suspended between the return of this
631 method and its next usage.
632 \param aNode %Node for which this method is called
633 \param anEvent An operation, which has been performed on this node(graph).
634 \param aState Current state of the graph
636 boolean EventW( out SUPERV::CNode aNode , out SUPERV::GraphEvent anEvent ,
637 out SUPERV::GraphState aState ) ;
640 SUPERV::ListOfNodes LevelNodes( in long aLevel ) ;
643 Returns the number of independent subgraphs
645 long GraphsNumber() ;
647 Returns the number of currently running threads.
651 Returns the number of suspended threads.
653 long SuspendedThreads();
655 Returns True if the graph is valid.
659 Returns True if the graph can be executed.
661 boolean IsExecutable() ;
663 Returns True if the graph represents a working algorithm.
665 boolean IsDataFlow() ;
668 Returns True if the graph is being currently edited.
670 boolean IsEditing() ;
672 Returns True if the graph is being currently executed.
674 boolean IsExecuting() ;
676 long LastLevelDone() ;
679 Launches step-by-step execution of the graph.
680 \note The execution is suspended immediatly after performance of operations of the first node and
681 user can specify the nodes, where execution will be again suspended after its resuming.
685 Allows to copy one graph into another.
687 SUPERV::Graph Copy() ;
691 boolean Merge( in Graph aGraph ) ;
693 Returns a list of nodes of the graph.
695 SUPERV::ListOfNodes Nodes() ;
697 Returns a list of links of the graph.
699 SUPERV::ListOfLinks GLinks() ;
701 Gets IOR of the garph.
706 Returns a list of graphs.
707 \note Not implemented
709 SUPERV::ListOfGraphs Graphs() ;
717 /*! \brief Interface of the %link
719 This interface contains a set of methods used for representation and management of the links
720 connecting nodes in a %graph.
724 interface Link : Engines::Component {
727 Associates an %Output %Port to the Link
729 SUPERV::Port OutPort() ;
732 Associates an %Input %Port to the Link
734 SUPERV::Port InPort() ;
737 /*! \name Methods used for representation of links in GUI of %SALOME application :
741 Returns the number of coordinate points which are included in the link.
742 \note <BR>Every link can contain a set of coordinate points which constitute it. These points have
743 index numbers (beginning from 1) and coordinates defining their position in the window. Indexing of
744 the points starts from input port to output port of the corresponding link.
748 Adds a coordinate point to the link.
749 \param index Index of the point.
750 \param X Coordinates of the point.
751 \param Y Coordinates of the point.
753 boolean AddCoord( in long index , in long X , in long Y ) ;
755 Changes the location of a definite coordinate point of the link.
756 \param index Index of the point.
757 \param X Coordinates of the point.
758 \param Y Coordinates of the point.
761 boolean ChangeCoord( in long index , in long X , in long Y ) ;
763 Removes a coordinate point of the link.
764 \param index Index of the point.
767 boolean RemoveCoord( in long index ) ;
770 Sets the location of a coordinate point of the link.
771 \param index Index of the point.
772 \param X Coordinates of the point.
773 \param Y Coordinates of the point.
776 boolean Coords( in long index , out long X , out long Y ) ;
783 /*! \brief %Value interface
785 This interface contains a set of methods used for setting initial parameters of the ports
789 interface Value : Engines::Component {
792 Converts the given value into a value of string type.
796 Converts the given value into a value of independant data type.
800 Returns True if the value represents an IOR.
804 Gets data type of the component.
806 string ComponentDataType() ;
811 /*! \brief %Port interface
813 This interface contains a set of methods used for management of the ports.
817 interface Port : Value {
821 Gives a value to an Input %Port
823 boolean Input( in SUPERV::Value aValue ) ;
826 Returns the node of the port
828 SUPERV::CNode Node() ;
830 Sets the name of the port.
837 // Link of an Input Port
839 Returns the link of an %Input %Port
841 SUPERV::Link Link() ;
844 Returns a list of links of an Input %Port of an EndSwitchNode
846 SUPERV::ListOfLinks Links() ;
849 Returns True if this port appears to be an %Input %Port of a Node
854 Returns True if an %Input %Value exists for that %Input %Port (without link)
859 Returns True if the %Port is linked (without value)
861 // Port with link (without Value)
865 SUPERV::KindOfPort Kind() ;
867 // Port from the service of the node
869 Returns True if the %Port is a parameter of a service
872 // Port is a Gate of the node
874 Returns True if the %Port appears to be a GatePort of the node
877 // Port is a parameter of an InLineNode
879 // Port is a LoopParameter (InitLoop or DoLoop) of an LoopNode
881 // Port is an output parameter of a SwitchNode connected to an InGate
883 Returns True if the %Port appears to be a parameter of a switch node
885 // Port is a parameter of a switch node
887 // Port is an Input parameter of a EndSwitchNode connected to several output ports
888 boolean IsEndSwitch() ;
890 SUPERV::GraphState State() ;