1 // SUPERV Supervision : contains the implementation of interfaces of SuperVision described in SUPERV.idl
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // File : CNode_Impl.hxx
23 // Author : Jean Rahuel
26 #ifndef _CNODE_IMPL_HXX_
27 #define _CNODE_IMPL_HXX_
33 #include <SALOMEconfig.h>
34 #include "SALOME_Component_i.hxx"
35 #include "SALOME_LifeCycleCORBA.hxx"
37 #include "DataFlowEditor_DataFlow.hxx"
38 #include "DataFlowExecutor_DataFlow.hxx"
40 class CNode_Impl : public POA_SUPERV::CNode ,
41 public Engines_Component_i {
45 PortableServer::POA_ptr _Poa ;
46 PortableServer::ObjectId * _ContId ;
48 GraphEditor::DataFlow * _DataFlowEditor ;
49 GraphEditor::InNode * _DataFlowNode ;
54 CNode_Impl( CORBA::ORB_ptr orb ,
55 PortableServer::POA_ptr poa ,
56 PortableServer::ObjectId * contId ,
57 const char *instanceName ,
58 const char *interfaceName ,
59 const char *aDataFlowName ,
60 const SUPERV::KindOfNode aKindOfNode ) ;
61 CNode_Impl( CORBA::ORB_ptr orb ,
62 PortableServer::POA_ptr poa ,
63 PortableServer::ObjectId * contId ,
64 const char *instanceName ,
65 const char *interfaceName ,
66 GraphEditor::DataFlow * DataFlowEditor ,
67 const SALOME_ModuleCatalog::Service &NodeService ,
68 const char * NodeName = NULLSTRING ,
69 const SUPERV::KindOfNode NodeKindOfNode = SUPERV::ComputingNode ,
70 const char * aFuncName = NULLSTRING ,
71 const SUPERV::ListOfStrings & aPythonFunction = SUPERV::ListOfStrings() ,
72 bool isCimpl = true ) ; // mkr : PAL11273 : C++ implementation by default
73 CNode_Impl( CORBA::ORB_ptr orb ,
74 PortableServer::POA_ptr poa ,
75 PortableServer::ObjectId * contId ,
76 const char *instanceName ,
77 const char *interfaceName ,
78 GraphEditor::DataFlow * DataFlowEditor ,
79 const SALOME_ModuleCatalog::Service &NodeService ,
80 const char * NodeName = NULLSTRING ,
81 const SUPERV::KindOfNode NodeKindOfNode = SUPERV::InLineNode ,
82 const GraphBase::ListOfFuncName & aFuncName = GraphBase::ListOfFuncName() ,
83 const GraphBase::ListOfPythonFunctions & aPythonFunction = GraphBase::ListOfPythonFunctions() ) ;
84 CNode_Impl( CORBA::ORB_ptr orb ,
85 PortableServer::POA_ptr poa ,
86 PortableServer::ObjectId * contId ,
87 const char *instanceName ,
88 const char *interfaceName ,
89 GraphEditor::DataFlow * DataFlowEditor ,
90 GraphEditor::InNode * DataFlowNode ) ;
91 virtual ~CNode_Impl() ;
92 virtual void destroy() ;
93 virtual bool Delete() ;
97 virtual void DataFlowEditor( GraphEditor::DataFlow * DataFlowEditor ) {
98 _DataFlowEditor = DataFlowEditor ; } ;
99 virtual GraphEditor::DataFlow * DataFlowEditor() {
100 return _DataFlowEditor ; } ;
102 virtual GraphExecutor::DataFlow * DataFlowExecutor() {
103 return DataFlowEditor()->Executor(); } ;
105 virtual void DataFlowNode( GraphEditor::InNode * DataFlowNode ) {
106 _DataFlowNode = DataFlowNode ; } ;
107 virtual GraphEditor::InNode * DataFlowNode() {
108 return _DataFlowNode ; } ;
110 virtual char * Name() ;
111 virtual bool SetName( const char * aDataFlowName ) ;
112 virtual SALOME_ModuleCatalog::Service * Service() ;
113 virtual SUPERV::KindOfNode Kind() ;
114 virtual SUPERV::SDate CreationDate() ;
115 virtual SUPERV::SDate LastUpdateDate() ;
116 virtual char * Version() ;
117 virtual char * Author() ;
118 virtual bool SetAuthor( const char * aDataFlowAuthor ) ;
119 virtual char * Comment() ;
120 virtual bool SetComment( const char * aDataFlowComment ) ;
122 virtual GraphEditor::InNode * DataFlowNode() const {
123 return _DataFlowNode ; } ;
124 virtual GraphBase::ComputingNode * BaseNode() {
125 return DataFlowNode()->ComputingNode() ; } ;
127 virtual SUPERV::CNode_var ObjRef() {
128 SUPERV::CNode_var iobject = SUPERV::GNode::_nil() ;
129 if ( DataFlowNode() && _IsNode ) {
130 iobject = SUPERV::CNode::_narrow( DataFlowNode()->ObjRef() ) ;
133 iobject = SUPERV::CNode::_narrow( DataFlowEditor()->Graph()->ObjRef() ) ;
136 virtual void SetObjRef(SUPERV::CNode_var aNode ) {
137 if ( DataFlowNode() && _IsNode ) {
138 DataFlowNode()->SetObjRef( aNode ) ;
141 if ( DataFlowEditor() ) {
142 DataFlowEditor()->Graph()->SetObjRef( SUPERV::Graph::_narrow( aNode ) ) ;
144 if ( DataFlowExecutor() ) {
145 DataFlowExecutor()->Graph()->SetObjRef( SUPERV::Graph::_narrow( aNode ) ) ;
151 virtual CNode_Impl * ObjImpl() {
152 CNode_Impl * objimpl = NULL ;
153 if ( DataFlowNode() && _IsNode ) {
154 objimpl = DataFlowNode()->ObjImpl() ;
157 objimpl = DataFlowEditor()->Graph()->ObjImpl() ;
160 virtual void SetObjImpl( CNode_Impl * objimpl ) {
161 if ( DataFlowNode() && _IsNode ) {
162 DataFlowNode()->SetObjImpl( objimpl ) ;
165 if ( DataFlowEditor() ) {
166 DataFlowEditor()->Graph()->SetObjImpl( objimpl ) ;
168 if ( DataFlowExecutor() ) {
169 DataFlowExecutor()->Graph()->SetObjImpl( objimpl ) ;
175 virtual void Coords( CORBA::Long X , CORBA::Long Y ) ;
176 virtual CORBA::Long X() ;
177 virtual CORBA::Long Y() ;
179 virtual SUPERV::Port_ptr Port( const char * aParameterName ) ;
181 // virtual bool BusPorts( const char * InputParameterName ,
182 // const char * InputParameterType ,
183 // const char * OutputParameterName ,
184 // const char * OutputParameterType ,
185 // SUPERV::Port_out InputPort ,
186 // SUPERV::Port_out OutputPort ) ;
188 // virtual SUPERV::Link_ptr Link( const char * ToServiceParameterName ,
189 // const SUPERV::Value_ptr aValue ) ;
191 virtual SUPERV::Port_ptr Input( const char * ToServiceParameterName ,
192 const SUPERV::Value_ptr aValue ) ;
193 // virtual bool InputOfAny( const char * ToServiceParameterName ,
194 // const CORBA::Any & aValue ) ;
196 virtual SUPERV::Port_ptr GetInPort( const char * aParameterName ) ;
197 virtual SUPERV::Port_ptr GetOutPort( const char * aParameterName ) ;
199 virtual SUPERV::StreamPort_ptr GetInStreamPort( const char * aParameterName ) ;
200 virtual SUPERV::StreamPort_ptr GetOutStreamPort( const char * aParameterName ) ;
202 virtual SUPERV::ListOfPorts * Ports() ;
203 virtual SUPERV::ListOfStreamPorts * StreamPorts() ;
205 virtual bool HasStreamPort() ;
207 virtual SUPERV::ListOfLinks * Links() ;
208 virtual SUPERV::ListOfStreamLinks * StreamLinks() ;
210 virtual SUPERV::Link_ptr GetLink( const char * ToServiceParameterName ) ;
211 virtual SUPERV::StreamLink_ptr GetStreamLink( const char * ToServiceParameterName ) ;
213 virtual bool IsStreamGraph() ;
214 virtual bool IsGraph() ;
215 virtual bool IsMacro() ;
216 virtual bool IsFlowMacro() ;
217 virtual bool IsStreamMacro() ;
218 virtual bool IsHeadGraph() ;
219 virtual CORBA::Long GraphLevel() ;
220 virtual bool IsComputing() ;
221 virtual bool IsFactory() ;
222 virtual bool IsInLine() ;
223 virtual bool IsGOTO() ;
224 virtual bool IsLoop() ;
225 virtual bool IsEndLoop() ;
226 virtual bool IsSwitch() ;
227 virtual bool IsEndSwitch() ;
229 virtual CORBA::Long SubGraph() ;
230 virtual CORBA::Long SubStreamGraph() ;
232 // mkr : PAL8060 : this method is not used
233 //virtual bool IsLinked(const char * ToServiceParameterName ) ;
234 virtual bool HasInput(const char * ToServiceParameterName ) ;
236 // virtual SUPERV::Link_ptr GetLink(const char * ToServiceParameterName ) ;
237 // virtual SUPERV::Value_ptr GetValue(const char * FromServiceParameterName ) ;
239 virtual bool IsReady() ;
240 virtual bool IsWaiting() ;
241 virtual bool IsRunning() ;
242 virtual bool IsDone() ;
243 virtual bool IsSuspended() ;
245 virtual SUPERV::GraphState State() ;
246 virtual SUPERV::ControlState Control() ;
247 virtual void ControlClear() ;
249 virtual CORBA::Long Thread() ;
251 GraphExecutor::AutomatonState AutoState() ;
253 virtual bool ReadyW() ;
254 virtual bool RunningW() ;
255 virtual bool DoneW() ;
256 virtual bool SuspendedW() ;
258 virtual void ping() ;
259 virtual bool ContainerKill() ;
261 virtual bool Kill() ;
262 virtual bool KillDone() ;
263 virtual bool Stop() ;
264 virtual bool Suspend() ;
265 virtual bool SuspendDone() ;
266 virtual bool Resume() ;
268 virtual CORBA::Long CpuUsed() ;
270 virtual CORBA::Boolean IsExecuting();