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 InLineNode( ORB , ptrNamingService , DataFlowName ) {
42 // MESSAGE( "GraphBase::DataNode::DataNode" );
43 cdebug << "GraphBase::DataNode::DataNode" << endl ;
47 GraphBase::DataNode::DataNode(
49 SALOME_NamingService* ptrNamingService ,
50 const SALOME_ModuleCatalog::Service& DataFlowService ,
51 const char *DataFlowName ,
52 const SUPERV::KindOfNode DataFlowkind ,
53 const SUPERV::SDate DataFlowFirstCreation ,
54 const SUPERV::SDate DataFlowLastModification ,
55 const char * DataFlowEditorRelease ,
56 const char * DataFlowAuthor ,
57 const char * DataFlowComment ) :
58 InLineNode( ORB , ptrNamingService , DataFlowService ,
59 DataFlowName , DataFlowkind ,
60 DataFlowFirstCreation , DataFlowLastModification ,
61 DataFlowEditorRelease , DataFlowAuthor ,
62 DataFlowComment , false , 0 , 0) {
63 // MESSAGE( "GraphBase::DataNode::DataNode" );
66 GraphBase::DataNode::~DataNode() {
67 // MESSAGE( "GraphBase::DataNode::~DataNode" );
70 void GraphBase::DataNode::DataService( CORBA::ORB_ptr ORB ,
71 SALOME_ModuleCatalog::Service aService ,
72 int * Graph_prof_debug ,
73 ofstream * Graph_fdebug ) {
74 cdebug << "GraphBase::DataNode::DataService : DataFlowPortsOfNode of "
75 << aService.ServiceName << endl ;
76 DefPortsOfNode( ORB , aService , NamePtr() , Kind() ,
77 Graph_prof_debug , Graph_fdebug ) ;
80 delete _DataFlowDataPorts ;
81 SALOME_ModuleCatalog::Service aReversedService ;
82 aReversedService.ServiceName = aService.ServiceName ;
83 aReversedService.ServiceinParameter = aService.ServiceoutParameter ;
84 aReversedService.ServiceoutParameter = aService.ServiceinParameter ;
85 _DataFlowDataPorts = new PortsOfNode() ;
86 cdebug << "GraphBase::DataNode::DataService : Mirrored DataFlowPortsOfNode of "
87 << aReversedService.ServiceName << endl ;
88 _DataFlowDataPorts->DefPortsOfNode( ORB , aReversedService , NamePtr() , Kind() ,
89 Graph_prof_debug , Graph_fdebug ) ;
93 int GraphBase::DataNode::CheckDataServerNodes() const {
95 cdebug << "GraphBase::Graph::DataServerNodes ()" << endl;
99 for ( i = 0 ; i < _DataFlowDataPorts->GetNodeOutPortsSize() ; i++ ) {
100 // Not a BUG : Reversed Service of the graph
101 const GraphBase::OutPort * anOutPort = _DataFlowDataPorts->GetNodeOutPort(i) ;
102 // if ( !anOutPort->IsGate() && !anOutPort->IsDataStream() && !anOutPort->IsDataConnected() ) {
103 if ( !anOutPort->IsGate() && !anOutPort->IsDataConnected() ) {
104 cdebug << "InPort " << anOutPort->PortName() << " " << anOutPort->PortType()
105 << " of DataFlow " << Name() << " has NO Data." << endl ;
109 cdebug << "InPort " << anOutPort->PortName() << " " << anOutPort->PortType()
110 << " of DataFlow " << Name() << " has Data : "
111 // << _DataFlowDataPorts->GetNodeOutPort(i)->Value() << " kind "
112 // << _DataFlowDataPorts->GetNodeOutPort(i)->Kind()
117 for ( i = 0 ; i < _DataFlowDataPorts->GetNodeInPortsSize() ; i++ ) {
118 if ( !_DataFlowDataPorts->GetNodeInPort(i)->IsConnected() ) {
119 cdebug << "OutPort " << _DataFlowDataPorts->GetNodeInPort(i)->PortName()
120 << " of DataFlow " << Name() << " has Data " << endl ;
124 cdebug << "OutPort " << _DataFlowDataPorts->GetNodeInPort(i)->PortName()
125 << " of DataFlow " << Name() << " has NO Data : "
126 // << _DataFlowDataPorts->GetChangeNodeInPort(i)->GetLink()->Value()
128 // << _DataFlowDataPorts->GetChangeNodeInPort(i)->GetLink()->Kind()
135 cdebug << "Some Input Data missing in the DataFlow " << Name() << endl ;
141 void GraphBase::DataNode::ListDatas(ostream & f ) const {
142 _DataFlowDataPorts->ListPorts( f , false ) ;
145 void GraphBase::DataNode::DataNodeInfo(ostream & s ) const {
147 s << "Ports :" << endl ;
148 ListPorts( s , true ) ;
149 s << "Datas :" << endl ;
150 _DataFlowDataPorts->ListPorts( s , false ) ;
155 //GraphBase::OutPort * GraphBase::DataNode::GetChangeInDataNodePort( const char * DataFlowInPortName ) {
156 // return _DataFlowDataPorts->GetChangeOutPort( DataFlowInPortName ) ;
159 //GraphBase::InPort * GraphBase::DataNode::GetChangeOutDataNodePort( const char * DataFlowOutPortName ) {
160 // return _DataFlowDataPorts->GetChangeInPort( DataFlowOutPortName ) ;