2 //=============================================================================
3 // File : DataFlowBase_FactoryNode.cxx
5 // Author : Jean Rahuel, CEA
8 //=============================================================================
13 #include "DataFlowBase_FactoryNode.hxx"
15 static void InitFields( char * &_ComponentName ,
16 char * &_InterfaceName ,
18 time_t T = time(NULL);
19 struct tm * Tm = localtime(&T);
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 int * Graph_prof_debug ,
48 ostream * Graph_fdebug ) :
49 GraphBase::ComputingNode::ComputingNode( ORB , ptrNamingService , aDataFlowName ,
50 Graph_prof_debug , Graph_fdebug ) {
52 InitFields( _ComponentName ,
56 _Container = Engines::Container::_nil() ;
57 _ObjComponent = Engines::Component::_nil() ;
59 cdebug << "GraphBase::FactoryNode::FactoryNode " << this
61 << (void *) _ComponentName << " '" << _ComponentName
62 << "' _InterfaceName "
63 << (void *) _InterfaceName << " '" << _InterfaceName << "' _Name "
64 << (void *) Name() << " '" << Name() << "' _Computer "
65 << (void *) _Computer << " " << _Computer << " _Comment "
66 << (void *) Comment() << " " << Comment() << " " << endl ;
69 GraphBase::FactoryNode::FactoryNode( CORBA::ORB_ptr ORB ,
70 SALOME_NamingService* ptrNamingService ,
71 const SALOME_ModuleCatalog::Service& aService ,
72 const char *ComponentName ,
73 const char* InterfaceName ,
74 const char *NodeName ,
75 const SUPERV::KindOfNode akind ,
76 const SUPERV::SDate NodeFirstCreation ,
77 const SUPERV::SDate NodeLastModification ,
78 const char * NodeEditorRelease ,
79 const char * NodeAuthor ,
80 const char * NodeComputer ,
81 const char * NodeComment ,
82 const bool GeneratedName ,
85 int * Graph_prof_debug ,
86 ostream * Graph_fdebug ) :
87 GraphBase::ComputingNode::ComputingNode( ORB , ptrNamingService , aService ,
89 NodeFirstCreation , NodeLastModification ,
90 NodeEditorRelease , NodeAuthor , NodeComment ,
91 GeneratedName , X , Y ,
92 Graph_prof_debug , Graph_fdebug ) {
94 _Container = Engines::Container::_nil() ;
95 _ObjComponent = Engines::Component::_nil() ;
97 _ComponentName = new char[strlen(ComponentName)+1];
98 strcpy(_ComponentName , ComponentName ) ;
100 _InterfaceName = new char[strlen(InterfaceName)+1];
101 strcpy(_InterfaceName , InterfaceName ) ;
103 if ( NodeComputer ) {
104 _Computer = new char[ strlen( NodeComputer ) + 1 ] ;
105 strcpy( _Computer , NodeComputer ) ;
108 _Computer = FACTORYSERVER ;
110 cdebug_in << "GraphBase::FactoryNode::FactoryNode(" << aService.ServiceName << ","
111 << ComponentName << "," << Name() << "," << akind
112 << "," << NodeComputer << "," << Comment() << ")" << endl;
114 cdebug << "GraphBase::FactoryNode::FactoryNode " << this
115 << " _ComponentName "
116 << (void *) _ComponentName << " '" << _ComponentName
117 << "' _InterfaceName "
118 << (void *) _InterfaceName << " '" << _InterfaceName << "' _Name "
119 << (void *) Name() << " '" << Name() << "' _Computer "
120 << (void *) _Computer << " " << _Computer << " _Comment "
121 << (void *) Comment() << " " << Comment() << " "
122 << " KindOfNode " << Kind()
123 << " ServiceName " << ServiceName() << " In(" << ServiceInParameter().length()
124 << ") Out(" << ServiceOutParameter().length() << ")" << endl ;
126 cdebug_out << "GraphBase::FactoryNode::FactoryNode" << endl;
129 GraphBase::FactoryNode::~FactoryNode() {
130 cdebug << "GraphBase::Node::~Node " << this
132 << (void *) _ComponentName << " " << _ComponentName << " _Name "
133 << (void *) Name() << " " << Name() << " _Computer "
134 << (void *) _Computer << " " << _Computer << " _Comment "
135 << (void *) Comment() << " " << Comment() << " " << endl ;
136 // if ( _ComponentName != NULLSTRING )
137 // delete [] _ComponentName ;
139 // delete [] _EditorRelease ;
140 // if ( _Author != NULLSTRING )
141 // delete [] _Author ;
142 // if ( _Computer != FACTORYSERVER )
143 // delete [] _Computer;
144 // if ( _Comment != NULLSTRING )
145 // delete [] _Comment;
148 bool GraphBase::FactoryNode::ComponentName(const char * aComponentName) {
149 if ( _ComponentName && _ComponentName != NULLSTRING )
150 delete [] _ComponentName ;
151 _ComponentName = new char[strlen(aComponentName)+1] ;
152 strcpy( _ComponentName , aComponentName ) ;
156 bool GraphBase::FactoryNode::InterfaceName(const char * anInterfaceName) {
157 if ( _InterfaceName && _InterfaceName != NULLSTRING )
158 delete [] _InterfaceName ;
159 _InterfaceName = new char[strlen(anInterfaceName)+1] ;
160 strcpy( _InterfaceName , anInterfaceName ) ;
164 bool GraphBase::FactoryNode::Computer(const char *c) {
165 cdebug_in << "GraphBase::FactoryNode::Computer" << endl;
166 if ( _Computer != FACTORYSERVER )
167 delete [] _Computer ;
168 _Computer = my_strdup(c);
169 cdebug_out << "GraphBase::FactoryNode::Computer" << endl;
173 //bool GraphBase::FactoryNode::SaveXML( ostream &f , char *Tabs ,
174 bool GraphBase::FactoryNode::SaveXML( QDomDocument & Graph , QDomElement & info ,
175 int XCoordinate , int YCoordinate ) const {
176 GraphBase::ListOfFuncName aFuncNames ;
177 GraphBase::ListOfPythonFunctions aVoidList ;
178 // return GraphBase::ComputingNode::SaveXML( f , Tabs , ComponentName() ,
179 return GraphBase::ComputingNode::SaveXML( Graph , info , ComponentName() ,
180 InterfaceName() , Computer() , "" ,
181 aFuncNames , aVoidList ,
182 XCoordinate , YCoordinate ) ;
185 bool GraphBase::FactoryNode::SavePY(ostream &f , const char * aGraphName ,
186 int XCoordinate , int YCoordinate ) const {
187 GraphBase::ListOfFuncName aFuncNames ;
188 GraphBase::ListOfPythonFunctions aVoidList ;
189 return GraphBase::ComputingNode::SavePY( f , aGraphName , ComponentName() ,
190 InterfaceName() , Computer() , NULL ,
191 aFuncNames , aVoidList ,
192 XCoordinate , YCoordinate ) ;