]> SALOME platform Git repositories - modules/superv.git/blob - src/Supervision/CNode_Impl.hxx
Salome HOME
Merge from OCC_development_generic_2006
[modules/superv.git] / src / Supervision / CNode_Impl.hxx
1 //  SUPERV Supervision : contains the implementation of interfaces of SuperVision described in SUPERV.idl
2 //
3 //  Copyright (C) 2003  CEA/DEN, EDF R&D
4 //
5 //
6 //
7 //  File   : CNode_Impl.hxx
8 //  Author : Jean Rahuel
9 //  Module : SUPERV
10 //  $Header: 
11
12 #ifndef _CNODE_IMPL_HXX_
13 #define _CNODE_IMPL_HXX_
14
15 #include <iostream>
16
17 #include "CORBA.h"
18
19 #include <SALOMEconfig.h>
20 #include "SALOME_Component_i.hxx"
21 #include "SALOME_LifeCycleCORBA.hxx"
22
23 #include "DataFlowEditor_DataFlow.hxx"
24 #include "DataFlowExecutor_DataFlow.hxx"
25
26 class CNode_Impl : public POA_SUPERV::CNode ,
27                    public Engines_Component_i  {
28   private:
29
30     CORBA::ORB_ptr             _Orb ;
31     PortableServer::POA_ptr    _Poa ;
32     PortableServer::ObjectId * _ContId ;
33
34     GraphEditor::DataFlow   * _DataFlowEditor ;
35     GraphEditor::InNode     * _DataFlowNode ;
36     bool _IsNode ;
37
38   public:
39     CNode_Impl();
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                 bool isCimpl = true ) ; // mkr : PAL11273 : C++ implementation by default
59     CNode_Impl( CORBA::ORB_ptr orb ,
60                 PortableServer::POA_ptr poa ,
61                 PortableServer::ObjectId * contId , 
62                 const char *instanceName ,
63                 const char *interfaceName ,
64                 GraphEditor::DataFlow * DataFlowEditor ,
65                 const SALOME_ModuleCatalog::Service &NodeService ,
66                 const char * NodeName = NULLSTRING ,
67                 const SUPERV::KindOfNode NodeKindOfNode = SUPERV::InLineNode ,
68                 const GraphBase::ListOfFuncName & aFuncName = GraphBase::ListOfFuncName() ,
69                 const GraphBase::ListOfPythonFunctions & aPythonFunction = GraphBase::ListOfPythonFunctions() ) ;
70     CNode_Impl( CORBA::ORB_ptr orb ,
71                 PortableServer::POA_ptr poa ,
72                 PortableServer::ObjectId * contId , 
73                 const char *instanceName ,
74                 const char *interfaceName ,
75                 GraphEditor::DataFlow * DataFlowEditor ,
76                 GraphEditor::InNode * DataFlowNode ) ;
77     virtual ~CNode_Impl() ;
78     virtual void destroy() ;
79     virtual bool Delete() ;
80
81     void DeletePorts() ;
82
83     virtual void DataFlowEditor( GraphEditor::DataFlow * DataFlowEditor ) {
84             _DataFlowEditor = DataFlowEditor ; } ;
85     virtual GraphEditor::DataFlow * DataFlowEditor() {
86             return _DataFlowEditor ; } ;
87
88     virtual GraphExecutor::DataFlow * DataFlowExecutor() {
89             return DataFlowEditor()->Executor(); } ;
90
91     virtual void DataFlowNode( GraphEditor::InNode * DataFlowNode ) {
92             _DataFlowNode = DataFlowNode ; } ;
93     virtual GraphEditor::InNode * DataFlowNode() {
94             return _DataFlowNode ; } ;
95
96     virtual char * Name() ;
97     virtual bool SetName( const char * aDataFlowName ) ;
98     virtual SALOME_ModuleCatalog::Service * Service() ;
99     virtual SUPERV::KindOfNode Kind() ;
100     virtual SUPERV::SDate CreationDate() ;
101     virtual SUPERV::SDate LastUpdateDate() ;
102     virtual char * Version() ;
103     virtual char * Author() ;
104     virtual bool SetAuthor( const char * aDataFlowAuthor ) ;
105     virtual char * Comment() ;
106     virtual bool SetComment( const char * aDataFlowComment ) ;
107
108     virtual GraphEditor::InNode * DataFlowNode() const {
109             return _DataFlowNode ; } ;
110     virtual GraphBase::ComputingNode * BaseNode() {
111             return DataFlowNode()->ComputingNode() ; } ;
112
113     virtual SUPERV::CNode_var ObjRef() {
114             SUPERV::CNode_var iobject = SUPERV::GNode::_nil() ;
115             if ( DataFlowNode() && _IsNode ) {
116               iobject = SUPERV::CNode::_narrow( DataFlowNode()->ObjRef() ) ;
117             }
118             else {
119               iobject = SUPERV::CNode::_narrow( DataFlowEditor()->Graph()->ObjRef() ) ;
120             }
121             return iobject ; } ;
122     virtual void SetObjRef(SUPERV::CNode_var aNode ) {
123             if ( DataFlowNode() && _IsNode ) {
124               DataFlowNode()->SetObjRef( aNode ) ;
125             }
126             else {
127               if ( DataFlowEditor() ) {
128                 DataFlowEditor()->Graph()->SetObjRef( SUPERV::Graph::_narrow( aNode ) ) ;
129               }
130               if ( DataFlowExecutor() ) {
131                 DataFlowExecutor()->Graph()->SetObjRef( SUPERV::Graph::_narrow( aNode ) ) ;
132               }
133
134             }
135           } ;
136
137     virtual CNode_Impl * ObjImpl() {
138             CNode_Impl * objimpl = NULL ;
139             if ( DataFlowNode() && _IsNode ) {
140               objimpl = DataFlowNode()->ObjImpl() ;
141             }
142             else {
143               objimpl = DataFlowEditor()->Graph()->ObjImpl() ;
144             }
145             return objimpl ; } ;
146     virtual void SetObjImpl( CNode_Impl * objimpl  ) {
147             if ( DataFlowNode() && _IsNode ) {
148               DataFlowNode()->SetObjImpl( objimpl ) ;
149             }
150             else {
151               if ( DataFlowEditor() ) {
152                 DataFlowEditor()->Graph()->SetObjImpl( objimpl ) ;
153               }
154               if ( DataFlowExecutor() ) {
155                 DataFlowExecutor()->Graph()->SetObjImpl( objimpl ) ;
156               }
157
158             }
159           } ;
160
161     virtual void Coords( const long X , const long Y ) ;
162     virtual long X() ;
163     virtual long Y() ;
164
165     virtual SUPERV::Port_ptr Port( const char * aParameterName ) ;
166
167 //    virtual bool BusPorts( const char * InputParameterName ,
168 //                           const char * InputParameterType ,
169 //                           const char * OutputParameterName ,
170 //                           const char * OutputParameterType ,
171 //                           SUPERV::Port_out InputPort ,
172 //                           SUPERV::Port_out OutputPort ) ;
173
174 //    virtual SUPERV::Link_ptr Link( const char * ToServiceParameterName ,
175 //                                    const SUPERV::Value_ptr aValue ) ;
176
177     virtual SUPERV::Port_ptr Input( const char * ToServiceParameterName ,
178                                     const SUPERV::Value_ptr aValue ) ;
179 //    virtual bool InputOfAny( const char * ToServiceParameterName ,
180 //                             const CORBA::Any & aValue ) ;
181
182     virtual SUPERV::Port_ptr GetInPort( const char * aParameterName ) ;
183     virtual SUPERV::Port_ptr GetOutPort( const char * aParameterName ) ;
184
185     virtual SUPERV::StreamPort_ptr GetInStreamPort( const char * aParameterName ) ;
186     virtual SUPERV::StreamPort_ptr GetOutStreamPort( const char * aParameterName ) ;
187
188     virtual SUPERV::ListOfPorts * Ports() ;
189     virtual SUPERV::ListOfStreamPorts * StreamPorts() ;
190
191     virtual bool HasStreamPort() ;
192
193     virtual SUPERV::ListOfLinks * Links() ;
194     virtual SUPERV::ListOfStreamLinks * StreamLinks() ;
195
196     virtual SUPERV::Link_ptr GetLink( const char * ToServiceParameterName ) ;
197     virtual SUPERV::StreamLink_ptr GetStreamLink( const char * ToServiceParameterName ) ;
198
199     virtual bool IsStreamGraph() ;
200     virtual bool IsGraph() ;
201     virtual bool IsMacro() ;
202     virtual bool IsFlowMacro() ;
203     virtual bool IsStreamMacro() ;
204     virtual bool IsHeadGraph() ;
205     virtual long GraphLevel() ;
206     virtual bool IsComputing() ;
207     virtual bool IsFactory() ;
208     virtual bool IsInLine() ;
209     virtual bool IsGOTO() ;
210     virtual bool IsLoop() ;
211     virtual bool IsEndLoop() ;
212     virtual bool IsSwitch() ;
213     virtual bool IsEndSwitch() ;
214
215     virtual long SubGraph() ;
216     virtual long SubStreamGraph() ;
217
218   // mkr : PAL8060 : this method is not used
219   //virtual bool IsLinked(const char * ToServiceParameterName ) ;
220     virtual bool HasInput(const char * ToServiceParameterName ) ;
221
222 //    virtual SUPERV::Link_ptr GetLink(const char * ToServiceParameterName ) ;
223 //    virtual SUPERV::Value_ptr GetValue(const char * FromServiceParameterName ) ;
224
225     virtual bool IsReady() ;
226     virtual bool IsWaiting() ;
227     virtual bool IsRunning() ;
228     virtual bool IsDone() ;
229     virtual bool IsSuspended() ;
230
231     virtual SUPERV::GraphState State() ;
232     virtual SUPERV::ControlState Control() ;
233     virtual void ControlClear() ;
234
235     virtual long Thread() ;
236
237     GraphExecutor::AutomatonState AutoState() ;
238
239     virtual bool ReadyW() ;
240     virtual bool RunningW() ;
241     virtual bool DoneW() ;
242     virtual bool SuspendedW() ;
243
244     virtual void ping() ;
245     virtual bool ContainerKill() ;
246
247     virtual bool Kill() ;
248     virtual bool KillDone() ;
249     virtual bool Stop() ;
250     virtual bool Suspend() ;
251     virtual bool SuspendDone() ;
252     virtual bool Resume() ;
253
254     virtual long CpuUsed() ;
255
256     virtual bool IsExecuting();
257
258 } ;
259
260 #endif