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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : Graph_Impl.hxx
25 // Author : Jean Rahuel
29 #ifndef _GRAPH_IMPL_HXX_
30 #define _GRAPH_IMPL_HXX_
32 //#include <iostream.h>
36 #include <SALOMEconfig.h>
37 #include "SALOME_Component_i.hxx"
38 #include "SALOME_LifeCycleCORBA.hxx"
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"
48 #include "DataFlowEditor_DataFlow.hxx"
49 #include "DataFlowExecutor_DataFlow.hxx"
51 class Graph_Impl : public POA_SUPERV::Graph ,
56 PortableServer::POA_ptr _Poa ;
57 PortableServer::ObjectId * _ContId ;
59 SALOME_NamingService * _NamingService ;
60 char * _DebugFileName ;
62 pthread_mutex_t _MutexExecutorWait ;
63 // GraphExecutor::DataFlow * _DataFlowExecutor ;
65 SUPERV::Graph_var myServant; // mpv 23.12.2002: store servant of graph to get constant IOR
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 virtual SUPERV::Graph_ptr Copy() ;
85 virtual ~Graph_Impl() ;
86 virtual void destroy() ;
88 void DebugFileName( char * aDebugFileName ) {
89 _DebugFileName = my_strdup( aDebugFileName ) ; } ;
90 char * DebugFileName() {
91 return _DebugFileName ; } ;
93 virtual char* getIOR();
95 virtual void ReadOnly() ;
97 virtual SUPERV::INode_ptr Node() ;
99 // virtual char * DataFlowInfo() ;
100 // virtual char * DataNodeInfo() ;
101 // virtual char * NodeInfo( const char * aNodeName ) ;
103 virtual GraphBase::ListOfSGraphs * GetGraphs() ;
105 virtual bool LoadGraphs( GraphBase::ListOfSGraphs *aListOfGraphs ) ;
106 virtual bool Import(const char * aXmlFile ) ;
108 virtual bool Export(const char * aXmlFile ) ;
110 virtual SUPERV::CNode_ptr CNode(
111 const SALOME_ModuleCatalog::Service &NodeService ) ;
112 virtual SUPERV::FNode_ptr FNode(
113 const char * NodeComponentName ,
114 const char * InterfaceName ,
115 const SALOME_ModuleCatalog::Service &NodeService ) ;
116 virtual SUPERV::INode_ptr INode(
117 const char * FuncName ,
118 const SUPERV::ListOfStrings & PythonFunction ) ;
119 virtual SUPERV::GNode_ptr GNode(
120 const char * FuncName ,
121 const SUPERV::ListOfStrings & PythonFunction ,
122 const char * anInLineNode ) ;
123 virtual SUPERV::LNode_ptr LNode(
124 const char * InitName ,
125 const SUPERV::ListOfStrings & InitFunction ,
126 const char * MoreName ,
127 const SUPERV::ListOfStrings & MoreFunction ,
128 const char * NextName ,
129 const SUPERV::ListOfStrings & NextFunction ,
130 SUPERV::INode_out anEndOfLoop ) ;
131 virtual SUPERV::SNode_ptr SNode(
132 const char * FuncName ,
133 const SUPERV::ListOfStrings & PythonFunction ,
134 SUPERV::INode_out anEndOfSwitch ) ;
136 SUPERV::Graph_var LoadDataFlows( GraphEditor::DataFlow * aDataFlowEditor ,
137 GraphBase::ListOfSGraphs * aListOfDataFlows ,
139 SUPERV::Graph_var LoadDataFlows( GraphExecutor::DataFlow * aDataFlowExecutor ,
140 GraphBase::ListOfSGraphs * aListOfDataFlows ,
142 virtual SUPERV::Graph_ptr MNode( const char * aXmlFileName ) ;
144 virtual SUPERV::Graph_ptr MNode( GraphEditor::DataFlow * aDataFlowEditor ,
145 GraphBase::ListOfSGraphs * aListOfDataFlows ) ;
147 virtual SUPERV::Graph_ptr GraphMNode( SUPERV::Graph_ptr aGraph ) ;
149 virtual SUPERV::Graph_ptr FlowObjRef() ;
151 virtual SUPERV::StreamGraph_ptr StreamObjRef() ;
153 virtual SUPERV::CNode_ptr Node( const char * NodeName );
155 virtual SUPERV::Link_ptr Link( SUPERV::Port_ptr OutPort ,
156 SUPERV::Port_ptr InPort ) ;
158 virtual SUPERV::ListOfNodes_var Graph_Impl::SetNode( SUPERV::ListOfNodes_var RetVal ,
159 GraphBase::ComputingNode * aNode ) ;
160 virtual SUPERV::ListOfNodes * Nodes() ;
161 virtual void SetNodeObjRef( GraphEditor::InNode * anInNode ) ;
163 virtual SUPERV::ListOfLinks * GLinks() ;
164 virtual SUPERV::ListOfLinks * Links( GraphBase::ComputingNode * aNode ,
165 const char * anInputParam ) ;
167 virtual Engines::Component_ptr ComponentRef( const char * aComputerContainer ,
168 const char * aComponentName ) ;
170 virtual bool IsValid() ;
171 virtual bool IsExecutable() ;
173 virtual bool IsEditing() ;
174 virtual bool IsExecuting() ;
176 virtual bool IsReadOnly() ;
178 virtual long LevelMax() ;
179 virtual SUPERV::ListOfNodes * LevelNodes(long aLevel ) ;
180 virtual long ThreadsMax() ;
181 virtual long Threads() ;
182 virtual long SuspendedThreads() ;
184 virtual bool Run() ; // called on "Execute Graph" command
185 virtual bool Start() ; // called on "Execute Graph Step-by-Step" command
187 virtual bool Begin() ;
188 virtual long LastLevelDone() ;
190 virtual bool EventNoW( SUPERV::CNode_out aNode ,
191 SUPERV::GraphEvent & anEvent ,
192 SUPERV::GraphState & aState ) ;
193 virtual bool Event( SUPERV::CNode_out aNode ,
194 SUPERV::GraphEvent & anEvent ,
195 SUPERV::GraphState & aState ) ;
196 virtual bool EventW( SUPERV::CNode_out aNode ,
197 SUPERV::GraphEvent & anEvent ,
198 SUPERV::GraphState & aState ) ;
199 virtual long EventQSize() ;
201 virtual long SubGraphsNumber() ;
202 virtual SUPERV::ListOfNodes * SubGraphsNodes( const long aSubGraphNumber ) ;
204 virtual bool Merge(const SUPERV::Graph_ptr aGraph ) ;
205 virtual bool Merge(const SUPERV::Graph_ptr aGraph , map< string , int > & aMapOfNodes ) ;
207 virtual SUPERV::StreamGraph_ptr ToStreamGraph() ;
209 virtual void Editing(); // Destroy Executor and use only Editor and its data model
212 bool run( const bool andSuspend = false ); // Run() calls run( false ), Start() calls run( true );