1 // SUPERV GraphBase : contains fondamental classes for Services, Input Ports, Output Ports Links and Nodes.
3 // Copyright (C) 2003 CEA/DEN, EDF R&D
7 // File : DataFlowBase_FactoryNode.cxx
8 // Author : Jean Rahuel, CEA
16 #include "DataFlowBase_FactoryNode.hxx"
18 static void InitFields( char * &_ComponentName ,
19 char * &_InterfaceName ,
21 _ComponentName = NULLSTRING ;
22 _InterfaceName = NULLSTRING ;
24 _Computer = FACTORYSERVER ;
27 GraphBase::FactoryNode::FactoryNode() :
28 GraphBase::ComputingNode::ComputingNode() {
30 InitFields( _ComponentName ,
33 _Container = Engines::Container::_nil() ;
34 _ObjComponent = Engines::Component::_nil() ;
35 cdebug << "GraphBase::FactoryNode::FactoryNode " << this
37 << (void *) _ComponentName << " " << _ComponentName << " _Name "
38 << (void *) Name() << " " << Name() << " _Computer "
39 << (void *) _Computer << " " << _Computer << " _Comment "
40 << (void *) Comment() << " " << Comment() << " " << endl ;
44 GraphBase::FactoryNode::FactoryNode( CORBA::ORB_ptr ORB ,
45 SALOME_NamingService* ptrNamingService ,
46 const char * aDataFlowName ,
47 const SUPERV::KindOfNode DataFlowkind ,
48 int * Graph_prof_debug ,
49 ofstream * Graph_fdebug ) :
50 GraphBase::ComputingNode::ComputingNode( ORB , ptrNamingService , aDataFlowName , DataFlowkind ,
51 Graph_prof_debug , Graph_fdebug ) {
53 InitFields( _ComponentName ,
57 _Container = Engines::Container::_nil() ;
58 _ObjComponent = Engines::Component::_nil() ;
60 cdebug << "GraphBase::FactoryNode::FactoryNode " << this
62 << (void *) _ComponentName << " '" << _ComponentName
63 << "' _InterfaceName "
64 << (void *) _InterfaceName << " '" << _InterfaceName << "' _Name "
65 << (void *) Name() << " '" << Name() << "' _Computer "
66 << (void *) _Computer << " " << _Computer << " _Comment "
67 << (void *) Comment() << " " << Comment() << " " << endl ;
70 GraphBase::FactoryNode::FactoryNode( CORBA::ORB_ptr ORB ,
71 SALOME_NamingService * ptrNamingService ,
72 const SALOME_ModuleCatalog::Service& aService ,
73 const char * ComponentName ,
74 const char * InterfaceName ,
75 const char * NodeName ,
76 const SUPERV::KindOfNode akind ,
77 const SUPERV::SDate NodeFirstCreation ,
78 const SUPERV::SDate NodeLastModification ,
79 const char * NodeEditorRelease ,
80 const char * NodeAuthor ,
81 const char * NodeComputer ,
82 const char * NodeComment ,
83 const bool GeneratedName ,
86 int * Graph_prof_debug ,
87 ofstream * Graph_fdebug ) :
88 GraphBase::ComputingNode::ComputingNode( ORB , ptrNamingService , aService ,
90 NodeFirstCreation , NodeLastModification ,
91 NodeEditorRelease , NodeAuthor , NodeComment ,
92 GeneratedName , X , Y ,
93 Graph_prof_debug , Graph_fdebug ) {
95 _Container = Engines::Container::_nil() ;
96 _ObjComponent = Engines::Component::_nil() ;
98 _ComponentName = new char[strlen(ComponentName)+1];
99 strcpy(_ComponentName , ComponentName ) ;
101 _InterfaceName = new char[strlen(InterfaceName)+1];
102 strcpy(_InterfaceName , InterfaceName ) ;
104 if ( NodeComputer != NULLSTRING) {
105 _Computer = new char[ strlen( NodeComputer ) + 1 ] ;
106 strcpy( _Computer , NodeComputer ) ;
109 _Computer = FACTORYSERVER ;
112 cdebug_in << "GraphBase::FactoryNode::FactoryNode( '" << aService.ServiceName << "','"
113 << _ComponentName << "','" << Name() << "'," << akind << ",'" << _Computer << "'" << endl;
115 cdebug << "GraphBase::FactoryNode::FactoryNode " << this
116 << " _ComponentName "
117 << (void *) _ComponentName << " '" << _ComponentName
118 << "' _InterfaceName "
119 << (void *) _InterfaceName << " '" << _InterfaceName << "' _Name "
120 << (void *) Name() << " '" << Name() << "' _Computer "
121 << (void *) _Computer << " " << _Computer << " _Comment "
122 << (void *) Comment() << " '" << Comment() << " "
123 << "' KindOfNode " << Kind()
124 << " ServiceName " << ServiceName() << " In(" << ServiceInParameter().length()
125 << ") Out(" << ServiceOutParameter().length() << ")" << endl ;
127 cdebug_out << "GraphBase::FactoryNode::FactoryNode" << endl;
130 GraphBase::FactoryNode::~FactoryNode() {
131 cdebug << "GraphBase::Node::~Node " << this
133 << (void *) _ComponentName << " " << _ComponentName << " _Name "
134 << (void *) Name() << " " << Name() << " _Computer "
135 << (void *) _Computer << " " << _Computer << " _Comment "
136 << (void *) Comment() << " " << Comment() << " " << endl ;
137 // if ( _ComponentName != NULLSTRING )
138 // delete [] _ComponentName ;
140 // delete [] _EditorRelease ;
141 // if ( _Author != NULLSTRING )
142 // delete [] _Author ;
143 // if ( _Computer != FACTORYSERVER )
144 // delete [] _Computer;
145 // if ( _Comment != NULLSTRING )
146 // delete [] _Comment;
149 bool GraphBase::FactoryNode::ComponentName(const char * aComponentName) {
150 if ( _ComponentName && _ComponentName != NULLSTRING )
151 delete [] _ComponentName ;
152 _ComponentName = new char[strlen(aComponentName)+1] ;
153 strcpy( _ComponentName , aComponentName ) ;
157 bool GraphBase::FactoryNode::InterfaceName(const char * anInterfaceName) {
158 if ( _InterfaceName && _InterfaceName != NULLSTRING )
159 delete [] _InterfaceName ;
160 _InterfaceName = new char[strlen(anInterfaceName)+1] ;
161 strcpy( _InterfaceName , anInterfaceName ) ;
165 bool GraphBase::FactoryNode::Computer(const char *c) {
166 cdebug_in << "GraphBase::FactoryNode::Computer" << endl;
167 if ( _Computer != FACTORYSERVER )
168 delete [] _Computer ;
169 _Computer = my_strdup(c);
170 cdebug << "GraphBase::FactoryNode::Computer('" << _Computer << "')" << endl;
171 cdebug_out << "GraphBase::FactoryNode::Computer" << endl;
175 //bool GraphBase::FactoryNode::SaveXML( ostream &f , char *Tabs ,
176 bool GraphBase::FactoryNode::SaveXML( QDomDocument & Graph , QDomElement & info ,
177 int XCoordinate , int YCoordinate ) const {
178 GraphBase::ListOfFuncName aFuncNames ;
179 GraphBase::ListOfPythonFunctions aVoidList ;
180 // return GraphBase::ComputingNode::SaveXML( f , Tabs , ComponentName() ,
181 return GraphBase::ComputingNode::SaveXML( Graph , info , ComponentName() ,
182 InterfaceName() , Computer() , "" ,
183 aFuncNames , aVoidList ,
184 XCoordinate , YCoordinate ) ;
187 bool GraphBase::FactoryNode::SavePY(ostream &f , const char * aGraphName ,
188 int XCoordinate , int YCoordinate ) const {
189 GraphBase::ListOfFuncName aFuncNames ;
190 GraphBase::ListOfPythonFunctions aVoidList ;
191 return GraphBase::ComputingNode::SavePY( f , aGraphName , ComponentName() ,
192 InterfaceName() , Computer() , NULL ,
193 aFuncNames , aVoidList ,
194 XCoordinate , YCoordinate ) ;