Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[modules/superv.git] / src / Supervision / Graph_Impl.hxx
index 090df65c38c557717c72bd8efab3309c841ece0b..1be15cd64afe738acfcc552bce33067b13f56b28 100644 (file)
@@ -17,7 +17,7 @@
 //  License along with this library; if not, write to the Free Software 
 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
 // 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 //
 //
@@ -29,7 +29,7 @@
 #ifndef _GRAPH_IMPL_HXX_
 #define _GRAPH_IMPL_HXX_
 
-#include <iostream.h>
+//#include <iostream.h>
 
 #include "CORBA.h"
 
@@ -37,7 +37,7 @@
 #include "SALOME_Component_i.hxx"
 #include "SALOME_LifeCycleCORBA.hxx"
 
-#include "Link_Impl.hxx"
+#include "StreamLink_Impl.hxx"
 #include "FNode_Impl.hxx"
 #include "GNode_Impl.hxx"
 #include "LNode_Impl.hxx"
@@ -48,8 +48,8 @@
 #include "DataFlowEditor_DataFlow.hxx"
 #include "DataFlowExecutor_DataFlow.hxx"
 
-class Graph_Impl :public INode_Impl ,
-                  public POA_SUPERV::Graph {
+class Graph_Impl : public POA_SUPERV::Graph ,
+                   public GNode_Impl {
   private:
 
     CORBA::ORB_ptr             _Orb ;
@@ -59,9 +59,9 @@ class Graph_Impl :public INode_Impl ,
     SALOME_NamingService *     _NamingService ;
     char * _DebugFileName ;
 
-    GraphExecutor::DataFlow *  _DataFlowExecutor ;
+    pthread_mutex_t            _MutexExecutorWait ;
+//    GraphExecutor::DataFlow *  _DataFlowExecutor ;
 
-    int                        _ExecNumber ;
     SUPERV::Graph_var          myServant; // mpv 23.12.2002: store servant of graph to get constant IOR
 
   public:
@@ -71,41 +71,51 @@ class Graph_Impl :public INode_Impl ,
                PortableServer::ObjectId * contId , 
                const char *instanceName ,
                 const char *interfaceName ,
-                const char *aDataFlowName ) ;
+                const char *aDataFlowName ,
+                const SUPERV::KindOfNode aKindOfNode ) ;
+    Graph_Impl( CORBA::ORB_ptr orb ,
+               PortableServer::POA_ptr poa ,
+               PortableServer::ObjectId * contId , 
+               const char *instanceName ,
+                const char *interfaceName ,
+                GraphEditor::DataFlow * DataFlowEditor ,
+                GraphEditor::InNode * DataFlowNode ) ;
     virtual SUPERV::Graph_ptr Copy() ;
 
     virtual ~Graph_Impl() ;
     virtual void destroy() ;
 
+    void DebugFileName( char * aDebugFileName ) {
+         _DebugFileName = my_strdup( aDebugFileName ) ; } ;
+    char * DebugFileName() {
+           return _DebugFileName ; } ;
+
     virtual char* getIOR();
 
     virtual void ReadOnly() ;
 
-    virtual SUPERV::INode_ptr GetNode() ;
+    virtual SUPERV::INode_ptr Node() ;
 
 //    virtual char * DataFlowInfo() ;
 //    virtual char * DataNodeInfo() ;
 //    virtual char * NodeInfo( const char * aNodeName ) ;
 
-    virtual GraphBase::SGraph * GetGraph() ;
+    virtual GraphBase::ListOfSGraphs * GetGraphs() ;
 
-    virtual bool LoadGraph(const GraphBase::SGraph *aGraph ) ;
+    virtual bool LoadGraphs( GraphBase::ListOfSGraphs *aListOfGraphs ) ;
     virtual bool Import(const char * aXmlFile ) ;
 
     virtual bool Export(const char * aXmlFile ) ;
 
-#if 0
-    virtual GraphBase::ListOfNodes * GetNodes() ;
-    virtual GraphBase::ListOfLinks * GetLinks() ;
-    virtual GraphBase::ListOfLinks * GetDatas() ;
-#endif
+    virtual char * SavePY( bool importSuperV ) ;
 
     virtual SUPERV::CNode_ptr CNode(
                           const SALOME_ModuleCatalog::Service &NodeService ) ;
     virtual SUPERV::FNode_ptr FNode(
                           const char * NodeComponentName ,
                           const char * InterfaceName ,
-                          const SALOME_ModuleCatalog::Service &NodeService ) ;
+                          const SALOME_ModuleCatalog::Service &NodeService ,
+                         const SALOME_ModuleCatalog::ImplType ImplType ) ; // mkr : PAL11273 : C++ implementation by default
     virtual SUPERV::INode_ptr INode(
                           const char * FuncName ,
                           const SUPERV::ListOfStrings & PythonFunction ) ;
@@ -126,42 +136,61 @@ class Graph_Impl :public INode_Impl ,
                           const SUPERV::ListOfStrings & PythonFunction ,
                           SUPERV::INode_out anEndOfSwitch ) ;
 
