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 \defgroup Supervision SALOME SUPERVISION module
31 #ifndef __SUPERV_IDL__
32 #define __SUPERV_IDL__
34 #include "SALOME_ModuleCatalog.idl"
35 #include "SALOME_Component.idl"
36 #include "SALOMEDS.idl"
37 /*! \ingroup Supervision
38 The main package of interfaces of %SUPERVISION module
43 This enumeration contains a set of elements defining the type of the port.
44 \note <BR>In general, ports represent <STRONG>input or output parameters</STRONG> of the functions,
45 implemented in different kinds of nodes of the graph.
47 enum KindOfPort { UndefinedParameter , ServiceParameter , GateParameter ,
48 InLineParameter , LoopParameter , SwitchParameter ,
49 EndSwitchParameter , GOTOParameter } ;
52 This enumeration contains a set of elements defining the type of the node.
54 enum KindOfNode { FactoryNode , DataFlowNode , ComputingNode ,
55 InLineNode , LoopNode , EndLoopNode ,
56 SwitchNode , EndSwitchNode , GOTONode , UnknownNode };
59 This struct contains fields defining the date.
70 This enumeration contains a set of elements defining the type of operation, which has been performed
74 enum GraphEvent { UndefinedEvent , NoEvent , NewThreadEvent ,
75 WaitingEvent , ReadyEvent ,
76 RunningEvent , DoneEvent , ErroredEvent ,
77 SuspendEvent , ResumeEvent ,
78 KillEvent , StopEvent ,
79 ReRunEvent , ReStartEvent } ;
81 // UndefinedState : Non existing Node, Port etc...
83 This enumeration contains a set of elements defining the current state of the node(graph).
86 enum GraphState { UndefinedState , NoState , EditingState , SuspendState ,
87 WaitingState , ReadyState , SuspendReadyState ,
89 DoneState , ErrorState ,
90 SuspendDoneState , SuspendErroredState ,
91 KillState , StopState ,
92 ReRunState , ReStartState ,
93 NumberOfGraphStates } ;
95 typedef sequence<string> ListOfStrings ;
101 typedef sequence<Link> ListOfLinks ;
105 typedef sequence<Port> ListOfPorts ;
115 typedef sequence<CNode> ListOfCNodes ;
116 typedef sequence<FNode> ListOfFNodes ;
117 typedef sequence<INode> ListOfINodes ;
118 typedef sequence<GNode> ListOfGNodes ;
119 typedef sequence<LNode> ListOfLNodes ;
120 typedef sequence<ELNode> ListOfELNodes ;
121 typedef sequence<SNode> ListOfSNodes ;
122 typedef sequence<ESNode> ListOfESNodes ;
125 ListOfCNodes CNodes ;
126 ListOfFNodes FNodes ;
127 ListOfINodes INodes ;
128 ListOfGNodes GNodes ;
129 ListOfLNodes LNodes ;
130 ListOfELNodes ELNodes ;
131 ListOfSNodes SNodes ;
132 ListOfESNodes ESNodes ;
137 typedef sequence<Graph> ListOfGraphs ;
139 // ToSuspendState : will be Suspended before running if waiting or
140 // will be Suspended while running or
141 // will be Suspended after run
142 // ToSuspendStartState : will be Suspended at the beginning of execution
143 // ToSuspendDoneState : will be Suspended after run
145 This enumeration contains a set of elements defining the %ControlState of the node.
146 The %ControlState gives a possibility to determine the "control actions" which have been done by
147 the user (Suspend, SuspendDone, Kill, etc...).
149 enum ControlState { VoidState , ToSuspendStartState ,
150 ToSuspendState , ToSuspendDoneState ,
151 ToKillState , ToKillDoneState , ToStopState ,
152 NumberOfControlStates } ;
154 The AutomatonState is an internal state of the automaton of the Executor
155 of the %SuperVision %Engine. It is used for inner debugging purposes only.
158 enum AutomatonState { UnKnownState ,
163 SuspendedReadyToResumeState ,
168 SuspendedExecutingState ,
169 ResumedExecutingState ,
170 KilledExecutingState ,
171 StoppedExecutingState ,
172 SuccessedExecutingState ,
173 ErroredExecutingState ,
174 SuspendedSuccessedState ,
175 SuspendedErroredState,
176 ResumedSuccessedState ,
177 ResumedErroredState ,
178 KilledSuccessedState ,
180 StoppedSuccessedState ,
181 StoppedErroredState ,
187 SuspendedSuccessedToReStartState ,
188 SuspendedErroredToReStartState ,
191 NumberOfAutomatonStates
202 /*! \brief interface %SuperG
204 This interface contains a set of methods necessary for management of a %graph.
206 interface SuperG : Engines::Component, SALOMEDS::Driver {
209 Constructs a graph with possibility to read/edit it
210 \param aGraph %aGraphName or %aGraphXmlFile
212 SUPERV::Graph Graph(in string aGraph ) ; // aGraphName or aGraphXmlFile
215 Constructs a read Only graph ( for execution ).
216 \note <BR>In this graph there is also a possibility to update nodes, coordinates of the links,
217 of container names and input data.
218 \param aGraph %aGraphName or %aGraphXmlFile
220 SUPERV::Graph GraphE(in string aGraph ) ; // aGraphName or aGraphXmlFile
223 Creates a value for %Input method in interface %Node.
225 SUPERV::Value StringValue( in string aString ) ;
226 SUPERV::Value AnyValue( in any anAny ) ;
228 Gets a graph from its %IOR
230 SUPERV::Graph getGraph(in string ior); // get Graph from is IOR
234 /*! \brief Interface of a node
236 This interface includes a set of methods used for management of the nodes in the graph.
240 interface CNode : Engines::Component {
245 Returns the name of the node(graph).
249 Returns the service of this node .
251 SALOME_ModuleCatalog::Service Service() ;
253 Returns the type of the node.
255 SUPERV::KindOfNode Kind() ;
257 Returns the date of creation of the node(graph).
259 SUPERV::SDate CreationDate() ;
261 Returns the date of last update of the node(graph).
263 SUPERV::SDate LastUpdateDate() ;
265 Returns the name of the version of the node(graph).
269 Returns the name of the author of the node(graph).
273 Returns the string containing comments about this node(graph).
279 Sets the name of the node(graph). Returns True if it is updated.
281 boolean SetName(in string aNewName ) ;
283 Sets the name of the author. Returns True if it is updated.
285 boolean SetAuthor(in string anAuthor ) ;
287 Allows to update the comments about this node(graph).
289 boolean SetComment(in string aComment ) ;
292 Gets a port of the node.
294 SUPERV::Port Port( in string aParameterName ) ;
297 Enters a value into an Input %Port
299 SUPERV::Port Input( in string InputParameterName ,
303 // Create an Input %Port and an Output Port in LabelNode or ControlNode
304 // boolean BusPort( in string InOutParameterName ,
305 // in string InOutParameterType ,
306 // out SUPERV::Port InputPort ,
307 // out SUPERV::Port OutputPort ) ;
308 // boolean BusPorts( in string InputParameterName ,
309 // in string InputParameterType ,
310 // in string OutputParameterName ,
311 // in string OutputParameterType ,
312 // out SUPERV::Port InputPort ,
313 // out SUPERV::Port OutputPort ) ;
316 Gets a list of ports of the node(graph)
318 SUPERV::ListOfPorts Ports() ;
321 SUPERV::ListOfLinks Links() ;
324 Returns True if this node is a graph.
325 \note <BR>A node of the graph can also represent in its turn another graph.
329 Returns True if the node appears to be a %computing node.
331 boolean IsComputing() ;
332 boolean IsFactory() ;
336 boolean IsEndLoop() ;
338 boolean IsEndSwitch() ;
341 Returns the number of SubGraphs
346 Returns nuber of threads.
351 Returns True if the node(graph) is waiting for Data input
353 boolean IsWaiting() ;
356 Returns True if the node(graph) is ready for execution
361 Returns True if the node(graph) is running
363 boolean IsRunning() ;
366 Returns True if execution is finished
371 Returns True if execution is suspended
374 boolean IsSuspended() ;
376 Returns the current state of the graph.
378 SUPERV::GraphState State() ;
380 // wait for ready_to_run state, Suspend and return
383 // wait for running state, Suspend and return
386 // wait for done state, Suspend and return
389 // wait for Suspend state and return
390 boolean SuspendedW() ;
394 // if not running : will be killed when ready to run
395 // if running : Kill immediatly
398 // will be killed only just after running (only for nodes)
401 // if not running : will be stopped when ready to run
402 // if running : Stop immediatly
405 // if not running : will be Suspended when ready to run
406 // if running : Suspend immediatly
409 // will be Suspended only just after running
410 boolean SuspendDone();
412 // if Suspended : running will continue
413 // if not Suspended : cancel current ControlState ( Suspend, Kill, ...)
417 Restarts execution of the node(graph).
421 Restarts execution of the graph beginning from a definite node.
423 boolean ReRunAt( in string aNodeName );
426 Restarts and suspends execution of the node(graph).
430 Restarts and suspends execution of the graph beginning from a definite node.
432 boolean ReStartAt( in string aNodeName );
435 Returns automaton execution state of the node(graph).
437 SUPERV::AutomatonState AutoState() ;
439 // Control state required : Kill, Suspend, Stop
440 SUPERV::ControlState Control() ;
442 Clears the control state of the node(graph).
444 void ControlClear() ;
446 boolean ContainerKill();
448 Sets the position of the node in the window.
450 void Coords( in long X , in long Y ) ;
452 Returns the position of the node along X-axis.
456 Returns the position of the node along Y-axis.
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() ;