Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[modules/superv.git] / src / GraphBase / DataFlowBase_Graph.hxx
index 8035528cc93b7d57f322bec110c62a0bee0c6b86..a5a026cf92fbbcca6a7638cf755519a028f2952f 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
 //
 //
 //
@@ -70,11 +70,13 @@ 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
+// For StreamGraphs. It is not the same Service if it belongs to
 // a different Interface and/or a different Component ...
       map< string , GraphBase::Service * > _MapOfServiceNames ;
 
+// For automactic rename of nodes if unique names in graphs
+      map< string , int >      _MapOfServiceInstanceNumber ;
+
 // Total number of SubGraphs
       int                              _SubGraphsNumber ;
 // _SubGraphs[ SubGraphNumero ] [ NodeNumero ]
@@ -88,10 +90,14 @@ namespace GraphBase {
 //      int                              _SubStreamGraphsSize ;
 //      vector<vector<ComputingNode *> > _SubStreamGraphs ;
 
-      bool AddLink( GraphBase::ComputingNode *fromNode ,
-                    GraphBase::OutPort *fromPort ,
-                    GraphBase::ComputingNode *toNode ,
-                    GraphBase::InPort *toPort ) ;
+    string _Messages ;
+
+    map< string, string > _MapOfComponentNameContainer ; // mkr : PAL13947
+    
+    bool AddLink( GraphBase::ComputingNode *fromNode ,
+                 GraphBase::OutPort *fromPort ,
+                 GraphBase::ComputingNode *toNode ,
+                 GraphBase::InPort *toPort ) ;
 
     public:
 
@@ -145,16 +151,47 @@ namespace GraphBase {
 //              cdebug << "GetGraphNodeIndex of " << name << " in _MapOfGraphNodes : "
 //                     << index << " Node " << hex << (void *) _GraphNodes[ index ]
 //                     << dec << " '" << _GraphNodes[ index ]->Name() << "'" << endl ;
+#if 0
+           cdebug << "Graph::GetGraphNodeIndex " << _GraphNodesSize << " known nodes" << endl;
+           int i ;
+           for ( i = 0 ; i < _GraphNodesSize ; i++ ) {
+             cdebug << "Node" << i << _GraphNodes[ i ]->Name() << endl ;
+           }
+           map< string , int >::iterator aMapOfGraphNodesIterator ;
+           i = 0 ;
+           for ( aMapOfGraphNodesIterator = _MapOfGraphNodes.begin() ;
+             aMapOfGraphNodesIterator != _MapOfGraphNodes.end() ; aMapOfGraphNodesIterator++ ) {
+             cdebug << "MapOfGraphNodes " << i++ << " " << aMapOfGraphNodesIterator->first
+                    << " --> " << aMapOfGraphNodesIterator->second << " - 1" << endl ;
+           }
+#endif
             return index ; } ;
       void SetGraphNodeIndex( const char *name , const int index ) {
            _MapOfGraphNodes[ name ] = index + 1 ;
            cdebug << "SetGraphNodeIndex of " << name << " in _MapOfGraphNodes : "
-                  << index << " Node " << hex << (void *) _GraphNodes[ index ]
-                  << " '" << _GraphNodes[ index ]->Name() << "'" << endl ;
+                  << index << " Node " << (void *) _GraphNodes[ index ]
+                  << " '" << _GraphNodes[ index ]->Name() << "' MapOfGraphNodessize "
+                  << GetGraphNodeSize() << endl ;
+#if 1
+           cdebug << "Graph::SetGraphNodeIndex " << _GraphNodesSize << " known nodes" << endl;
+           int i ;
+           for ( i = 0 ; i < _GraphNodesSize ; i++ ) {
+             cdebug << "Node" << i << _GraphNodes[ i ]->Name() << endl ;
+           }
+           map< string , int >::iterator aMapOfGraphNodesIterator ;
+           i = 0 ;
+           for ( aMapOfGraphNodesIterator = _MapOfGraphNodes.begin() ;
+             aMapOfGraphNodesIterator != _MapOfGraphNodes.end() ; aMapOfGraphNodesIterator++ ) {
+             cdebug << "MapOfGraphNodes " << i++ << " " << aMapOfGraphNodesIterator->first
+                    << " --> " << aMapOfGraphNodesIterator->second << " - 1" << endl ;
+           }
+#endif
            } ;
       void DelGraphNodeIndex( const char *name ) {
            _MapOfGraphNodes.erase( name ) ; } ;
 
+      int GetGraphNodeSize() const {
+          return _MapOfGraphNodes.size() ; }
       const GraphBase::ComputingNode * GetGraphNode( const int index ) const {
             const ComputingNode * aNode = GetChangeGraphNode( index ) ;
             return aNode ; } ;
@@ -244,10 +281,12 @@ namespace GraphBase {
         if ( aState == SUPERV::DoneState )
           aRet = true ;
         return aRet ; } ;
-      const CORBA::Any * PortInData( const char* ToNodeName ,
-                                     const char* ToServiceParameterName ) ;
-      const CORBA::Any * PortOutData( const char* FromNodeName ,
-                                      const char* FromServiceParameterName ) ;
+//JR 30.03.2005      const CORBA::Any * PortInData( const char* ToNodeName ,
+      const CORBA::Any PortInData( const char* ToNodeName ,
+                                   const char* ToServiceParameterName ) ;
+//JR 30.03.2005      const CORBA::Any * PortOutData( const char* FromNodeName ,
+      const CORBA::Any PortOutData( const char* FromNodeName ,
+                                    const char* FromServiceParameterName ) ;
 
       bool LoadXml( CORBA::ORB_ptr Orb , const char* anXmlFile ,
                     GraphBase::ListOfSGraphs & aListOfDataFlows ) ;
@@ -285,9 +324,9 @@ namespace GraphBase {
       bool ChangeInputData( const char* ToNodeName ,
                             const char* ToParameterName ,
                             const CORBA::Any aValue ) ;
-      bool AddInputData( const char* ToNodeName ,
-                         const char* ToParameterName ,
-                         const CORBA::Any ** aValue ) ;
+//      bool AddInputData( const char* ToNodeName ,
+//                         const char* ToParameterName ,
+//                         const CORBA::Any ** aValue ) ;
 
       bool AddOutputData( const char* FromNodeName ,
                           const char* FromParameterName ,
@@ -295,10 +334,17 @@ namespace GraphBase {
 
       void SetGraphPorts() ;
 
+      string Messages() ;
+      void ReSetMessages() ;
+      void SetMessages( string anErrorMessage ) ;
+
       bool CreateService() ;
       bool InLineServices() ;
 
       bool Sort( int & SubStreamGraphsNumber ) ;
+      bool ValidGOTO() ; // mkr : PAL12575
+      bool ValidLoops() const ;
+      bool ValidSwitchs() const ;
       bool ComputingNodes() const ;
       bool LinkLoopNodes(bool & NewLink ) ;
       bool DataServerNodes() const ;
@@ -309,7 +355,7 @@ namespace GraphBase {
       map< string , GraphBase::Service * > MapOfServiceNames() ;
       GraphBase::Service * GetServiceOfMap( char * name ) ;
       bool SetServiceOfMap( GraphBase::Service * aService ) ;
-      int GetServiceNameNumber( SALOME_ModuleCatalog::Service aService ) ;
+      int GetNewServiceInstanceNumber( char * aServiceName ) ;
 
       SUPERV::ListOfStrings * LevelNodes(long aLevel ) ;
       long ThreadsMax() {
@@ -329,6 +375,28 @@ namespace GraphBase {
                            Engines::Container_var & myContainer ,
                            Engines::Component_var & objComponent ) ;
 
+    // mkr : PAL13947
+    void InsertToMapOfComponentNameContainer( const char * theComponentName, 
+                                             const char * theContainer) {
+      _MapOfComponentNameContainer[ theComponentName ] = theContainer ;
+    }
+
+    // mkr : PAL13947    
+    const char * RetrieveFromMapOfComponentNameContainer( const char * theComponentName ) {
+      if ( _MapOfComponentNameContainer.empty() 
+          ||
+          _MapOfComponentNameContainer.find(theComponentName) == _MapOfComponentNameContainer.end() )
+       return NULL ;
+      
+      return _MapOfComponentNameContainer[ theComponentName ].c_str() ;
+    }
+
+    // mkr : PAL13947
+    void ClearMapOfComponentNameContainer() {
+      if ( !_MapOfComponentNameContainer.empty() )
+       _MapOfComponentNameContainer.clear();
+    }
+
   };
   
 };