Salome HOME
Error Messages
[modules/superv.git] / src / GraphBase / DataFlowBase_Graph.hxx
index 35c07ad28709ce4e17e36af4a558a9ac01598aa4..886eb212ad4eb8ba0651fc84b0cc9af8ccafe8d8 100644 (file)
@@ -36,8 +36,6 @@
 #include "DataFlowBase_EndOfSwitchNode.hxx"
 #include "DataFlowBase_DataNode.hxx"
 
-class Graph_Impl ;
-
 namespace GraphBase {
 
   class Graph : public DataNode {
@@ -47,8 +45,8 @@ namespace GraphBase {
 //      int                 _Graph_prof_debug;
 //      ofstream          * _Graph_fdebug;
       CORBA::ORB_ptr      _Orb ;
-      SUPERV::Graph_var   _Graph ;
-      Graph_Impl        * _GraphImpl ;
+//      SUPERV::Graph_var   _Graph ;
+//      Graph_Impl        * _GraphImpl ;
 
 // Map of Nodes of the Graph
       map< string , int >      _MapOfGraphNodes ;
@@ -72,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 ]
@@ -90,6 +90,8 @@ namespace GraphBase {
 //      int                              _SubStreamGraphsSize ;
 //      vector<vector<ComputingNode *> > _SubStreamGraphs ;
 
+      string _Messages ;
+
       bool AddLink( GraphBase::ComputingNode *fromNode ,
                     GraphBase::OutPort *fromPort ,
                     GraphBase::ComputingNode *toNode ,
@@ -131,12 +133,12 @@ namespace GraphBase {
             return _prof_debug ; } ;
       ofstream * Graph_fdebug() { return _fdebug ; } ;
 
-      SUPERV::Graph_var ObjRef() const { return _Graph ; } ;
-      void SetObjRef( SUPERV::Graph_var aGraph ) {
-                      _Graph = aGraph ; } ;
-      Graph_Impl * ObjImpl() const { return _GraphImpl ; } ;
-      void SetObjImpl( Graph_Impl * aGraphImpl ) {
-                       _GraphImpl = aGraphImpl ; } ;
+//      SUPERV::Graph_var ObjRef() const { return _Graph ; } ;
+//      void SetObjRef( SUPERV::Graph_var aGraph ) {
+//                      _Graph = aGraph ; } ;
+//      Graph_Impl * ObjImpl() const { return _GraphImpl ; } ;
+//      void SetObjImpl( Graph_Impl * aGraphImpl ) {
+//                       _GraphImpl = aGraphImpl ; } ;
 
       void AddLinkedNode( const char* FromNodeName , GraphBase::ComputingNode * anOutNode ) {
            GetChangeGraphNode( FromNodeName )->AddLinkedNode( anOutNode ) ; } ;
@@ -147,16 +149,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 ; } ;
@@ -246,10 +279,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 ) ;
@@ -287,9 +322,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 ,
@@ -297,10 +332,16 @@ namespace GraphBase {
 
       void SetGraphPorts() ;
 
+      string Messages() ;
+      void ReSetMessages() ;
+      void SetMessages( string anErrorMessage ) ;
+
       bool CreateService() ;
       bool InLineServices() ;
 
       bool Sort( int & SubStreamGraphsNumber ) ;
+      bool ValidLoops() const ;
+      bool ValidSwitchs() const ;
       bool ComputingNodes() const ;
       bool LinkLoopNodes(bool & NewLink ) ;
       bool DataServerNodes() const ;
@@ -311,7 +352,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() {