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.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // File : DataFlowBase_FactoryNode.cxx
23 // Author : Jean Rahuel, CEA
30 #include "DataFlowBase_FactoryNode.hxx"
32 static void InitFields( char * &_ComponentName ,
33 char * &_InterfaceName ,
35 _ComponentName = NULLSTRING ;
36 _InterfaceName = NULLSTRING ;
38 _Computer = FACTORYSERVER ;
41 GraphBase::FactoryNode::FactoryNode() :
42 GraphBase::ComputingNode::ComputingNode() {
44 InitFields( _ComponentName ,
47 _Container = Engines::Container::_nil() ;
48 _ObjComponent = Engines::Component::_nil() ;
49 cdebug << "GraphBase::FactoryNode::FactoryNode " << this
51 << (void *) _ComponentName << " " << _ComponentName << " _Name "
52 << (void *) Name() << " " << Name() << " _Computer "
53 << (void *) _Computer << " " << _Computer << " _Comment "
54 << (void *) Comment() << " " << Comment() << " " << endl ;
58 GraphBase::FactoryNode::FactoryNode( CORBA::ORB_ptr ORB ,
59 SALOME_NamingService* ptrNamingService ,
60 const char * aDataFlowName ,
61 const SUPERV::KindOfNode DataFlowkind ,
62 int * Graph_prof_debug ,
63 ofstream * Graph_fdebug ) :
64 GraphBase::ComputingNode::ComputingNode( ORB , ptrNamingService , aDataFlowName , DataFlowkind ,
65 Graph_prof_debug , Graph_fdebug ) {
67 InitFields( _ComponentName ,
71 _Container = Engines::Container::_nil() ;
72 _ObjComponent = Engines::Component::_nil() ;
74 cdebug << "GraphBase::FactoryNode::FactoryNode " << this
76 << (void *) _ComponentName << " '" << _ComponentName
77 << "' _InterfaceName "
78 << (void *) _InterfaceName << " '" << _InterfaceName << "' _Name "
79 << (void *) Name() << " '" << Name() << "' _Computer "
80 << (void *) _Computer << " " << _Computer << " _Comment "
81 << (void *) Comment() << " " << Comment() << " " << endl ;
84 GraphBase::FactoryNode::FactoryNode( CORBA::ORB_ptr ORB ,
85 SALOME_NamingService * ptrNamingService ,
86 const SALOME_ModuleCatalog::Service& aService ,
87 const char * ComponentName ,
88 const char * InterfaceName ,
89 const char * NodeName ,
90 const SUPERV::KindOfNode akind ,
91 const SUPERV::SDate NodeFirstCreation ,
92 const SUPERV::SDate NodeLastModification ,
93 const char * NodeEditorRelease ,
94 const char * NodeAuthor ,
95 const char * NodeComputer ,
96 const char * NodeComment ,
97 const bool GeneratedName ,
100 int * Graph_prof_debug ,
101 ofstream * Graph_fdebug ) :
102 GraphBase::ComputingNode::ComputingNode( ORB , ptrNamingService , aService ,
104 NodeFirstCreation , NodeLastModification ,
105 NodeEditorRelease , NodeAuthor , NodeComment ,
106 GeneratedName , X , Y ,
107 Graph_prof_debug , Graph_fdebug ) {
109 _Container = Engines::Container::_nil() ;
110 _ObjComponent = Engines::Component::_nil() ;
112 _ComponentName = new char[strlen(ComponentName)+1];
113 strcpy(_ComponentName , ComponentName ) ;
115 _InterfaceName = new char[strlen(InterfaceName)+1];
116 strcpy(_InterfaceName , InterfaceName ) ;
118 if ( NodeComputer != NULLSTRING) {
119 _Computer = new char[ strlen( NodeComputer ) + 1 ] ;
120 strcpy( _Computer , NodeComputer ) ;
123 _Computer = FACTORYSERVER ;
126 cdebug_in << "GraphBase::FactoryNode::FactoryNode( '" << aService.ServiceName << "','"
127 << _ComponentName << "','" << Name() << "'," << akind << ",'" << _Computer << "'" << endl;
129 cdebug << "GraphBase::FactoryNode::FactoryNode " << this
130 << " _ComponentName "
131 << (void *) _ComponentName << " '" << _ComponentName
132 << "' _InterfaceName "
133 << (void *) _InterfaceName << " '" << _InterfaceName << "' _Name "
134 << (void *) Name() << " '" << Name() << "' _Computer "
135 << (void *) _Computer << " " << _Computer << " _Comment "
136 << (void *) Comment() << " '" << Comment() << " "
137 << "' KindOfNode " << Kind()
138 << " ServiceName " << ServiceName() << " In(" << ServiceInParameter().length()
139 << ") Out(" << ServiceOutParameter().length() << ")" << endl ;
141 cdebug_out << "GraphBase::FactoryNode::FactoryNode" << endl;
144 GraphBase::FactoryNode::~FactoryNode() {
145 cdebug << "GraphBase::Node::~Node " << this
147 << (void *) _ComponentName << " " << _ComponentName << " _Name "
148 << (void *) Name() << " " << Name() << " _Computer "
149 << (void *) _Computer << " " << _Computer << " _Comment "
150 << (void *) Comment() << " " << Comment() << " " << endl ;
151 // if ( _ComponentName != NULLSTRING )
152 // delete [] _ComponentName ;
154 // delete [] _EditorRelease ;
155 // if ( _Author != NULLSTRING )
156 // delete [] _Author ;
157 // if ( _Computer != FACTORYSERVER )
158 // delete [] _Computer;
159 // if ( _Comment != NULLSTRING )
160 // delete [] _Comment;
163 bool GraphBase::FactoryNode::ComponentName(const char * aComponentName) {
164 if ( _ComponentName && _ComponentName != NULLSTRING )
165 delete [] _ComponentName ;
166 _ComponentName = new char[strlen(aComponentName)+1] ;
167 strcpy( _ComponentName , aComponentName ) ;
171 bool GraphBase::FactoryNode::InterfaceName(const char * anInterfaceName) {
172 if ( _InterfaceName && _InterfaceName != NULLSTRING )
173 delete [] _InterfaceName ;
174 _InterfaceName = new char[strlen(anInterfaceName)+1] ;
175 strcpy( _InterfaceName , anInterfaceName ) ;
179 bool GraphBase::FactoryNode::Computer(const char *c) {
180 cdebug_in << "GraphBase::FactoryNode::Computer" << endl;
181 if ( _Computer != FACTORYSERVER )
182 delete [] _Computer ;
183 _Computer = my_strdup(c);
184 cdebug << "GraphBase::FactoryNode::Computer('" << _Computer << "')" << endl;
185 cdebug_out << "GraphBase::FactoryNode::Computer" << endl;
189 //bool GraphBase::FactoryNode::SaveXML( ostream &f , char *Tabs ,
190 bool GraphBase::FactoryNode::SaveXML( QDomDocument & Graph , QDomElement & info ,
191 int XCoordinate , int YCoordinate ) const {
192 GraphBase::ListOfFuncName aFuncNames ;
193 GraphBase::ListOfPythonFunctions aVoidList ;
194 // return GraphBase::ComputingNode::SaveXML( f , Tabs , ComponentName() ,
195 return GraphBase::ComputingNode::SaveXML( Graph , info , ComponentName() ,
196 InterfaceName() , Computer() , "" ,
197 aFuncNames , aVoidList ,
198 XCoordinate , YCoordinate ) ;
201 bool GraphBase::FactoryNode::SavePY(ostream &f , const char * aGraphName ,
202 int XCoordinate , int YCoordinate ) const {
203 GraphBase::ListOfFuncName aFuncNames ;
204 GraphBase::ListOfPythonFunctions aVoidList ;
205 return GraphBase::ComputingNode::SavePY( f , aGraphName , ComponentName() ,
206 InterfaceName() , Computer() , NULL ,
207 aFuncNames , aVoidList ,
208 XCoordinate , YCoordinate ) ;