Salome HOME
Setvalue method's name instead of overloaded Value
[modules/superv.git] / src / GraphBase / DataFlowBase_DataNode.cxx
index fa17d1a67d64f51c5b9b4cd6da3b7cc1d2e3fca0..64a4bbf8708dc256d18decb918def9422bdbc1c0 100644 (file)
-using namespace std;
-//=============================================================================
-// File      : DataFlowBase_DataNode.cxx
-// 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_DataNode.cxx
+//  Author : Jean Rahuel, CEA
+//  Module : SUPERV
+//  $Header:
 
+using namespace std;
 #include "DataFlowBase_DataNode.hxx"
 
 GraphBase::DataNode::DataNode() :
-           InLineNode() {
+           GOTONode() {
   MESSAGE( "GraphBase::DataNode::DataNode" );
   _Created = false ;
 }
 
 GraphBase::DataNode::DataNode( CORBA::ORB_ptr ORB ,
                                SALOME_NamingService* ptrNamingService ,
-                               const char *DataFlowName ) :
-           InLineNode( ORB , ptrNamingService , DataFlowName ) {
-  MESSAGE( "GraphBase::DataNode::DataNode" );
+                               const char *DataFlowName ,
+                               const SUPERV::KindOfNode DataFlowkind ,
+                               int * Graph_prof_debug ,
+                               ofstream * Graph_fdebug ) :
+           GOTONode( ORB , ptrNamingService , DataFlowName , DataFlowkind , Graph_prof_debug , Graph_fdebug ) {
+//  MESSAGE( "GraphBase::DataNode::DataNode" );
+  cdebug << "GraphBase::DataNode::DataNode" << endl ;
   _Created = false ;
 }
 
-GraphBase::DataNode::DataNode(
-                CORBA::ORB_ptr ORB ,
-                SALOME_NamingService* ptrNamingService ,
-                const SALOME_ModuleCatalog::Service& DataFlowService ,
-                const char *DataFlowName ,
-                const SUPERV::KindOfNode DataFlowkind ,
-                const SUPERV::SDate DataFlowFirstCreation ,
-                const SUPERV::SDate DataFlowLastModification ,
-                const char * DataFlowEditorRelease ,
-                const char * DataFlowAuthor ,
-                const char * DataFlowComment ) :
-           InLineNode( ORB , ptrNamingService , DataFlowService ,
-                       DataFlowName , DataFlowkind ,
-                       DataFlowFirstCreation , DataFlowLastModification  ,
-                       DataFlowEditorRelease , DataFlowAuthor ,
-                       DataFlowComment , false , 0 , 0) {
+GraphBase::DataNode::DataNode( CORBA::ORB_ptr ORB ,
+                               SALOME_NamingService* ptrNamingService ,
+                               const SALOME_ModuleCatalog::Service& DataFlowService ,
+                               const char *DataFlowName ,
+                               const SUPERV::KindOfNode DataFlowkind ,
+                               const SUPERV::SDate DataFlowFirstCreation ,
+                               const SUPERV::SDate DataFlowLastModification ,
+                               const char * DataFlowEditorRelease ,
+                               const char * DataFlowAuthor ,
+                               const char * DataFlowComment ) :
+           GOTONode( ORB , ptrNamingService ,
+                     DataFlowName , SUPERV::ListOfStrings() , DataFlowName , DataFlowkind ,
+                     DataFlowFirstCreation , DataFlowLastModification  ,
+                     DataFlowEditorRelease , DataFlowAuthor ,
+                     DataFlowComment , false , 0 , 0) {
 //  MESSAGE( "GraphBase::DataNode::DataNode" );
 }
 
 GraphBase::DataNode::~DataNode() {
 //  MESSAGE( "GraphBase::DataNode::~DataNode" );
+  cdebug << "GraphBase::DataNode::~DataNode" << endl ;
 }
 
-void GraphBase::DataNode::DataService(
-                       CORBA::ORB_ptr ORB ,
-                       SALOME_ModuleCatalog::Service aService ,
-                       int * Graph_prof_debug ,
-                       ostream * Graph_fdebug ) {
-//  cout << "GraphBase::DataNode::DataService : DataFlowPortsOfNode of "
-//       << aService.ServiceName << endl ;
-//  DefPortsOfNode( aService , aService.ServiceName ) ;
-  DefPortsOfNode( ORB , aService , NamePtr() , Kind() , true , false , false , false ,
+void GraphBase::DataNode::DataService( CORBA::ORB_ptr ORB ,
+                                       SALOME_ModuleCatalog::Service aService ,
+                                       int * Graph_prof_debug ,
+                                       ofstream * Graph_fdebug ) {
+  cdebug << "GraphBase::DataNode::DataService : DataFlowPortsOfNode of "
+         << aService << endl ;
+  DefPortsOfNode( ORB , aService , NamePtr() , Kind() ,
                   Graph_prof_debug , Graph_fdebug ) ;
 
-  if ( _Created )
+  if ( _Created ) {
     delete _DataFlowDataPorts ;
+  }
   SALOME_ModuleCatalog::Service aReversedService ;
   aReversedService.ServiceName = aService.ServiceName ;
   aReversedService.ServiceinParameter = aService.ServiceoutParameter ;
   aReversedService.ServiceoutParameter = aService.ServiceinParameter ;
   _DataFlowDataPorts = new PortsOfNode() ;
-//  cout << "GraphBase::DataNode::DataService : Mirrored DataFlowPortsOfNode of "
-//       << aReversedService.ServiceName << endl ;
-  _DataFlowDataPorts->DefPortsOfNode( ORB , aReversedService , NamePtr() ,
-                                      Kind() , true , false , false , false ,
+  cdebug << "GraphBase::DataNode::DataService : Mirrored DataFlowPortsOfNode of "
+         << aReversedService << endl ;
+  _DataFlowDataPorts->DefPortsOfNode( ORB , aReversedService , NamePtr() , Kind() ,
                                       Graph_prof_debug , Graph_fdebug ) ;
-//                                      aReversedService.ServiceName ) ;
   _Created = true ;
 }
 
 int GraphBase::DataNode::CheckDataServerNodes() const {
 
-  cdebug << "GraphBase::Graph::DataServerNodes ()" << endl;
+  cdebug_in << "GraphBase::DataNode::CheckDataServerNodes :" << endl;
 
   int i , ierr = 0 ;
 
   for ( i = 0 ; i < _DataFlowDataPorts->GetNodeOutPortsSize() ; i++ ) {
-    if ( !_DataFlowDataPorts->GetNodeOutPort(i)->IsDataConnected() ) {
-      cdebug << "InPort " << _DataFlowDataPorts->GetNodeOutPort(i)->PortName()
-             << " of DataFlow " << Name() << " has NO Data." << endl ;
-      ierr++ ;
+// Not a BUG : Reversed Service of the graph 
+    const GraphBase::OutPort * anOutPort = _DataFlowDataPorts->GetNodeOutPort(i) ;
+//    if ( !anOutPort->IsGate() && !anOutPort->IsDataStream() && !anOutPort->IsDataConnected() ) {
+    if ( !anOutPort->IsGate() && !anOutPort->IsDataConnected() ) {
+      if ( anOutPort->IsExternConnected() && GraphMacroLevel() != 0 ) {
+        cdebug << "InPort " << anOutPort->PortName() << " " << anOutPort->PortType() << " "
+               << anOutPort->PortStatus() << " of DataFlow " << Name()
+               << " is ExternConnected. GraphMacroLevel " << GraphMacroLevel() << endl ;
+      }
+      else {
+        cdebug << "InPort " << anOutPort->PortName() << " " << anOutPort->PortType() << " "
+               << anOutPort->PortStatus() << " of DataFlow " << Name() << " has NO Data. GraphMacroLevel "
+               << GraphMacroLevel() << endl ;
+        ierr++ ;
+      }
     }
     else {
-      cdebug << "InPort " << _DataFlowDataPorts->GetNodeOutPort(i)->PortName()
-             << " of DataFlow " << Name()  << " has Data : "
-//           << _DataFlowDataPorts->GetNodeOutPort(i)->Value() << " kind "
-//           << _DataFlowDataPorts->GetNodeOutPort(i)->Kind()
+      cdebug << "InPort " << anOutPort->PortName() << " " << anOutPort->PortType() << " "
+             << anOutPort->PortStatus() << " of DataFlow " << Name()  << " has Data : "
              << endl ;
     }
   }
 
   for ( i = 0 ; i < _DataFlowDataPorts->GetNodeInPortsSize() ; i++ ) {
-    if ( !_DataFlowDataPorts->GetNodeInPort(i)->IsConnected() ) {
+    if ( _DataFlowDataPorts->GetNodeInPort(i)->IsPortConnected() ) {
       cdebug << "OutPort " << _DataFlowDataPorts->GetNodeInPort(i)->PortName()
-             << " of DataFlow " << Name()  << " has Data " << endl ;
-//      ierr++ ;
+             << " of DataFlow " << Name()  << " is Connected" << endl ;
     }
     else {
       cdebug << "OutPort " << _DataFlowDataPorts->GetNodeInPort(i)->PortName()
-             << " of DataFlow " << Name()  << " has NO Data : "
-//           << _DataFlowDataPorts->GetChangeNodeInPort(i)->GetLink()->Value()
-//           << " kind "
-//           << _DataFlowDataPorts->GetChangeNodeInPort(i)->GetLink()->Kind()
-             << endl ;
-      ierr++ ;
+             << " of DataFlow " << Name()  << " is NOT Connected" << endl ;
     }
   }
 
   if ( ierr ) {
-    cdebug << "Some Input Data missing in the DataFlow " << Name() << endl ;
+    cdebug << "In the DataFlow " << Name() << " " << ierr << " Some Input Data is missing" << endl ;
   }
 
+  cdebug_out << "GraphBase::DataNode::CheckDataServerNodes ierr " << ierr << endl;
   return ierr ;
 }
 
-void GraphBase::DataNode::ListDatas(ostrstream & f ) const {
+void GraphBase::DataNode::ListDatas(ostream & f ) const {
   _DataFlowDataPorts->ListPorts( f , false ) ;
 }
 
-void GraphBase::DataNode::DataNodeInfo(ostrstream & s ) const {
-  int i ;
+void GraphBase::DataNode::DataNodeInfo(ostream & s ) const {
   s << *this ;
   s << "Ports :" << endl ;
   ListPorts( s , true ) ;