]> SALOME platform Git repositories - modules/superv.git/blob - src/GraphExecutor/DataFlowExecutor_OutNode.hxx
Salome HOME
NRI : Merge from V1_2.
[modules/superv.git] / src / GraphExecutor / DataFlowExecutor_OutNode.hxx
1 //=============================================================================
2 // File      : DataFlowBase_OutNode.hxx
3 // Created   : 2002
4 // Author    : Jean Rahuel, CEA
5 // Project   : SALOME
6 // $Header:
7 //=============================================================================
8
9 #ifndef _DATAFLOWEXECUTOR_OUTNODE_HXX
10 #define _DATAFLOWEXECUTOR_OUTNODE_HXX
11
12 #include "SALOME_Component_i.hxx"
13
14 #include "DataFlowBase_Graph.hxx"
15
16 #include "DataFlowExecutor_InNode.hxx"
17
18 namespace GraphExecutor {
19
20   class OutNode : public GraphBase::Graph {
21
22     private :
23
24       bool                    _PyInitialized ;
25       bool                    _Valid ;
26       bool                    _Executable ;
27       SUPERV::AutomatonState  _State ;
28       SUPERV::ControlState    _ControlState ;
29       bool                    _Done ;
30
31       pthread_mutex_t                  _MutexWait ;
32       pthread_cond_t                   _EventWait ;
33       pthread_cond_t                   _JoinWait ;
34       bool                             _JustStarted ;
35       int                              _Threads ; // Number of threads
36       int                              _SuspendedThreads ;
37       list< char * >                   _EventNodes ;
38       list< GraphExecutor::NodeEvent > _Events ;
39       list< SUPERV::AutomatonState >   _States ;
40
41       bool Valid() ;
42       void UnValid() ;
43       bool Executable() ;
44
45       bool LoadNodes( const GraphBase::ListOfNodes &aNodes ) ;
46       bool LoadLinks( const GraphBase::ListOfLinks &aLinks ) ;
47       bool LoadDatas( const GraphBase::ListOfLinks &aDatas ) ;
48
49       CORBA::ORB_ptr _Orb ;
50
51     public :
52   
53       OutNode() ;
54       OutNode( CORBA::ORB_ptr ORB, SALOME_NamingService* ptrNamingService ,
55                const char *DataFlowName ,
56                const char * DebugFileName );
57       OutNode( CORBA::ORB_ptr ORB, SALOME_NamingService* ptrNamingService ,
58                const SALOME_ModuleCatalog::Service& DataFlowService ,
59                const char *DataFlowComponentName ,
60                const char *DataFlowInterfaceName ,
61                const char *DataFlowName ,
62                const SUPERV::KindOfNode DataFlowkind ,
63                const SUPERV::SDate DataFlowFirstCreation ,
64                const SUPERV::SDate DataFlowLastModification ,
65                const char * DataFlowEditorRelease ,
66                const char * DataFlowAuthor ,
67                const char * DataFlowComputer ,
68                const char * DataFlowComment ,
69                const char * DebugFileName ) ;
70       virtual ~OutNode() ;
71
72       bool LoadDataFlow( const GraphBase::SGraph &aDataFlow ) ;
73       bool LoadXml( const char* myFileName ) ;
74       bool LoadInfo( const GraphBase::SNode &aDataFlowInfo ) ;
75
76       GraphExecutor::InNode * AddNode(
77                         const SALOME_ModuleCatalog::Service& NodeService ,
78                         GraphBase::ListOfFuncName aFuncName ,
79                         GraphBase::ListOfPythonFunctions aPythonFunction ,
80                         const char * NodeComponentName ,
81                         const char * NodeInterfaceName ,
82                         const char * NodeName ,
83                         const SUPERV::KindOfNode NodeKindOfNode = SUPERV::ComputingNode ,
84                         const SUPERV::SDate NodeFirstCreation = SUPERV::SDate() ,
85                         const SUPERV::SDate NodeLastModification = SUPERV::SDate() ,
86                         const char * NodeEditorRelease = NULL ,
87                         const char * NodeAuthor = NULL ,
88                         const char * NodeComputer = NULL ,
89                         const char * NodeComment = NULL ,
90                         const int NodeX = 0 ,
91                         const int NodeY = 0 ) ;
92
93       bool AddInputData( const char* ToNodeName1 ,
94                          const char* ToParameterName1 ,
95                          const char* ToNodeName2 ,
96                          const char* ToParameterName2 ) ;
97
98       bool IsValid() { if ( !_Valid )
99                          return Valid() ;
100                        return _Valid ; } ;
101       bool IsExecutable() { if ( !_Executable )
102                                 return Executable() ;
103                             return _Executable ; } ;
104
105       bool Run( const bool AndSuspend ) ;
106       bool Run( const char * aNodeName , const char * AtNodeName ,
107                 const bool AndSuspend ) ;
108
109       void PyInitialized( bool init ) {
110            _PyInitialized = init ; } ;
111       bool PyInitialized() {
112            return _PyInitialized ; } ;
113
114       void CheckAllDone() ;
115
116       void PThreadLock( pthread_mutex_t * aMutex , char * errmsg ) ;
117       void PThreadUnLock( pthread_mutex_t * aMutex , char * errmsg ) ;
118       void PThreadLock() ;
119       void PThreadUnLock() ;
120
121       void NewThread() ;
122       void ExitThread() ;
123       void SuspendThread() ;
124       void ResumeThread() ;
125       long Threads() { return _Threads ; } ;
126       long SuspendedThreads() { return _SuspendedThreads ; } ;
127       void JoinedWait() ;
128
129       long Thread( const char * NodeName ) ;
130
131       bool PushEvent( GraphExecutor::InNode * aNode ,
132                       GraphExecutor::NodeEvent anEvent ,
133                       SUPERV::AutomatonState aState ) ;
134       bool StateWait( SUPERV::GraphState aState ) ;
135       bool Event( char ** aNodeName ,
136                   SUPERV::GraphEvent & anEvent ,
137                   SUPERV::GraphState & aState ,
138                   bool WithWait ) ;
139       bool EventW( char ** aNodeName ,
140                    SUPERV::GraphEvent & anEvent ,
141                    SUPERV::GraphState & aState ) ;
142       bool EventWait( char ** aNodeName ,
143                       SUPERV::GraphEvent & anEvent ,
144                       SUPERV::GraphState & aState ) ;
145
146       void State(SUPERV::AutomatonState aState ) ;
147       const char * StateName(SUPERV::AutomatonState aState ) {
148              return theAutomaton->StateName( aState ) ; }
149
150       SUPERV::GraphState State() ;
151       SUPERV::GraphState State( const char * NodeName ) ;
152       SUPERV::GraphState State( const char * NodeName ,
153                                 const char * ServiceParameterName ) ;
154
155       SUPERV::GraphEvent AutomatonGraphEvent(GraphExecutor::NodeEvent anEvent) ;
156       SUPERV::GraphState AutomatonGraphState(SUPERV::AutomatonState anAutomatonState) ;
157
158       SUPERV::AutomatonState AutomatonState() ;
159       SUPERV::AutomatonState AutomatonState( const char * NodeName ) ;
160
161       SUPERV::ControlState ControlState() ;
162       SUPERV::ControlState ControlState( const char * aNodeName ) ;
163       void ControlClear() ;
164       void ControlClear( const char * aNodeName ) ;
165
166       bool ContainerKill() ;
167
168       bool Suspend() ;
169       bool Resume() ;
170       bool Kill() ;
171       bool Stop() ;
172       bool ReRun() ;
173       bool ReStart() ;
174
175       void Done( bool aDone ) { _Done = aDone ; } ;
176
177       bool IsWaiting() ;
178       bool IsReady() ;
179       bool IsRunning() ;
180       bool IsDone() ;
181       bool IsSuspended() ;
182       bool IsKilled() ;
183       bool IsStopped() ;
184       bool IsWaiting( const char * NodeName ) ;
185       bool IsReady( const char * NodeName ) ;
186       bool IsRunning( const char * NodeName ) ;
187       bool IsDone( const char * NodeName ) ;
188       bool IsSuspended( const char * NodeName ) ;
189       bool IsDone( const char * NodeName ,
190                    const char * ServiceParameterName ) ;
191       long LastLevelDone() ;
192
193       bool ReadyWait() ;
194       bool RunningWait() ;
195       bool DoneWait() ;
196       bool SuspendedWait() ;
197       bool ReadyWait( const char * NodeName ) ;
198       bool RunningWait( const char * NodeName ) ;
199       bool DoneWait( const char * NodeName ) ;
200       bool SuspendedWait( const char * NodeName ) ;
201
202       const CORBA::Any *GetInData( const char *ToNodeName ,
203                                    const char *ToParameterName ) ;
204       const CORBA::Any *GetOutData( const char *FromNodeName ,
205                                     const char *FromParameterName ) ;
206   };
207 };
208
209 #endif