Salome HOME
DCQ : Merge with Ecole_Ete_a6.
[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 INode_Impl ,
52                   public POA_SUPERV::Graph {
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     virtual SUPERV::Graph_ptr Copy() ;
77
78     virtual ~Graph_Impl() ;
79     virtual void destroy() ;
80
81     virtual char* getIOR();
82
83     virtual void ReadOnly() ;
84
85     virtual SUPERV::INode_ptr Node() ;
86
87 //    virtual char * DataFlowInfo() ;
88 //    virtual char * DataNodeInfo() ;
89 //    virtual char * NodeInfo( const char * aNodeName ) ;
90
91     virtual GraphBase::SGraph * GetGraph() ;
92
93     virtual bool LoadGraph(const GraphBase::SGraph *aGraph ) ;
94     virtual bool Import(const char * aXmlFile ) ;
95
96     virtual bool Export(const char * aXmlFile ) ;
97
98     virtual SUPERV::CNode_ptr CNode(
99                           const SALOME_ModuleCatalog::Service &NodeService ) ;
100     virtual SUPERV::FNode_ptr FNode(
101                           const char * NodeComponentName ,
102                           const char * InterfaceName ,
103                           const SALOME_ModuleCatalog::Service &NodeService ) ;
104     virtual SUPERV::INode_ptr INode(
105                           const char * FuncName ,
106                           const SUPERV::ListOfStrings & PythonFunction ) ;
107     virtual SUPERV::GNode_ptr GNode(
108                           const char * FuncName ,
109                           const SUPERV::ListOfStrings & PythonFunction ,
110                           const char * anInLineNode ) ;
111     virtual SUPERV::LNode_ptr LNode(
112                           const char * InitName ,
113                           const SUPERV::ListOfStrings & InitFunction ,
114                           const char * MoreName ,
115                           const SUPERV::ListOfStrings & MoreFunction ,
116                           const char * NextName ,
117                           const SUPERV::ListOfStrings & NextFunction ,
118                           SUPERV::INode_out anEndOfLoop ) ;
119     virtual SUPERV::SNode_ptr SNode(
120                           const char * FuncName ,
121                           const SUPERV::ListOfStrings & PythonFunction ,
122                           SUPERV::INode_out anEndOfSwitch ) ;
123
124     virtual SUPERV::CNode_ptr Node( const char * NodeName );
125
126     virtual SUPERV::Link_ptr Link( SUPERV::Port_ptr OutPort ,
127                                    SUPERV::Port_ptr InPort ) ;
128
129     virtual SUPERV::ListOfNodes_var Graph_Impl::SetNode( SUPERV::ListOfNodes_var RetVal ,
130                                       GraphBase::ComputingNode * aNode ) ;
131     virtual SUPERV::ListOfNodes * Nodes() ;
132     virtual void SetNodeObjRef( GraphEditor::InNode * anInNode ) ;
133
134     virtual SUPERV::ListOfLinks * GLinks() ;
135     virtual SUPERV::ListOfLinks * Links( GraphBase::ComputingNode * aNode ,
136                                          const char * anInputParam ) ;
137
138     virtual Engines::Component_ptr ComponentRef( const char * aComputerContainer ,
139                                                  const char * aComponentName ) ;
140
141     virtual bool IsValid() ;
142     virtual bool IsExecutable() ;
143
144     virtual bool IsEditing() ;
145     virtual bool IsExecuting() ;
146
147     virtual bool IsReadOnly() ;
148
149     virtual long LevelMax() ;
150     virtual SUPERV::ListOfNodes * LevelNodes(long aLevel ) ;
151     virtual long ThreadsMax() ;
152     virtual long Threads() ;
153     virtual long SuspendedThreads() ;
154
155     virtual bool Begin() ;
156     virtual bool Run() ;
157     virtual bool Start() ;
158     virtual long LastLevelDone() ;
159
160     virtual bool EventNoW( SUPERV::CNode_out aNode ,
161                            SUPERV::GraphEvent & anEvent ,
162                            SUPERV::GraphState & aState ) ;
163     virtual bool Event( SUPERV::CNode_out aNode ,
164                         SUPERV::GraphEvent & anEvent ,
165                         SUPERV::GraphState & aState ) ;
166     virtual bool EventW( SUPERV::CNode_out aNode ,
167                          SUPERV::GraphEvent & anEvent ,
168                          SUPERV::GraphState & aState ) ;
169     virtual long EventQSize() ;
170
171     virtual long SubGraphsNumber() ;
172     virtual SUPERV::ListOfNodes * SubGraphsNodes( const long aSubGraphNumber ) ;
173
174     virtual bool Merge(const SUPERV::Graph_ptr aGraph ) ;
175     virtual bool Merge(const SUPERV::Graph_ptr aGraph , map< string , int > & aMapOfNodes ) ;
176
177     virtual SUPERV::StreamGraph_ptr ToStreamGraph() ;
178
179 };
180
181
182 #endif