1 // SUPERV GraphBase : contains fondamental classes for Services, Input Ports, Output Ports Links and Nodes.
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : DataFlowBase_DataNode.cxx
25 // Author : Jean Rahuel, CEA
30 #include "DataFlowBase_DataNode.hxx"
32 GraphBase::DataNode::DataNode() :
34 MESSAGE( "GraphBase::DataNode::DataNode" );
38 GraphBase::DataNode::DataNode( CORBA::ORB_ptr ORB ,
39 SALOME_NamingService* ptrNamingService ,
40 const char *DataFlowName ,
41 const SUPERV::KindOfNode DataFlowkind ,
42 int * Graph_prof_debug ,
43 ofstream * Graph_fdebug ) :
44 GOTONode( ORB , ptrNamingService , DataFlowName , DataFlowkind , Graph_prof_debug , Graph_fdebug ) {
45 // MESSAGE( "GraphBase::DataNode::DataNode" );
46 cdebug << "GraphBase::DataNode::DataNode" << endl ;
50 GraphBase::DataNode::DataNode( CORBA::ORB_ptr ORB ,
51 SALOME_NamingService* ptrNamingService ,
52 const SALOME_ModuleCatalog::Service& DataFlowService ,
53 const char *DataFlowName ,
54 const SUPERV::KindOfNode DataFlowkind ,
55 const SUPERV::SDate DataFlowFirstCreation ,
56 const SUPERV::SDate DataFlowLastModification ,
57 const char * DataFlowEditorRelease ,
58 const char * DataFlowAuthor ,
59 const char * DataFlowComment ) :
60 GOTONode( ORB , ptrNamingService ,
61 DataFlowName , SUPERV::ListOfStrings() , DataFlowName , DataFlowkind ,
62 DataFlowFirstCreation , DataFlowLastModification ,
63 DataFlowEditorRelease , DataFlowAuthor ,
64 DataFlowComment , false , 0 , 0) {
65 // MESSAGE( "GraphBase::DataNode::DataNode" );
68 GraphBase::DataNode::~DataNode() {
69 // MESSAGE( "GraphBase::DataNode::~DataNode" );
70 cdebug << "GraphBase::DataNode::~DataNode" << endl ;
73 void GraphBase::DataNode::DataService( CORBA::ORB_ptr ORB ,
74 SALOME_ModuleCatalog::Service aService ,
75 int * Graph_prof_debug ,
76 ofstream * Graph_fdebug ) {
77 cdebug << "GraphBase::DataNode::DataService : DataFlowPortsOfNode of "
79 DefPortsOfNode( ORB , aService , NamePtr() , Kind() ,
80 Graph_prof_debug , Graph_fdebug ) ;
83 delete _DataFlowDataPorts ;
84 SALOME_ModuleCatalog::Service aReversedService ;
85 aReversedService.ServiceName = aService.ServiceName ;
86 aReversedService.ServiceinParameter = aService.ServiceoutParameter ;
87 aReversedService.ServiceoutParameter = aService.ServiceinParameter ;
88 _DataFlowDataPorts = new PortsOfNode() ;
89 cdebug << "GraphBase::DataNode::DataService : Mirrored DataFlowPortsOfNode of "
90 << aReversedService << endl ;
91 _DataFlowDataPorts->DefPortsOfNode( ORB , aReversedService , NamePtr() , Kind() ,
92 Graph_prof_debug , Graph_fdebug ) ;
96 int GraphBase::DataNode::CheckDataServerNodes() const {
98 cdebug << "GraphBase::DataNode::CheckDataServerNodes :" << endl;
102 for ( i = 0 ; i < _DataFlowDataPorts->GetNodeOutPortsSize() ; i++ ) {
103 // Not a BUG : Reversed Service of the graph
104 const GraphBase::OutPort * anOutPort = _DataFlowDataPorts->GetNodeOutPort(i) ;
105 // if ( !anOutPort->IsGate() && !anOutPort->IsDataStream() && !anOutPort->IsDataConnected() ) {
106 if ( !anOutPort->IsGate() && !anOutPort->IsDataConnected() ) {
107 if ( anOutPort->IsExternConnected() && GraphMacroLevel() != 0 ) {
108 cdebug << "InPort " << anOutPort->PortName() << " " << anOutPort->PortType() << " "
109 << anOutPort->PortStatus() << " of DataFlow " << Name()
110 << " is ExternConnected. GraphMacroLevel " << GraphMacroLevel() << endl ;
113 cdebug << "InPort " << anOutPort->PortName() << " " << anOutPort->PortType() << " "
114 << anOutPort->PortStatus() << " of DataFlow " << Name() << " has NO Data. GraphMacroLevel "
115 << GraphMacroLevel() << endl ;
120 cdebug << "InPort " << anOutPort->PortName() << " " << anOutPort->PortType() << " "
121 << anOutPort->PortStatus() << " of DataFlow " << Name() << " has Data : "
126 for ( i = 0 ; i < _DataFlowDataPorts->GetNodeInPortsSize() ; i++ ) {
127 if ( _DataFlowDataPorts->GetNodeInPort(i)->IsPortConnected() ) {
128 cdebug << "OutPort " << _DataFlowDataPorts->GetNodeInPort(i)->PortName()
129 << " of DataFlow " << Name() << " is Connected" << endl ;
132 cdebug << "OutPort " << _DataFlowDataPorts->GetNodeInPort(i)->PortName()
133 << " of DataFlow " << Name() << " is NOT Connected" << endl ;
138 cdebug << "In the DataFlow " << Name() << " " << ierr << " Some Input Data is missing" << endl ;
144 void GraphBase::DataNode::ListDatas(ostream & f ) const {
145 _DataFlowDataPorts->ListPorts( f , false ) ;
148 void GraphBase::DataNode::DataNodeInfo(ostream & s ) const {
150 s << "Ports :" << endl ;
151 ListPorts( s , true ) ;
152 s << "Datas :" << endl ;
153 _DataFlowDataPorts->ListPorts( s , false ) ;
158 //GraphBase::OutPort * GraphBase::DataNode::GetChangeInDataNodePort( const char * DataFlowInPortName ) {
159 // return _DataFlowDataPorts->GetChangeOutPort( DataFlowInPortName ) ;
162 //GraphBase::InPort * GraphBase::DataNode::GetChangeOutDataNodePort( const char * DataFlowOutPortName ) {
163 // return _DataFlowDataPorts->GetChangeInPort( DataFlowOutPortName ) ;