Salome HOME
DCQ : Merge with Ecole_Ete_a6.
[modules/superv.git] / src / GraphBase / DataFlowBase_Port.hxx
index ddee288874e49c16567ab990e82a0d6fe387e15a..c944750a1f7c66a779c10b90398252f2839fdaac 100644 (file)
@@ -38,96 +38,108 @@ namespace GraphBase {
 
   class Port : public ServicesParameter {
 
-    const char *const * _NodeName ;
-    SUPERV::Port_var    _Port ;
-    SUPERV::KindOfPort  _KindOfPort ;
+    private:
 
-    vector<long > _X ;    
-    vector<long > _Y ;    
+      const char *const * _NodeName ;
+      SUPERV::Port_var    _Port ;
+      SUPERV::KindOfPort  _KindOfPort ;
+
+      vector<long > _X ;    
+      vector<long > _Y ;    
+
+      SALOME_ModuleCatalog::DataStreamDependency _Dependency ; // Time or Iteration only for DataStreamPorts
 
     public:   
 
-    Port() {
-//         cout << "Port()" << endl ;
-         _NodeName = NULL ;
-         _Port = SUPERV::Port::_nil() ;
-         _KindOfPort = SUPERV::UndefinedParameter ;
-    } ;
-    Port( const char *const * NodeName ,
-          const SALOME_ModuleCatalog::ServicesParameter aserviceParameter ,
-          const SUPERV::KindOfPort aKindOfPort = SUPERV::ServiceParameter ) :
-          ServicesParameter( aserviceParameter ) {
-          _NodeName = NodeName ;
-          _Port = SUPERV::Port::_nil() ;
-          _KindOfPort = aKindOfPort ;
-       } ;
-    virtual ~Port() {
+      Port() {
+           _NodeName = NULL ;
+           _Port = SUPERV::Port::_nil() ;
+           _KindOfPort = SUPERV::UndefinedParameter ;
+           _Dependency  = SALOME_ModuleCatalog::DATASTREAM_UNDEFINED ; } ;
+      Port( const char *const * NodeName ,
+            const SALOME_ModuleCatalog::ServicesParameter aserviceParameter ,
+            const SUPERV::KindOfPort aKindOfPort = SUPERV::ServiceParameter ,
+            const SALOME_ModuleCatalog::DataStreamDependency aDependency = SALOME_ModuleCatalog::DATASTREAM_UNDEFINED ) :
+            ServicesParameter( aserviceParameter ) {
+            _NodeName = NodeName ;
+            _Port = SUPERV::Port::_nil() ;
+            _KindOfPort = aKindOfPort ;
+            if ( IsDataStream() ) {
+              _Dependency = aDependency ;
+           }
+            else {
+              _Dependency = SALOME_ModuleCatalog::DATASTREAM_UNDEFINED ;
+           } } ;
+      virtual ~Port() {
          cdebug << "~Port" << endl ; } ;
 
-    SUPERV::Port_var ObjRef() const { return _Port ; } ;
-    void ObjRef(SUPERV::Port_var aPort) {
-                _Port = aPort ; } ;
-
-    const char * NodeName() const { return *_NodeName ; } ;
-    const char * NodePortName() const {
-//          cout << "NodePortName " << hex << (void *) _NodeName << " "
-//               << dec << _NodeName << endl ;
-          char * _NodePortName = new char [ strlen( *_NodeName ) +
-                                 strlen( ServicesParameterName() ) + 3 ] ;
-          strcpy( _NodePortName , *_NodeName ) ;
-          strcat( _NodePortName , "\\" ) ;
-          strcat( _NodePortName , ServicesParameterName() ) ;
-//          strcat( _NodePortName , "\\" ) ;
-          return _NodePortName ; } ;          
-
-    const char * PortName() const {
-          if ( this == NULL )
-            return NULLSTRING ;
-          return ServicesParameterName() ; } ;
-    const char * PortType() const { return ServicesParameterType() ; } ;
-
-    void Kind( SUPERV::KindOfPort aKindOfPort ) {
-         if ( _KindOfPort == SUPERV::GateParameter && aKindOfPort == SUPERV::InLineParameter ) {
-           cdebug << "GraphBase::Port::Kind " << _KindOfPort << " --> " << aKindOfPort
-                  << endl ;
-        }
-         _KindOfPort = aKindOfPort ; } ;
-    const SUPERV::KindOfPort Kind() const { return _KindOfPort ; } ;
-    bool IsParam() const {
-         return _KindOfPort == SUPERV::ServiceParameter ; } ;
-    bool IsGate() const {
-         return _KindOfPort == SUPERV::GateParameter ||
-                _KindOfPort == SUPERV::GOTOParameter ; } ;
-    bool IsInLine() const {
-         return _KindOfPort == SUPERV::InLineParameter ; } ;
-    bool IsLoop() const {
-         return _KindOfPort == SUPERV::LoopParameter ; } ;
-    bool IsSwitch() const {
-         return _KindOfPort == SUPERV::SwitchParameter ; } ;
-    bool IsEndSwitch() const {
-         return _KindOfPort == SUPERV::EndSwitchParameter ; } ;
-    bool IsGOTO() const {
-         return _KindOfPort == SUPERV::GOTOParameter ; } ;
-//    bool IsBus() const { return ( ( _KindOfPort == SUPERV::InLineParameter ) ||
-//                                  ( _PortIndex != -1 ) ) ; } ;
-
-//    void PortIndex( const int anIndex ) {
-//         _PortIndex = anIndex ; } ;
-//    const int PortIndex() const {
-//          return _PortIndex ; } ;
-
-
-    bool AddCoord( const int nxy , const int *x , const int *y ) ;
-    bool AddCoord( const int index , const int x , const int y ) ;
-    bool ChangeCoord( const int index ,
-                      const int x ,
-                      const int y ) ;
-    bool RemoveCoord( const int index ) ;
-    bool RemoveCoords() ;
-    int GetCoord() const ;
-    bool GetCoord( int *x , int *y ) const ;
-    const GraphBase::ListOfCoords * Coords() const ;
-    bool GetCoord( const int index , long &x , long &y ) const ;
+      SUPERV::Port_var ObjRef() const { return _Port ; } ;
+      void ObjRef(SUPERV::Port_var aPort) {
+                  _Port = aPort ; } ;
+
+      const char * NodeName() const { return *_NodeName ; } ;
+      const char * NodePortName() const {
+//            cout << "NodePortName " << hex << (void *) _NodeName << " "
+//                 << dec << _NodeName << endl ;
+            char * _NodePortName = new char [ strlen( *_NodeName ) +
+                                   strlen( ServicesParameterName() ) + 3 ] ;
+            strcpy( _NodePortName , *_NodeName ) ;
+            strcat( _NodePortName , "\\" ) ;
+            strcat( _NodePortName , ServicesParameterName() ) ;
+            return _NodePortName ; } ;          
+
+      const char * PortName() const {
+            if ( this == NULL )
+              return NULLSTRING ;
+            return ServicesParameterName() ; } ;
+      const char * PortType() const { return ServicesParameterType() ; } ;
+
+      void Kind( SUPERV::KindOfPort aKindOfPort ) {
+           if ( _KindOfPort == SUPERV::GateParameter && aKindOfPort == SUPERV::InLineParameter ) {
+             cdebug << "GraphBase::Port::Kind " << _KindOfPort << " --> " << aKindOfPort
+                    << endl ;
+          }
+           _KindOfPort = aKindOfPort ; } ;
+      const SUPERV::KindOfPort Kind() const {
+            return _KindOfPort ; } ;
+      bool IsParam() const {
+           return _KindOfPort == SUPERV::ServiceParameter ; } ;
+      bool IsGate() const {
+           return _KindOfPort == SUPERV::GateParameter ||
+                  _KindOfPort == SUPERV::GOTOParameter ; } ;
+      bool IsInLine() const {
+           return _KindOfPort == SUPERV::InLineParameter ; } ;
+      bool IsLoop() const {
+           return _KindOfPort == SUPERV::LoopParameter ; } ;
+      bool IsSwitch() const {
+           return _KindOfPort == SUPERV::SwitchParameter ; } ;
+      bool IsEndSwitch() const {
+           return _KindOfPort == SUPERV::EndSwitchParameter ; } ;
+      bool IsGOTO() const {
+           return _KindOfPort == SUPERV::GOTOParameter ; } ;
+      bool IsDataStream() const {
+           return _KindOfPort == SUPERV::DataStreamParameter ; } ;
+
+      const SALOME_ModuleCatalog::DataStreamDependency Dependency() const {
+                                     return _Dependency ; } ;
+      bool Dependency( SALOME_ModuleCatalog::DataStreamDependency aDependency ) {
+           if ( IsDataStream() ) {
+             _Dependency = aDependency ;
+             return true ;
+          }
+           return false ; } ;
+
+      bool AddCoord( const int nxy , const int *x , const int *y ) ;
+      bool AddCoord( const int index , const int x , const int y ) ;
+      bool ChangeCoord( const int index ,
+                        const int x ,
+                        const int y ) ;
+      bool RemoveCoord( const int index ) ;
+      bool RemoveCoords() ;
+      int GetCoord() const ;
+      bool GetCoord( int *x , int *y ) const ;
+      const GraphBase::ListOfCoords * Coords() const ;
+      bool GetCoord( const int index , long &x , long &y ) const ;
 
   } ;
 
@@ -135,4 +147,6 @@ namespace GraphBase {
 
 ostream & operator<< (ostream &,const SUPERV::KindOfPort &);
 
+ostream & operator<< (ostream &,const SALOME_ModuleCatalog::DataStreamDependency &);
+
 #endif