]> SALOME platform Git repositories - modules/superv.git/blobdiff - src/GraphBase/DataFlowBase_Graph.hxx
Salome HOME
DCQ : Merge with Ecole_Ete_a6.
[modules/superv.git] / src / GraphBase / DataFlowBase_Graph.hxx
index cafe53a7d7ef94955e3835f7ad5fa372d587d776..16130df595002b1104b03050f32b47c485b2a594 100644 (file)
@@ -1,10 +1,30 @@
-//=============================================================================
-// File      : DataFlowBase_Graph.hxx
-// Created   : 2002
-// Author    : Jean Rahuel, CEA
-// Project   : SALOME
-// $Header:
-//=============================================================================
+//  SUPERV GraphBase : contains fondamental classes for Services, Input Ports, Output Ports Links and Nodes.
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  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 
+//
+//
+//
+//  File   : DataFlowBase_Graph.hxx
+//  Author : Jean Rahuel, CEA
+//  Module : SUPERV
+//  $Header:
 
 #ifndef _DATAFLOWBASE_GRAPH_HXX
 #define _DATAFLOWBASE_GRAPH_HXX
@@ -24,23 +44,22 @@ namespace GraphBase {
 
     private:
 
-      int                 _Graph_prof_debug;
-      ostream           * _Graph_fdebug;
+//      int                 _Graph_prof_debug;
+//      ofstream          * _Graph_fdebug;
       CORBA::ORB_ptr      _Orb ;
       SUPERV::Graph_var   _Graph ;
       Graph_Impl        * _GraphImpl ;
 
-// Map of InNodes of the OutNode
+// Map of Nodes of the Graph
       map< string , int >      _MapOfGraphNodes ;
       long                     _GraphNodesSize ;
       vector<bool >            _Sorted ;
       vector<ComputingNode *>  _GraphNodes ;
 
 // _SortedNodes[ _LevelsNumber ] : topological sort from 0 to _LevelsNumber
-// _SortedNodes[ _level ][ _NodesNumber[ _level ] ] : _NodesNumber[ _level ] Nodes
+// _SortedNodes[ _level ][ _NodesNumber[ _level ] ] : _NodesNumber[ _level ] Nodes in the level
       int                              _LevelsNumber ;
       int                              _ThreadsMax ;
-      int                              _GraphsNumber ;
       vector<int >                     _NodesNumber ;
       vector<vector<ComputingNode *> > _SortedNodes ;
 
@@ -53,6 +72,24 @@ namespace GraphBase {
       vector<ComputingNode *>  _QueueNodes ;
       bool                     _ParallelExecutionNodes ;
 
+// For generated NodeNames with ServiceName : number of Nodes using
+// the same ServiceName. It is not the same Service if it belongs to
+// a different Interface and/or a different Component ...
+      map< string , GraphBase::Service * > _MapOfServiceNames ;
+
+// Total number of SubGraphs
+      int                              _SubGraphsNumber ;
+// _SubGraphs[ SubGraphNumero ] [ NodeNumero ]
+// SubGraphNumero : [ 0 , _SubGraphsSize [ ; NodeNumero : [ 0 , _SubGraphs[ SubGraphNumero ].size() [
+      int                              _SubGraphsSize ;
+      vector<vector<ComputingNode *> > _SubGraphs ;
+
+// _SubStreamGraphs[ SubStreamGraphNumero ] [ NodeNumero ]
+// SubStreamGraphNumero : [ 0 , _SubStreamGraphsSize [
+// NodeNumero : [ 0 , _SubStreamGraphs[ SubStreamGraphNumero ].size() [
+//      int                              _SubStreamGraphsSize ;
+//      vector<vector<ComputingNode *> > _SubStreamGraphs ;
+
       bool AddLink( GraphBase::ComputingNode *fromNode ,
                     GraphBase::OutPort *fromPort ,
                     GraphBase::ComputingNode *toNode ,
@@ -64,7 +101,9 @@ namespace GraphBase {
       Graph( CORBA::ORB_ptr ORB ,
              SALOME_NamingService* ptrNamingService ,
              const char *DataFlowName ,
-             const char * DebugFileName ) ;
+             int * Graph_prof_debug ,
+             ofstream * Graph_fdebug ) ;
+//             const char * DebugFileName ) ;
       Graph( CORBA::ORB_ptr ORB ,
              SALOME_NamingService* ptrNamingService ,
              const SALOME_ModuleCatalog::Service& DataFlowService ,
@@ -78,13 +117,18 @@ namespace GraphBase {
              const char * DataFlowAuthor ,
              const char * DataFlowComputer ,
              const char * DataFlowComment ,
-             const char * DebugFileName ) ;
+             int * Graph_prof_debug ,
+             ofstream * Graph_fdebug ) ;
+//             const char * DebugFileName ) ;
       virtual ~Graph() ;
 
-      void Set_prof_debug( CORBA::ORB_ptr ORB ,
-                           const char * DebugFileName ) ;
-      int * Graph_prof_debug() { return &_Graph_prof_debug ; } ;
-      ostream * Graph_fdebug() { return _Graph_fdebug ; } ;
+//      void Set_prof_debug( CORBA::ORB_ptr ORB ,
+//                           const char * DebugFileName ) ;
+      void Set_prof_debug( int * Graph_prof_debug ,
+                           ofstream * Graph_fdebug ) ;
+      int * Graph_prof_debug() {
+            return _prof_debug ; } ;
+      ofstream * Graph_fdebug() { return _fdebug ; } ;
 
       SUPERV::Graph_var ObjRef() const { return _Graph ; } ;
       void SetObjRef( SUPERV::Graph_var aGraph ) {
@@ -111,6 +155,7 @@ namespace GraphBase {
            } ;
       void DelGraphNodeIndex( const char *name ) {
            _MapOfGraphNodes.erase( name ) ; } ;
+
       const GraphBase::ComputingNode * GetGraphNode( const int index ) const {
             const ComputingNode * aNode = GetChangeGraphNode( index ) ;
             return aNode ; } ;
@@ -148,25 +193,41 @@ namespace GraphBase {
       ComputingNode * QueueNodes( int i ) const {
             return _QueueNodes[ i ] ; } ;
 
-      const GraphBase::InPort *GetInPort( const char* ToNodeName ,
-                                          const char* ToServiceParameterName ) {
+      const GraphBase::InPort * GetInPort( const char * ToServiceParameterName ) {
+                                return GraphBase::PortsOfNode::GetInPort( ToServiceParameterName ) ; } ;
+      GraphBase::InPort * GetChangeInPort( const char * ToServiceParameterName ) {
+                          return GraphBase::PortsOfNode::GetChangeInPort( ToServiceParameterName ) ; } ;
+      const GraphBase::OutPort * GetOutPort( const char * FromServiceParameterName ) {
+                                 return GraphBase::PortsOfNode::GetOutPort( FromServiceParameterName ) ; } ;
+      GraphBase::OutPort * GetChangeOutPort( const char * FromServiceParameterName ) {
+                           return GraphBase::PortsOfNode::GetChangeOutPort( FromServiceParameterName ); } ;
+
+      const GraphBase::InPort * GetInPort( const char * ToNodeName ,
+                                          const char * ToServiceParameterName ) {
             ComputingNode * aNode = GetChangeGraphNode( ToNodeName ) ;
             if ( aNode ) {
               return aNode->GetInPort(ToServiceParameterName);
            }
             else
               return NULL ; } ;
-      GraphBase::InPort *GetChangeInPort( const char* ToNodeName ,
-                                          const char* ToServiceParameterName ) {
+      GraphBase::InPort * GetChangeInPort( const char * ToNodeName ,
+                                          const char * ToServiceParameterName ) {
             ComputingNode * aNode = GetChangeGraphNode( ToNodeName ) ;
             if ( aNode ) {
-              return aNode->GetChangeInPort(ToServiceParameterName);
+              return aNode->GetChangeInPort( ToServiceParameterName ) ;
+           }
+            else
+              return NULL ; } ;
+      const GraphBase::OutPort * GetOutPort( const char * FromNodeName ,
+                                    const char * FromServiceParameterName ) {
+            ComputingNode * aNode = GetChangeGraphNode( FromNodeName ) ;
+            if ( aNode ) {
+              return aNode->GetOutPort( FromServiceParameterName ) ;
            }
             else
               return NULL ; } ;
-      GraphBase::OutPort *GetChangeOutPort(
-                                      const char* FromNodeName ,
-                                      const char* FromServiceParameterName ) {
+      GraphBase::OutPort * GetChangeOutPort( const char * FromNodeName ,
+                                            const char * FromServiceParameterName ) {
             ComputingNode * aNode = GetChangeGraphNode( FromNodeName ) ;
             if ( aNode ) {
               return aNode->GetChangeOutPort( FromServiceParameterName );
@@ -194,10 +255,9 @@ namespace GraphBase {
 
       GraphBase::SNode * GetInfo() const ;
       GraphBase::ListOfNodes * GetNodes() const ;
-      GraphBase::ListOfLinks * GetLinks() const ;
+      GraphBase::ListOfLinks * GetLinks(bool AllLinks = false ) const ;
       GraphBase::ListOfGraphs * GetGraphs() const ;
       GraphBase::ListOfLinks * GetDatas() const ;
-//      SALOME_ModuleCatalog::Service * GetService() const ;
 
       bool AddNode( ComputingNode * aNode ) ;
       bool RemoveNode( const char* NodeName ) ;
@@ -242,17 +302,25 @@ namespace GraphBase {
       bool CreateService() ;
       bool InLineServices() ;
 
-      bool Sort() ;
+      bool Sort( int & SubStreamGraphsNumber ) ;
       bool ComputingNodes() const ;
+      bool LinkLoopNodes(bool & NewLink ) ;
       bool DataServerNodes() const ;
   
       long LevelMax() {
            return _LevelsNumber + 1 ; } ;
+
+      map< string , GraphBase::Service * > MapOfServiceNames() ;
+      GraphBase::Service * GetServiceOfMap( char * name ) ;
+      bool SetServiceOfMap( GraphBase::Service * aService ) ;
+      int GetServiceNameNumber( SALOME_ModuleCatalog::Service aService ) ;
+
       SUPERV::ListOfStrings * LevelNodes(long aLevel ) ;
       long ThreadsMax() {
            return _ThreadsMax ; } ;
-      long GraphsNumber() {
-           return _GraphsNumber ; } ;
+
+      long SubGraphsNumber() {
+           return _SubGraphsNumber ; } ;
 
       int NodesNumber(const int aLevel ) {
           return _NodesNumber[ aLevel ] ; } ;