Salome HOME
DCQ:prepare 2.0.0
[modules/superv.git] / src / Supervision / Graph_Impl.hxx
1 //  SUPERV Supervision : contains the implementation of interfaces of SuperVision described in SUPERV.idl
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
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. 
10 // 
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. 
15 // 
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 
19 // 
20 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : Graph_Impl.hxx
25 //  Author : Jean Rahuel
26 //  Module : SUPERV
27 //  $Header: 
28
29 #ifndef _GRAPH_IMPL_HXX_
30 #define _GRAPH_IMPL_HXX_
31
32 //#include <iostream.h>
33
34 #include "CORBA.h"
35
36 #include <SALOMEconfig.h>
37 #include "SALOME_Component_i.hxx"
38 #include "SALOME_LifeCycleCORBA.hxx"
39
40 #include "StreamLink_Impl.hxx"
41 #include "FNode_Impl.hxx"
42 #include "GNode_Impl.hxx"
43 #include "LNode_Impl.hxx"
44 #include "ELNode_Impl.hxx"
45 #include "SNode_Impl.hxx"
46 #include "ESNode_Impl.hxx"
47
48 #include "DataFlowEditor_DataFlow.hxx"
49 #include "DataFlowExecutor_DataFlow.hxx"
50
51 class Graph_Impl : public POA_SUPERV::Graph ,
52                    public GNode_Impl {
53   private:
54
55     CORBA::ORB_ptr             _Orb ;
56     PortableServer::POA_ptr    _Poa ;
57     PortableServer::ObjectId * _ContId ;
58
59     SALOME_NamingService *     _NamingService ;
60     char * _DebugFileName ;
61
62     pthread_mutex_t            _MutexExecutorWait ;
63 //    GraphExecutor::DataFlow *  _DataFlowExecutor ;
64
65     SUPERV::Graph_var          myServant; // mpv 23.12.2002: store servant of graph to get constant IOR
66
67   public:
68     Graph_Impl();
69     Graph_Impl( CORBA::ORB_ptr orb ,
70                 PortableServer::POA_ptr poa ,
71                 PortableServer::ObjectId * contId , 
72                 const char *instanceName ,
73                 const char *interfaceName ,
74                 const char *aDataFlowName ,
75                 const SUPERV::KindOfNode aKindOfNode ) ;
76     Graph_Impl( CORBA::ORB_ptr orb ,
77                 PortableServer::POA_ptr poa ,
78                 PortableServer::ObjectId * contId , 
79                 const char *instanceName ,
80                 const char *interfaceName ,
81                 GraphEditor::DataFlow * DataFlowEditor ,
82                 GraphEditor::InNode * DataFlowNode ) ;
83     Graph_Impl( CORBA::ORB_ptr orb ,
84                 PortableServer::POA_ptr poa ,
85                 PortableServer::ObjectId * contId , 
86                 const char *instanceName ,
87                 const char *interfaceName ,
88                 GraphExecutor::DataFlow * DataFlowExecutor ,
89                 GraphExecutor::InNode * DataFlowExecutorNode ) ;
90     virtual SUPERV::Graph_ptr Copy() ;
91
92     virtual ~Graph_Impl() ;
93     virtual void destroy() ;
94
95     void DebugFileName( char * aDebugFileName ) {
96          _DebugFileName = my_strdup( aDebugFileName ) ; } ;
97     char * DebugFileName() {
98            return _DebugFileName ; } ;
99
100     virtual char* getIOR();
101
102     virtual void ReadOnly() ;
103
104     virtual SUPERV::INode_ptr Node() ;
105
106 //    virtual char * DataFlowInfo() ;
107 //    virtual char * DataNodeInfo() ;
108 //    virtual char * NodeInfo( const char * aNodeName ) ;
109
110     virtual GraphBase::ListOfSGraphs * GetGraphs() ;
111
112     virtual bool LoadGraphs( GraphBase::ListOfSGraphs *aListOfGraphs ) ;
113     virtual bool Import(const char * aXmlFile ) ;
114
115     virtual bool Export(const char * aXmlFile ) ;
116
117     virtual SUPERV::CNode_ptr CNode(
118                           const SALOME_ModuleCatalog::Service &NodeService ) ;
119     virtual SUPERV::FNode_ptr FNode(
120                           const char * NodeComponentName ,
121                           const char * InterfaceName ,
122                           const SALOME_ModuleCatalog::Service &NodeService ) ;
123     virtual SUPERV::INode_ptr INode(
124                           const char * FuncName ,
125                           const SUPERV::ListOfStrings & PythonFunction ) ;
126     virtual SUPERV::GNode_ptr GNode(
127                           const char * FuncName ,
128                           const SUPERV::ListOfStrings & PythonFunction ,
129                           const char * anInLineNode ) ;
130     virtual SUPERV::LNode_ptr LNode(
131                           const char * InitName ,
132                           const SUPERV::ListOfStrings & InitFunction ,
133                           const char * MoreName ,
134                           const SUPERV::ListOfStrings & MoreFunction ,
135                           const char * NextName ,
136                           const SUPERV::ListOfStrings & NextFunction ,
137                           SUPERV::INode_out anEndOfLoop ) ;
138     virtual SUPERV::SNode_ptr SNode(
139                           const char * FuncName ,
140                           const SUPERV::ListOfStrings & PythonFunction ,
141                           SUPERV::INode_out anEndOfSwitch ) ;
142
143     bool LoadDataFlows( GraphEditor::DataFlow * aDataFlowEditor ,
144                         GraphBase::ListOfSGraphs * aListOfDataFlows ,
145                         int index ) ;
146     bool LoadDataFlows( GraphExecutor::DataFlow * aDataFlowExecutor ,
147                         GraphBase::ListOfSGraphs * aListOfDataFlows ,
148                         int index ) ;
149     virtual SUPERV::Graph_ptr MNode( const char * aXmlFileName ) ;
150
151     virtual SUPERV::Graph_ptr MNode( GraphEditor::DataFlow * aDataFlowEditor ,
152                                      GraphBase::ListOfSGraphs aListOfDataFlows ) ;
153
154     virtual SUPERV::Graph_ptr GraphMNode( SUPERV::Graph_ptr aGraph ) ;
155
156     virtual SUPERV::Graph_ptr FlowObjRef() ;
157
158     virtual SUPERV::StreamGraph_ptr StreamObjRef() ;
159
160     virtual SUPERV::CNode_ptr Node( const char * NodeName );
161
162     virtual SUPERV::Link_ptr Link( SUPERV::Port_ptr OutPort ,
163                                    SUPERV::Port_ptr InPort ) ;
164
165     virtual SUPERV::ListOfNodes_var Graph_Impl::SetNode( SUPERV::ListOfNodes_var RetVal ,
166                                                          GraphBase::ComputingNode * aNode ) ;
167     virtual SUPERV::ListOfNodes * Nodes() ;
168     virtual void SetNodeObjRef( GraphEditor::InNode * anInNode ) ;
169
170     virtual SUPERV::ListOfLinks * GLinks() ;
171     virtual SUPERV::ListOfLinks * Links( GraphBase::ComputingNode * aNode ,
172                                          const char * anInputParam ) ;
173
174     virtual Engines::Component_ptr ComponentRef( const char * aComputerContainer ,
175                                                  const char * aComponentName ) ;
176
177     virtual bool IsValid() ;
178     virtual bool IsExecutable() ;
179
180     virtual bool IsEditing() ;
181     virtual bool IsExecuting() ;
182
183     virtual bool IsReadOnly() ;
184
185     virtual long LevelMax() ;
186     virtual SUPERV::ListOfNodes * LevelNodes(long aLevel ) ;
187     virtual long ThreadsMax() ;
188     virtual long Threads() ;
189     virtual long SuspendedThreads() ;
190
191     virtual bool Begin() ;
192     virtual bool Run() ;
193     virtual bool Start() ;
194     virtual long LastLevelDone() ;
195
196     virtual bool EventNoW( SUPERV::CNode_out aNode ,
197                            SUPERV::GraphEvent & anEvent ,
198                            SUPERV::GraphState & aState ) ;
199     virtual bool Event( SUPERV::CNode_out aNode ,
200                         SUPERV::GraphEvent & anEvent ,
201                         SUPERV::GraphState & aState ) ;
202     virtual bool EventW( SUPERV::CNode_out aNode ,
203                          SUPERV::GraphEvent & anEvent ,
204                          SUPERV::GraphState & aState ) ;
205     virtual long EventQSize() ;
206
207     virtual long SubGraphsNumber() ;
208     virtual SUPERV::ListOfNodes * SubGraphsNodes( const long aSubGraphNumber ) ;
209
210     virtual bool Merge(const SUPERV::Graph_ptr aGraph ) ;
211     virtual bool Merge(const SUPERV::Graph_ptr aGraph , map< string , int > & aMapOfNodes ) ;
212
213     virtual SUPERV::StreamGraph_ptr ToStreamGraph() ;
214
215 };
216
217
218 #endif