]> SALOME platform Git repositories - modules/superv.git/blob - src/GraphBase/DataFlowBase_DataNode.cxx
Salome HOME
NRI : Merge from V1_2.
[modules/superv.git] / src / GraphBase / DataFlowBase_DataNode.cxx
1 //  SUPERV GraphBase : contains fondamental classes for Services, Input Ports, Output Ports Links and Nodes.
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
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. 
10 // 
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. 
15 // 
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 
19 // 
20 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : DataFlowBase_DataNode.cxx
25 //  Author : Jean Rahuel, CEA
26 //  Module : SUPERV
27 //  $Header:
28
29 using namespace std;
30 #include "DataFlowBase_DataNode.hxx"
31
32 GraphBase::DataNode::DataNode() :
33            InLineNode() {
34   MESSAGE( "GraphBase::DataNode::DataNode" );
35   _Created = false ;
36 }
37
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   _Created = false ;
44 }
45
46 GraphBase::DataNode::DataNode(
47                 CORBA::ORB_ptr ORB ,
48                 SALOME_NamingService* ptrNamingService ,
49                 const SALOME_ModuleCatalog::Service& DataFlowService ,
50                 const char *DataFlowName ,
51                 const SUPERV::KindOfNode DataFlowkind ,
52                 const SUPERV::SDate DataFlowFirstCreation ,
53                 const SUPERV::SDate DataFlowLastModification ,
54                 const char * DataFlowEditorRelease ,
55                 const char * DataFlowAuthor ,
56                 const char * DataFlowComment ) :
57            InLineNode( ORB , ptrNamingService , DataFlowService ,
58                        DataFlowName , DataFlowkind ,
59                        DataFlowFirstCreation , DataFlowLastModification  ,
60                        DataFlowEditorRelease , DataFlowAuthor ,
61                        DataFlowComment , false , 0 , 0) {
62 //  MESSAGE( "GraphBase::DataNode::DataNode" );
63 }
64
65 GraphBase::DataNode::~DataNode() {
66 //  MESSAGE( "GraphBase::DataNode::~DataNode" );
67 }
68
69 void GraphBase::DataNode::DataService(
70                        CORBA::ORB_ptr ORB ,
71                        SALOME_ModuleCatalog::Service aService ,
72                        int * Graph_prof_debug ,
73                        ostream * Graph_fdebug ) {
74 //  cout << "GraphBase::DataNode::DataService : DataFlowPortsOfNode of "
75 //       << aService.ServiceName << endl ;
76 //  DefPortsOfNode( aService , aService.ServiceName ) ;
77   DefPortsOfNode( ORB , aService , NamePtr() , Kind() ,
78 //                  true , false , false , false ,
79                   Graph_prof_debug , Graph_fdebug ) ;
80
81   if ( _Created )
82     delete _DataFlowDataPorts ;
83   SALOME_ModuleCatalog::Service aReversedService ;
84   aReversedService.ServiceName = aService.ServiceName ;
85   aReversedService.ServiceinParameter = aService.ServiceoutParameter ;
86   aReversedService.ServiceoutParameter = aService.ServiceinParameter ;
87   _DataFlowDataPorts = new PortsOfNode() ;
88 //  cout << "GraphBase::DataNode::DataService : Mirrored DataFlowPortsOfNode of "
89 //       << aReversedService.ServiceName << endl ;
90   _DataFlowDataPorts->DefPortsOfNode( ORB , aReversedService , NamePtr() ,
91                                       Kind() ,
92 //                                      true , false , false , false ,
93                                       Graph_prof_debug , Graph_fdebug ) ;
94   _Created = true ;
95 }
96
97 int GraphBase::DataNode::CheckDataServerNodes() const {
98
99   cdebug << "GraphBase::Graph::DataServerNodes ()" << endl;
100
101   int i , ierr = 0 ;
102
103   for ( i = 0 ; i < _DataFlowDataPorts->GetNodeOutPortsSize() ; i++ ) {
104     if ( !_DataFlowDataPorts->GetNodeOutPort(i)->IsDataConnected() ) {
105       cdebug << "InPort " << _DataFlowDataPorts->GetNodeOutPort(i)->PortName()
106              << " of DataFlow " << Name() << " has NO Data." << endl ;
107       ierr++ ;
108     }
109     else {
110       cdebug << "InPort " << _DataFlowDataPorts->GetNodeOutPort(i)->PortName()
111              << " of DataFlow " << Name()  << " has Data : "
112 //           << _DataFlowDataPorts->GetNodeOutPort(i)->Value() << " kind "
113 //           << _DataFlowDataPorts->GetNodeOutPort(i)->Kind()
114              << endl ;
115     }
116   }
117
118   for ( i = 0 ; i < _DataFlowDataPorts->GetNodeInPortsSize() ; i++ ) {
119     if ( !_DataFlowDataPorts->GetNodeInPort(i)->IsConnected() ) {
120       cdebug << "OutPort " << _DataFlowDataPorts->GetNodeInPort(i)->PortName()
121              << " of DataFlow " << Name()  << " has Data " << endl ;
122 //      ierr++ ;
123     }
124     else {
125       cdebug << "OutPort " << _DataFlowDataPorts->GetNodeInPort(i)->PortName()
126              << " of DataFlow " << Name()  << " has NO Data : "
127 //           << _DataFlowDataPorts->GetChangeNodeInPort(i)->GetLink()->Value()
128 //           << " kind "
129 //           << _DataFlowDataPorts->GetChangeNodeInPort(i)->GetLink()->Kind()
130              << endl ;
131       ierr++ ;
132     }
133   }
134
135   if ( ierr ) {
136     cdebug << "Some Input Data missing in the DataFlow " << Name() << endl ;
137   }
138
139   return ierr ;
140 }
141
142 void GraphBase::DataNode::ListDatas(ostrstream & f ) const {
143   _DataFlowDataPorts->ListPorts( f , false ) ;
144 }
145
146 void GraphBase::DataNode::DataNodeInfo(ostrstream & s ) const {
147   int i ;
148   s << *this ;
149   s << "Ports :" << endl ;
150   ListPorts( s , true ) ;
151   s << "Datas :" << endl ;
152   _DataFlowDataPorts->ListPorts( s , false ) ;
153   s << ends ;
154 }
155
156 // inlined :
157 //GraphBase::OutPort * GraphBase::DataNode::GetChangeInDataNodePort( const char * DataFlowInPortName ) {
158 //  return _DataFlowDataPorts->GetChangeOutPort( DataFlowInPortName ) ;
159 //}
160
161 //GraphBase::InPort * GraphBase::DataNode::GetChangeOutDataNodePort( const char * DataFlowOutPortName ) {
162 //  return _DataFlowDataPorts->GetChangeInPort( DataFlowOutPortName ) ;
163 //}
164