]> SALOME platform Git repositories - modules/superv.git/blob - src/Supervision/GNode_Impl.hxx
Salome HOME
d645622b5f8d0ee593441e705b0e91a10e0d9caf
[modules/superv.git] / src / Supervision / GNode_Impl.hxx
1 //=============================================================================
2 // File      : GNode_Impl.hxx
3 // Created   : 2003
4 // Author    : Jean Rahuel
5 // Project   : SALOME
6 // Copyright : CEA 2003
7 // $Header: 
8 //=============================================================================
9
10 #ifndef _GNODE_IMPL_HXX_
11 #define _GNODE_IMPL_HXX_
12
13 #include <iostream.h>
14
15 #include "CORBA.h"
16
17 #include <SALOMEconfig.h>
18 #include "SALOME_Component_i.hxx"
19 #include "SALOME_LifeCycleCORBA.hxx"
20
21 #include "INode_Impl.hxx"
22 #include "Port_Impl.hxx"
23
24 #include "DataFlowEditor_DataFlow.hxx"
25 #include "DataFlowExecutor_DataFlow.hxx"
26
27 class GNode_Impl : public INode_Impl ,
28                    public POA_SUPERV::GNode {
29   private:
30
31     CORBA::ORB_ptr             _Orb ;
32     PortableServer::POA_ptr    _Poa ;
33     PortableServer::ObjectId * _ContId ;
34
35   public:
36     GNode_Impl();
37     GNode_Impl( CORBA::ORB_ptr orb ,
38                 PortableServer::POA_ptr poa ,
39                 PortableServer::ObjectId * contId , 
40                 const char *instanceName ,
41                 const char *interfaceName ,
42                 GraphEditor::DataFlow * DataFlowEditor ,
43                 const char * FuncName , 
44                 const SUPERV::ListOfStrings & PythonFunction ,
45                 const SUPERV::KindOfNode NodeKindOfNode = SUPERV::GOTONode ) ;
46     GNode_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                 GraphBase::ListOfFuncName FuncNameList , 
53                 GraphBase::ListOfPythonFunctions PythonFunctionList ,
54                 const SUPERV::KindOfNode NodeKindOfNode = SUPERV::GOTONode ) ;
55     GNode_Impl( CORBA::ORB_ptr orb ,
56                 PortableServer::POA_ptr poa ,
57                 PortableServer::ObjectId * contId , 
58                 const char *instanceName ,
59                 const char *interfaceName ,
60                 GraphEditor::DataFlow * DataFlowEditor ,
61                 GraphEditor::InNode * DataFlowNode ) ;
62     virtual ~GNode_Impl() ;
63     virtual void destroy() ;
64     virtual bool Delete() ;
65
66     virtual bool SetCoupled( const char * anInLineNode ) {
67             GraphBase::InLineNode * CoupledINode = (GraphBase::InLineNode * ) DataFlowEditor()->GetGraphNode( anInLineNode ) ;
68             cout << Name() << ".SetCoupled " << anInLineNode << endl ;
69             if ( CoupledINode && ( IsGOTO() &&
70                    ( CoupledINode->IsInLineNode() || CoupledINode->IsLoopNode() ||
71                      CoupledINode->IsSwitchNode() ) ) ||
72                  ( !IsGOTO() && ( IsLoop() || IsSwitch() ||
73                                   IsEndLoop() || IsEndSwitch() ) ) ) {
74               DataFlowNode()->CoupledNode( CoupledINode ) ;
75               if ( IsSwitch() ) {
76                 DataFlowEditor()->AddLink( Name() , "Default" ,
77                                            CoupledINode->Name() , "Default" ) ;
78               }
79               else if ( IsLoop() || IsEndLoop() ) {
80                 DataFlowEditor()->AddLink( Name() , "DoLoop" ,
81                                            CoupledINode->Name() , "DoLoop" ) ;
82               }
83               else if ( IsGOTO() ) {
84                 DataFlowEditor()->AddLink( Name() , "OutGate" ,
85                                            CoupledINode->Name() , "InGate" ) ;
86               }
87               cout << "SetCoupled " << CoupledINode->Name() << endl ;
88               return  true ;
89             }
90             cout << Name() << ".SetCoupled ERROR " << anInLineNode << " " << CoupledINode
91                  << " of " << Kind() ;
92             if ( CoupledINode ) {
93               cout << " kinfOkCoupled " << CoupledINode->Kind() ;
94             }
95             cout << endl ;
96             return false ; } ;
97     virtual SUPERV::INode_ptr Coupled() ;
98
99     virtual GraphBase::GOTONode * BaseNode() {
100             return DataFlowNode()->GOTONode() ; } ;
101
102 } ;
103
104 #endif