1 // SUPERV Supervision : contains the implementation of interfaces of SuperVision described in SUPERV.idl
3 // Copyright (C) 2003 CEA/DEN, EDF R&D
7 // File : CNode_Impl.hxx
8 // Author : Jean Rahuel
12 #ifndef _CNODE_IMPL_HXX_
13 #define _CNODE_IMPL_HXX_
19 #include <SALOMEconfig.h>
20 #include "SALOME_Component_i.hxx"
21 #include "SALOME_LifeCycleCORBA.hxx"
23 #include "DataFlowEditor_DataFlow.hxx"
24 #include "DataFlowExecutor_DataFlow.hxx"
26 class CNode_Impl : public POA_SUPERV::CNode ,
27 public Engines_Component_i {
31 PortableServer::POA_ptr _Poa ;
32 PortableServer::ObjectId * _ContId ;
34 GraphEditor::DataFlow * _DataFlowEditor ;
35 GraphEditor::InNode * _DataFlowNode ;
40 CNode_Impl( CORBA::ORB_ptr orb ,
41 PortableServer::POA_ptr poa ,
42 PortableServer::ObjectId * contId ,
43 const char *instanceName ,
44 const char *interfaceName ,
45 const char *aDataFlowName ,
46 const SUPERV::KindOfNode aKindOfNode ) ;
47 CNode_Impl( CORBA::ORB_ptr orb ,
48 PortableServer::POA_ptr poa ,
49 PortableServer::ObjectId * contId ,
50 const char *instanceName ,
51 const char *interfaceName ,
52 GraphEditor::DataFlow * DataFlowEditor ,
53 const SALOME_ModuleCatalog::Service &NodeService ,
54 const char * NodeName = NULLSTRING ,
55 const SUPERV::KindOfNode NodeKindOfNode = SUPERV::ComputingNode ,
56 const char * aFuncName = NULLSTRING ,
57 const SUPERV::ListOfStrings & aPythonFunction = SUPERV::ListOfStrings() ) ;
58 CNode_Impl( CORBA::ORB_ptr orb ,
59 PortableServer::POA_ptr poa ,
60 PortableServer::ObjectId * contId ,
61 const char *instanceName ,
62 const char *interfaceName ,
63 GraphEditor::DataFlow * DataFlowEditor ,
64 const SALOME_ModuleCatalog::Service &NodeService ,
65 const char * NodeName = NULLSTRING ,
66 const SUPERV::KindOfNode NodeKindOfNode = SUPERV::InLineNode ,
67 const GraphBase::ListOfFuncName & aFuncName = GraphBase::ListOfFuncName() ,
68 const GraphBase::ListOfPythonFunctions & aPythonFunction = GraphBase::ListOfPythonFunctions() ) ;
69 CNode_Impl( CORBA::ORB_ptr orb ,
70 PortableServer::POA_ptr poa ,
71 PortableServer::ObjectId * contId ,
72 const char *instanceName ,
73 const char *interfaceName ,
74 GraphEditor::DataFlow * DataFlowEditor ,
75 GraphEditor::InNode * DataFlowNode ) ;
76 virtual ~CNode_Impl() ;
77 virtual void destroy() ;
78 virtual bool Delete() ;
82 virtual void DataFlowEditor( GraphEditor::DataFlow * DataFlowEditor ) {
83 _DataFlowEditor = DataFlowEditor ; } ;
84 virtual GraphEditor::DataFlow * DataFlowEditor() {
85 return _DataFlowEditor ; } ;
87 virtual GraphExecutor::DataFlow * DataFlowExecutor() {
88 return DataFlowEditor()->Executor(); } ;
90 virtual void DataFlowNode( GraphEditor::InNode * DataFlowNode ) {
91 _DataFlowNode = DataFlowNode ; } ;
92 virtual GraphEditor::InNode * DataFlowNode() {
93 return _DataFlowNode ; } ;
95 virtual char * Name() ;
96 virtual bool SetName( const char * aDataFlowName ) ;
97 virtual SALOME_ModuleCatalog::Service * Service() ;
98 virtual SUPERV::KindOfNode Kind() ;
99 virtual SUPERV::SDate CreationDate() ;
100 virtual SUPERV::SDate LastUpdateDate() ;
101 virtual char * Version() ;
102 virtual char * Author() ;
103 virtual bool SetAuthor( const char * aDataFlowAuthor ) ;
104 virtual char * Comment() ;
105 virtual bool SetComment( const char * aDataFlowComment ) ;
107 virtual GraphEditor::InNode * DataFlowNode() const {
108 return _DataFlowNode ; } ;
109 virtual GraphBase::ComputingNode * BaseNode() {
110 return DataFlowNode()->ComputingNode() ; } ;
112 virtual SUPERV::CNode_var ObjRef() {
113 SUPERV::CNode_var iobject = SUPERV::GNode::_nil() ;
114 if ( DataFlowNode() && _IsNode ) {
115 iobject = SUPERV::CNode::_narrow( DataFlowNode()->ObjRef() ) ;
118 iobject = SUPERV::CNode::_narrow( DataFlowEditor()->Graph()->ObjRef() ) ;
121 virtual void SetObjRef(SUPERV::CNode_var aNode ) {
122 if ( DataFlowNode() && _IsNode ) {
123 DataFlowNode()->SetObjRef( aNode ) ;
126 if ( DataFlowEditor() ) {
127 DataFlowEditor()->Graph()->SetObjRef( SUPERV::Graph::_narrow( aNode ) ) ;
129 if ( DataFlowExecutor() ) {
130 DataFlowExecutor()->Graph()->SetObjRef( SUPERV::Graph::_narrow( aNode ) ) ;
136 virtual CNode_Impl * ObjImpl() {
137 CNode_Impl * objimpl = NULL ;
138 if ( DataFlowNode() && _IsNode ) {
139 objimpl = DataFlowNode()->ObjImpl() ;
142 objimpl = DataFlowEditor()->Graph()->ObjImpl() ;
145 virtual void SetObjImpl( CNode_Impl * objimpl ) {
146 if ( DataFlowNode() && _IsNode ) {
147 DataFlowNode()->SetObjImpl( objimpl ) ;
150 if ( DataFlowEditor() ) {
151 DataFlowEditor()->Graph()->SetObjImpl( objimpl ) ;
153 if ( DataFlowExecutor() ) {
154 DataFlowExecutor()->Graph()->SetObjImpl( objimpl ) ;
160 virtual void Coords( const long X , const long Y ) ;
164 virtual SUPERV::Port_ptr Port( const char * aParameterName ) ;
166 // virtual bool BusPorts( const char * InputParameterName ,
167 // const char * InputParameterType ,
168 // const char * OutputParameterName ,
169 // const char * OutputParameterType ,
170 // SUPERV::Port_out InputPort ,
171 // SUPERV::Port_out OutputPort ) ;
173 // virtual SUPERV::Link_ptr Link( const char * ToServiceParameterName ,
174 // const SUPERV::Value_ptr aValue ) ;
176 virtual SUPERV::Port_ptr Input( const char * ToServiceParameterName ,
177 const SUPERV::Value_ptr aValue ) ;
178 // virtual bool InputOfAny( const char * ToServiceParameterName ,
179 // const CORBA::Any & aValue ) ;
181 virtual SUPERV::Port_ptr GetInPort( const char * aParameterName ) ;
182 virtual SUPERV::Port_ptr GetOutPort( const char * aParameterName ) ;
184 virtual SUPERV::StreamPort_ptr GetInStreamPort( const char * aParameterName ) ;
185 virtual SUPERV::StreamPort_ptr GetOutStreamPort( const char * aParameterName ) ;
187 virtual SUPERV::ListOfPorts * Ports() ;
188 virtual SUPERV::ListOfStreamPorts * StreamPorts() ;
190 virtual bool HasStreamPort() ;
192 virtual SUPERV::ListOfLinks * Links() ;
193 virtual SUPERV::ListOfStreamLinks * StreamLinks() ;
195 virtual SUPERV::Link_ptr GetLink( const char * ToServiceParameterName ) ;
196 virtual SUPERV::StreamLink_ptr GetStreamLink( const char * ToServiceParameterName ) ;
198 virtual bool IsStreamGraph() ;
199 virtual bool IsGraph() ;
200 virtual bool IsMacro() ;
201 virtual bool IsFlowMacro() ;
202 virtual bool IsStreamMacro() ;
203 virtual bool IsHeadGraph() ;
204 virtual long GraphLevel() ;
205 virtual bool IsComputing() ;
206 virtual bool IsFactory() ;
207 virtual bool IsInLine() ;
208 virtual bool IsGOTO() ;
209 virtual bool IsLoop() ;
210 virtual bool IsEndLoop() ;
211 virtual bool IsSwitch() ;
212 virtual bool IsEndSwitch() ;
214 virtual long SubGraph() ;
215 virtual long SubStreamGraph() ;
217 virtual bool IsLinked(const char * ToServiceParameterName ) ;
218 virtual bool HasInput(const char * ToServiceParameterName ) ;
220 // virtual SUPERV::Link_ptr GetLink(const char * ToServiceParameterName ) ;
221 // virtual SUPERV::Value_ptr GetValue(const char * FromServiceParameterName ) ;
223 virtual bool IsReady() ;
224 virtual bool IsWaiting() ;
225 virtual bool IsRunning() ;
226 virtual bool IsDone() ;
227 virtual bool IsSuspended() ;
229 virtual SUPERV::GraphState State() ;
230 virtual SUPERV::ControlState Control() ;
231 virtual void ControlClear() ;
233 virtual long Thread() ;
235 GraphExecutor::AutomatonState AutoState() ;
237 virtual bool ReadyW() ;
238 virtual bool RunningW() ;
239 virtual bool DoneW() ;
240 virtual bool SuspendedW() ;
242 virtual void ping() ;
243 virtual bool ContainerKill() ;
245 virtual bool Kill() ;
246 virtual bool KillDone() ;
247 virtual bool Stop() ;
248 virtual bool Suspend() ;
249 virtual bool SuspendDone() ;
250 virtual bool Resume() ;
253 virtual bool ReRun() ;
254 virtual bool ReRunAt( const char * aNodeName ) ;
255 virtual bool ReStart() ;
256 virtual bool ReStartAt( const char * aNodeName ) ;
258 virtual long CpuUsed() ;
260 virtual bool IsExecuting();