1 //=============================================================================
2 // File : DataFlowBase_OutNode.hxx
4 // Author : Jean Rahuel, CEA
7 //=============================================================================
9 #ifndef _DATAFLOWEXECUTOR_OUTNODE_HXX
10 #define _DATAFLOWEXECUTOR_OUTNODE_HXX
12 #include "SALOME_Component_i.hxx"
14 #include "DataFlowBase_Graph.hxx"
16 #include "DataFlowExecutor_InNode.hxx"
18 namespace GraphExecutor {
20 class OutNode : public GraphBase::Graph {
27 SUPERV::AutomatonState _State ;
28 SUPERV::ControlState _ControlState ;
31 pthread_mutex_t _MutexWait ;
32 pthread_cond_t _EventWait ;
33 pthread_cond_t _JoinWait ;
35 int _Threads ; // Number of threads
36 int _SuspendedThreads ;
37 list< char * > _EventNodes ;
38 list< GraphExecutor::NodeEvent > _Events ;
39 list< SUPERV::AutomatonState > _States ;
45 bool LoadNodes( const GraphBase::ListOfNodes &aNodes ) ;
46 bool LoadLinks( const GraphBase::ListOfLinks &aLinks ) ;
47 bool LoadDatas( const GraphBase::ListOfLinks &aDatas ) ;
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 ) ;
72 bool LoadDataFlow( const GraphBase::SGraph &aDataFlow ) ;
73 bool LoadXml( const char* myFileName ) ;
74 bool LoadInfo( const GraphBase::SNode &aDataFlowInfo ) ;
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 ,
91 const int NodeY = 0 ) ;
93 bool AddInputData( const char* ToNodeName1 ,
94 const char* ToParameterName1 ,
95 const char* ToNodeName2 ,
96 const char* ToParameterName2 ) ;
98 bool IsValid() { if ( !_Valid )
101 bool IsExecutable() { if ( !_Executable )
102 return Executable() ;
103 return _Executable ; } ;
105 bool Run( const bool AndSuspend ) ;
106 bool Run( const char * aNodeName , const char * AtNodeName ,
107 const bool AndSuspend ) ;
109 void PyInitialized( bool init ) {
110 _PyInitialized = init ; } ;
111 bool PyInitialized() {
112 return _PyInitialized ; } ;
114 void CheckAllDone() ;
116 void PThreadLock( pthread_mutex_t * aMutex , char * errmsg ) ;
117 void PThreadUnLock( pthread_mutex_t * aMutex , char * errmsg ) ;
119 void PThreadUnLock() ;
123 void SuspendThread() ;
124 void ResumeThread() ;
125 long Threads() { return _Threads ; } ;
126 long SuspendedThreads() { return _SuspendedThreads ; } ;
129 long Thread( const char * NodeName ) ;
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 ,
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 ) ;
146 void State(SUPERV::AutomatonState aState ) ;
147 const char * StateName(SUPERV::AutomatonState aState ) {
148 return theAutomaton->StateName( aState ) ; }
150 SUPERV::GraphState State() ;
151 SUPERV::GraphState State( const char * NodeName ) ;
152 SUPERV::GraphState State( const char * NodeName ,
153 const char * ServiceParameterName ) ;
155 SUPERV::GraphEvent AutomatonGraphEvent(GraphExecutor::NodeEvent anEvent) ;
156 SUPERV::GraphState AutomatonGraphState(SUPERV::AutomatonState anAutomatonState) ;
158 SUPERV::AutomatonState AutomatonState() ;
159 SUPERV::AutomatonState AutomatonState( const char * NodeName ) ;
161 SUPERV::ControlState ControlState() ;
162 SUPERV::ControlState ControlState( const char * aNodeName ) ;
163 void ControlClear() ;
164 void ControlClear( const char * aNodeName ) ;
166 bool ContainerKill() ;
175 void Done( bool aDone ) { _Done = aDone ; } ;
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() ;
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 ) ;
202 const CORBA::Any *GetInData( const char *ToNodeName ,
203 const char *ToParameterName ) ;
204 const CORBA::Any *GetOutData( const char *FromNodeName ,
205 const char *FromParameterName ) ;