-    virtual SUPERV::CNode_ptr GetNode( const char * NodeName );
+    SUPERV::Graph_var LoadDataFlows( GraphEditor::DataFlow * aDataFlowEditor ,
+                                     GraphBase::ListOfSGraphs * aListOfDataFlows ,
+                                     int index ) ;
+    SUPERV::Graph_var LoadDataFlows( GraphExecutor::DataFlow * aDataFlowExecutor ,
+                                     GraphBase::ListOfSGraphs * aListOfDataFlows ,
+                                     int index ) ;
+    virtual SUPERV::Graph_ptr MNode( const char * aXmlFileName ) ;
+
+    virtual SUPERV::Graph_ptr MNode( GraphEditor::DataFlow * aDataFlowEditor ,
+                                     GraphBase::ListOfSGraphs * aListOfDataFlows ) ;
+
+    virtual SUPERV::Graph_ptr GraphMNode( SUPERV::Graph_ptr aGraph ) ;
+
+    virtual SUPERV::Graph_ptr FlowObjRef() ;
+
+    virtual SUPERV::StreamGraph_ptr StreamObjRef() ;
+
+    virtual SUPERV::CNode_ptr Node( const char * NodeName );
 
     virtual SUPERV::Link_ptr Link( SUPERV::Port_ptr OutPort ,
                                    SUPERV::Port_ptr InPort ) ;
 
-    virtual SUPERV::ListOfNodes_var Graph_Impl::SetNode( SUPERV::ListOfNodes_var RetVal ,
-                                      GraphBase::ComputingNode * aNode ) ;
+    virtual SUPERV::ListOfNodes_var SetNode( SUPERV::ListOfNodes_var RetVal ,
+                                                         GraphBase::ComputingNode * aNode ) ;
     virtual SUPERV::ListOfNodes * Nodes() ;
+    virtual void SetNodeObjRef( GraphEditor::InNode * anInNode ) ;
+
     virtual SUPERV::ListOfLinks * GLinks() ;
     virtual SUPERV::ListOfLinks * Links( GraphBase::ComputingNode * aNode ,
                                          const char * anInputParam ) ;
-    virtual SUPERV::ListOfGraphs * Graphs() ;
 
     virtual Engines::Component_ptr ComponentRef( const char * aComputerContainer ,
                                                  const char * aComponentName ) ;
 
+    virtual char * Messages() ;
+
     virtual bool IsValid() ;
     virtual bool IsExecutable() ;
-    virtual bool IsDataFlow() ;
 
     virtual bool IsEditing() ;
-    virtual bool IsExecuting() ;
+    virtual CORBA::Boolean IsExecuting() ;
 
     virtual bool IsReadOnly() ;
 
-    virtual long LevelMax() ;
-    virtual SUPERV::ListOfNodes * LevelNodes(long aLevel ) ;
-    virtual long ThreadsMax() ;
-    virtual long GraphsNumber() ;
-    virtual long Threads() ;
-    virtual long SuspendedThreads() ;
+    virtual CORBA::Long LevelMax() ;
+    virtual SUPERV::ListOfNodes * LevelNodes(CORBA::Long aLevel ) ;
+    virtual CORBA::Long ThreadsMax() ;
+    virtual CORBA::Long Threads() ;
+    virtual CORBA::Long SuspendedThreads() ;
 
+    virtual bool Run() ;   // called on "Execute Graph" command
+    virtual bool Start() ; // called on "Execute Graph Step-by-Step" command
     virtual bool Begin() ;
-    virtual bool Run() ;
-    virtual bool Start() ;
-    virtual long LastLevelDone() ;
+    virtual CORBA::Long LastLevelDone() ;
 
     virtual bool EventNoW( SUPERV::CNode_out aNode ,
                            SUPERV::GraphEvent & anEvent ,
@@ -172,8 +201,24 @@ class Graph_Impl :public INode_Impl ,
     virtual bool EventW( SUPERV::CNode_out aNode ,
                          SUPERV::GraphEvent & anEvent ,
                          SUPERV::GraphState & aState ) ;
+    virtual CORBA::Long EventQSize() ;
+
+    virtual CORBA::Long SubGraphsNumber() ;
+    virtual SUPERV::ListOfNodes * SubGraphsNodes( CORBA::Long aSubGraphNumber ) ;
 
     virtual bool Merge(const SUPERV::Graph_ptr aGraph ) ;
+    virtual bool Merge(const SUPERV::Graph_ptr aGraph , map< string , int > & aMapOfNodes ) ;
+
+    virtual SUPERV::StreamGraph_ptr ToStreamGraph() ;
+
+    virtual void Editing(); // Destroy Executor and use only Editor and its data model
+  
+    virtual char* DefaultCContainerName() ;
+    virtual char* DefaultPythonContainerName() ;
+    virtual char* ContainerNameForComponent( const char * theComponentName) ;
+
+private:
+    bool run( const bool andSuspend = false ); // Run() calls run( false ), Start() calls run( true );
 
 };