Salome HOME
a642a9fda83670484912745f60bd47b2c65117fa
[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     CNode_Impl( CORBA::ORB_ptr orb ,
47                 PortableServer::POA_ptr poa ,
48                 PortableServer::ObjectId * contId , 
49                 const char *instanceName ,
50                 const char *interfaceName ,
51                 GraphEditor::DataFlow * DataFlowEditor ,
52                 const SALOME_ModuleCatalog::Service &NodeService ,
53                 const char * NodeName = NULLSTRING ,
54                 const SUPERV::KindOfNode NodeKindOfNode = SUPERV::ComputingNode ,
55                 const char * aFuncName = NULLSTRING ,
56                 const SUPERV::ListOfStrings & aPythonFunction = SUPERV::ListOfStrings() ) ;
57     CNode_Impl( CORBA::ORB_ptr orb ,
58                 PortableServer::POA_ptr poa ,
59                 PortableServer::ObjectId * contId , 
60                 const char *instanceName ,
61                 const char *interfaceName ,
62                 GraphEditor::DataFlow * DataFlowEditor ,
63                 const SALOME_ModuleCatalog::Service &NodeService ,
64                 const char * NodeName = NULLSTRING ,
65                 const SUPERV::KindOfNode NodeKindOfNode = SUPERV::InLineNode ,
66                 const GraphBase::ListOfFuncName & aFuncName = GraphBase::ListOfFuncName() ,
67                 const GraphBase::ListOfPythonFunctions & aPythonFunction = GraphBase::ListOfPythonFunctions() ) ;
68     CNode_Impl( CORBA::ORB_ptr orb ,
69                 PortableServer::POA_ptr poa ,
70                 PortableServer::ObjectId * contId , 
71                 const char *instanceName ,
72                 const char *interfaceName ,
73                 GraphEditor::DataFlow * DataFlowEditor ,
74                 GraphEditor::InNode * DataFlowNode ) ;
75     virtual ~CNode_Impl() ;
76     virtual void destroy() ;
77     virtual bool Delete() ;
78
79     virtual void DataFlowEditor( GraphEditor::DataFlow * DataFlowEditor ) {
80             _DataFlowEditor = DataFlowEditor ; } ;
81     virtual GraphEditor::DataFlow * DataFlowEditor() {
82             return _DataFlowEditor ; } ;
83     virtual void DataFlowNode( GraphEditor::InNode * DataFlowNode ) {
84             _DataFlowNode = DataFlowNode ; } ;
85     virtual GraphEditor::InNode * DataFlowNode() {
86             return _DataFlowNode ; } ;
87
88     virtual char * Name() ;
89     virtual bool SetName( const char * aDataFlowName ) ;
90     virtual SALOME_ModuleCatalog::Service * Service() ;
91     virtual SUPERV::KindOfNode Kind() ;
92     virtual SUPERV::SDate CreationDate() ;
93     virtual SUPERV::SDate LastUpdateDate() ;
94     virtual char * Version() ;
95     virtual char * Author() ;
96     virtual bool SetAuthor( const char * aDataFlowAuthor ) ;
97     virtual char * Comment() ;
98     virtual bool SetComment( const char * aDataFlowComment ) ;
99
100     virtual GraphEditor::InNode * DataFlowNode() const {
101             return _DataFlowNode ; } ;
102     virtual GraphBase::ComputingNode * BaseNode() {
103             return _DataFlowNode->ComputingNode() ; } ;
104
105     virtual SUPERV::CNode_var ObjRef() {
106             SUPERV::CNode_var iobject = SUPERV::GNode::_nil() ;
107             if ( _DataFlowNode && _IsNode ) {
108               iobject = SUPERV::CNode::_narrow( _DataFlowNode->ObjRef() ) ;
109             }
110             else {
111               iobject = SUPERV::CNode::_narrow( _DataFlowEditor->ObjRef() ) ;
112             }
113             return iobject ; } ;
114     virtual void SetObjRef(SUPERV::CNode_var aNode ) {
115             if ( _DataFlowNode && _IsNode ) {
116               _DataFlowNode->SetObjRef( aNode ) ;
117             }
118             else {
119               _DataFlowEditor->SetObjRef( SUPERV::Graph::_narrow( aNode ) ) ;
120             } } ;
121
122     virtual void Coords( const long X , const long Y ) ;
123     virtual long X() ;
124     virtual long Y() ;
125
126     virtual SUPERV::Port_ptr Port( const char * aParameterName ) ;
127
128 //    virtual bool BusPorts( const char * InputParameterName ,
129 //                           const char * InputParameterType ,
130 //                           const char * OutputParameterName ,
131 //                           const char * OutputParameterType ,
132 //                           SUPERV::Port_out InputPort ,
133 //                           SUPERV::Port_out OutputPort ) ;
134
135 //    virtual SUPERV::Link_ptr Link( const char * ToServiceParameterName ,
136 //                                    const SUPERV::Value_ptr aValue ) ;
137
138     virtual SUPERV::Port_ptr Input( const char * ToServiceParameterName ,
139                                     const SUPERV::Value_ptr aValue ) ;
140
141     virtual SUPERV::ListOfPorts * Ports() ;
142
143     virtual SUPERV::ListOfLinks * Links() ;
144
145     virtual SUPERV::Link_ptr GetLink( const char * ToServiceParameterName ) ;
146
147     virtual bool IsGraph() ;
148     virtual bool IsComputing() ;
149     virtual bool IsFactory() ;
150     virtual bool IsInLine() ;
151     virtual bool IsGOTO() ;
152     virtual bool IsLoop() ;
153     virtual bool IsEndLoop() ;
154     virtual bool IsSwitch() ;
155     virtual bool IsEndSwitch() ;
156
157     virtual long SubGraph() ;
158
159     virtual bool IsLinked(const char * ToServiceParameterName ) ;
160     virtual bool HasInput(const char * ToServiceParameterName ) ;
161
162 //    virtual SUPERV::Link_ptr GetLink(const char * ToServiceParameterName ) ;
163 //    virtual SUPERV::Value_ptr GetValue(const char * FromServiceParameterName ) ;
164
165     virtual bool IsReady() ;
166     virtual bool IsWaiting() ;
167     virtual bool IsRunning() ;
168     virtual bool IsDone() ;
169     virtual bool IsSuspended() ;
170
171     virtual SUPERV::GraphState State() ;
172     virtual SUPERV::ControlState Control() ;
173     virtual void ControlClear() ;
174
175     virtual long Thread() ;
176
177     virtual SUPERV::AutomatonState AutoState() ;
178
179     virtual bool ReadyW() ;
180     virtual bool RunningW() ;
181     virtual bool DoneW() ;
182     virtual bool SuspendedW() ;
183
184     virtual void ping() ;
185     virtual bool ContainerKill() ;
186
187     virtual bool Kill() ;
188     virtual bool KillDone() ;
189     virtual bool Stop() ;
190     virtual bool Suspend() ;
191     virtual bool SuspendDone() ;
192     virtual bool Resume() ;
193
194     virtual bool Run() ;
195     virtual bool ReRun() ;
196     virtual bool ReRunAt( const char * aNodeName ) ;
197     virtual bool ReStart() ;
198     virtual bool ReStartAt( const char * aNodeName ) ;
199
200     virtual long CpuUsed() ;
201
202 } ;
203
204 #endif