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 time_t T = time(NULL);
22 struct tm * Tm = localtime(&T);
24 _ComponentName = NULLSTRING ;
25 _InterfaceName = NULLSTRING ;
27 _Computer = FACTORYSERVER ;
30 GraphBase::FactoryNode::FactoryNode() :
31 GraphBase::ComputingNode::ComputingNode() {
33 InitFields( _ComponentName ,
36 _Container = Engines::Container::_nil() ;
37 _ObjComponent = Engines::Component::_nil() ;
38 cdebug << "GraphBase::FactoryNode::FactoryNode " << this
40 << (void *) _ComponentName << " " << _ComponentName << " _Name "
41 << (void *) Name() << " " << Name() << " _Computer "
42 << (void *) _Computer << " " << _Computer << " _Comment "
43 << (void *) Comment() << " " << Comment() << " " << endl ;
47 GraphBase::FactoryNode::FactoryNode( CORBA::ORB_ptr ORB ,
48 SALOME_NamingService* ptrNamingService ,
49 const char * aDataFlowName ,
50 int * Graph_prof_debug ,
51 ostream * Graph_fdebug ) :
52 GraphBase::ComputingNode::ComputingNode( ORB , ptrNamingService , aDataFlowName ,
53 Graph_prof_debug , Graph_fdebug ) {
55 InitFields( _ComponentName ,
59 _Container = Engines::Container::_nil() ;
60 _ObjComponent = Engines::Component::_nil() ;
62 cdebug << "GraphBase::FactoryNode::FactoryNode " << this
64 << (void *) _ComponentName << " '" << _ComponentName
65 << "' _InterfaceName "
66 << (void *) _InterfaceName << " '" << _InterfaceName << "' _Name "
67 << (void *) Name() << " '" << Name() << "' _Computer "
68 << (void *) _Computer << " " << _Computer << " _Comment "
69 << (void *) Comment() << " " << Comment() << " " << endl ;
72 GraphBase::FactoryNode::FactoryNode( CORBA::ORB_ptr ORB ,
73 SALOME_NamingService* ptrNamingService ,
74 const SALOME_ModuleCatalog::Service& aService ,
75 const char *ComponentName ,
76 const char* InterfaceName ,
77 const char *NodeName ,
78 const SUPERV::KindOfNode akind ,
79 const SUPERV::SDate NodeFirstCreation ,
80 const SUPERV::SDate NodeLastModification ,
81 const char * NodeEditorRelease ,
82 const char * NodeAuthor ,
83 const char * NodeComputer ,
84 const char * NodeComment ,
85 const bool GeneratedName ,
88 int * Graph_prof_debug ,
89 ostream * Graph_fdebug ) :
90 GraphBase::ComputingNode::ComputingNode( ORB , ptrNamingService , aService ,
92 NodeFirstCreation , NodeLastModification ,
93 NodeEditorRelease , NodeAuthor , NodeComment ,
94 GeneratedName , X , Y ,
95 Graph_prof_debug , Graph_fdebug ) {
97 _Container = Engines::Container::_nil() ;
98 _ObjComponent = Engines::Component::_nil() ;
100 _ComponentName = new char[strlen(ComponentName)+1];
101 strcpy(_ComponentName , ComponentName ) ;
103 _InterfaceName = new char[strlen(InterfaceName)+1];
104 strcpy(_InterfaceName , InterfaceName ) ;
106 if ( NodeComputer ) {
107 _Computer = new char[ strlen( NodeComputer ) + 1 ] ;
108 strcpy( _Computer , NodeComputer ) ;
111 _Computer = FACTORYSERVER ;
113 cdebug_in << "GraphBase::FactoryNode::FactoryNode(" << aService.ServiceName << ","
114 << ComponentName << "," << Name() << "," << akind
115 << "," << NodeComputer << "," << Comment() << ")" << endl;
117 cdebug << "GraphBase::FactoryNode::FactoryNode " << this
118 << " _ComponentName "
119 << (void *) _ComponentName << " '" << _ComponentName
120 << "' _InterfaceName "
121 << (void *) _InterfaceName << " '" << _InterfaceName << "' _Name "
122 << (void *) Name() << " '" << Name() << "' _Computer "
123 << (void *) _Computer << " " << _Computer << " _Comment "
124 << (void *) Comment() << " " << Comment() << " "
125 << " KindOfNode " << Kind()
126 << " ServiceName " << ServiceName() << " In(" << ServiceInParameter().length()
127 << ") Out(" << ServiceOutParameter().length() << ")" << endl ;
129 cdebug_out << "GraphBase::FactoryNode::FactoryNode" << endl;
132 GraphBase::FactoryNode::~FactoryNode() {
133 cdebug << "GraphBase::Node::~Node " << this
135 << (void *) _ComponentName << " " << _ComponentName << " _Name "
136 << (void *) Name() << " " << Name() << " _Computer "
137 << (void *) _Computer << " " << _Computer << " _Comment "
138 << (void *) Comment() << " " << Comment() << " " << endl ;
139 // if ( _ComponentName != NULLSTRING )
140 // delete [] _ComponentName ;
142 // delete [] _EditorRelease ;
143 // if ( _Author != NULLSTRING )
144 // delete [] _Author ;
145 // if ( _Computer != FACTORYSERVER )
146 // delete [] _Computer;
147 // if ( _Comment != NULLSTRING )
148 // delete [] _Comment;
151 bool GraphBase::FactoryNode::ComponentName(const char * aComponentName) {
152 if ( _ComponentName && _ComponentName != NULLSTRING )
153 delete [] _ComponentName ;
154 _ComponentName = new char[strlen(aComponentName)+1] ;
155 strcpy( _ComponentName , aComponentName ) ;
159 bool GraphBase::FactoryNode::InterfaceName(const char * anInterfaceName) {
160 if ( _InterfaceName && _InterfaceName != NULLSTRING )
161 delete [] _InterfaceName ;
162 _InterfaceName = new char[strlen(anInterfaceName)+1] ;
163 strcpy( _InterfaceName , anInterfaceName ) ;
167 bool GraphBase::FactoryNode::Computer(const char *c) {
168 cdebug_in << "GraphBase::FactoryNode::Computer" << endl;
169 if ( _Computer != FACTORYSERVER )
170 delete [] _Computer ;
171 _Computer = my_strdup(c);
172 cdebug_in << "GraphBase::FactoryNode::Computer('" << _Computer << "')" << endl;
173 cdebug_out << "GraphBase::FactoryNode::Computer" << endl;
177 //bool GraphBase::FactoryNode::SaveXML( ostream &f , char *Tabs ,
178 bool GraphBase::FactoryNode::SaveXML( QDomDocument & Graph , QDomElement & info ,
179 int XCoordinate , int YCoordinate ) const {
180 GraphBase::ListOfFuncName aFuncNames ;
181 GraphBase::ListOfPythonFunctions aVoidList ;
182 // return GraphBase::ComputingNode::SaveXML( f , Tabs , ComponentName() ,
183 return GraphBase::ComputingNode::SaveXML( Graph , info , ComponentName() ,
184 InterfaceName() , Computer() , "" ,
185 aFuncNames , aVoidList ,
186 XCoordinate , YCoordinate ) ;
189 bool GraphBase::FactoryNode::SavePY(ostream &f , const char * aGraphName ,
190 int XCoordinate , int YCoordinate ) const {
191 GraphBase::ListOfFuncName aFuncNames ;
192 GraphBase::ListOfPythonFunctions aVoidList ;
193 return GraphBase::ComputingNode::SavePY( f , aGraphName , ComponentName() ,
194 InterfaceName() , Computer() , NULL ,
195 aFuncNames , aVoidList ,
196 XCoordinate , YCoordinate ) ;