Salome HOME
*** empty log message ***
[modules/superv.git] / src / GraphEditor / DataFlowEditor_InNode.cxx
1 //  SUPERV GraphEditor : contains classes that permit edition of graphs
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   : DataFlowEditor_InNode.cxx
25 //  Module : SUPERV
26
27 using namespace std;
28 //#include <string.h>
29 //#include <sstream>
30 //#include <iostream>
31
32 #include "DataFlowEditor_InNode.hxx"
33
34 GraphEditor::InNode::InNode() {
35 }
36
37 //ostream * fdebug = NULL ;
38 GraphEditor::InNode::InNode( CORBA::ORB_ptr ORB, 
39                              SALOME_NamingService * ptrNamingService ,
40                              GraphBase::ListOfFuncName aFuncName ,
41                              GraphBase::ListOfPythonFunctions aPythonFunction ,
42                              const SALOME_ModuleCatalog::Service& aService ,
43                              const char * ComponentName ,
44                              const char * NodeInterfaceName ,
45                              const char * NodeName ,
46                              const SUPERV::KindOfNode akind ,
47                              const SUPERV::SDate NodeFirstCreation ,
48                              const SUPERV::SDate NodeLastModification  ,
49                              const char * NodeEditorRelease ,
50                              const char * NodeAuthor ,
51                              const char * NodeComputer ,
52                              const char * NodeComment ,
53                              const bool   GeneratedName ,
54                              const int X ,
55                              const int Y ,
56                              int * Graph_prof_debug,
57                              ofstream * Graph_fdebug) {
58   SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ;
59 //  cout << "GraphEditor::InNode::InNode GraphBase::Base::_fdebug " << GraphBase::Base::_fdebug << endl ;
60   cdebug_in << "GraphEditor::InNode::InNode" << endl ;
61 //  if ( GraphBase::Base::_fdebug )
62 //    *GraphBase::Base::_fdebug << endl << "xxx-->" << " " << "GraphEditor::InNode::InNode" << endl ;
63 //  if ( fdebug )
64 //    (*fdebug) << endl << "xxxxxx-->" << " " << "GraphEditor::InNode::InNode" << endl ;
65 //  cout << "GraphEditor::InNode::InNode GraphBase::Base::_fdebug " << GraphBase::Base::_fdebug << endl ;
66   _ComputingNode = NULL ;
67   _FactoryNode = NULL ;
68   _InLineNode = NULL ;
69   _GOTONode = NULL ;
70   _LoopNode = NULL ;
71   _EndOfLoopNode = NULL ;
72   _SwitchNode = NULL ;
73   _EndOfSwitchNode = NULL ;
74   switch ( akind ) {
75   case SUPERV::ComputingNode : {
76     cdebug << "GraphEditor::InNode::InNode SUPERV::ComputingNode : " << NodeName << endl ;
77     _ComputingNode = new GraphBase::ComputingNode( ORB , ptrNamingService , aService ,
78                                                    NodeName , akind ,
79                                                    NodeFirstCreation ,
80                                                    NodeLastModification  ,
81                                                    NodeEditorRelease , NodeAuthor ,
82                                                    NodeComment , GeneratedName ,
83                                                    X , Y ,
84                                                    Graph_prof_debug , Graph_fdebug ) ;
85     break ;
86   }
87   case SUPERV::FactoryNode : {
88 //    cout << "GraphEditor::InNode::InNode SUPERV::FactoryNode : " << NodeName << endl ;
89     cdebug << "GraphEditor::InNode::InNode SUPERV::FactoryNode : " << NodeName << endl ;
90     _FactoryNode = new GraphBase::FactoryNode( ORB , ptrNamingService , aService ,
91                                                ComponentName , NodeInterfaceName ,
92                                                NodeName , akind ,
93                                                NodeFirstCreation ,
94                                                NodeLastModification  ,
95                                                NodeEditorRelease , NodeAuthor ,
96                                                NodeComputer , NodeComment ,
97                                                GeneratedName , X , Y ,
98                                                Graph_prof_debug , Graph_fdebug ) ;
99 //    cout << "GraphEditor::InNode::InNode SUPERV::FactoryNode : " << NodeName << endl ;
100     _ComputingNode = (GraphBase::ComputingNode *) _FactoryNode ;
101     break ;
102   }
103   case SUPERV::InLineNode : {
104     cdebug << "GraphEditor::InNode::InNode SUPERV::InLineNode : " << NodeName << endl ;
105     _InLineNode = new GraphBase::InLineNode( ORB , ptrNamingService ,
106                                              aFuncName[0].c_str() , *aPythonFunction[0] ,
107                                              NodeName , akind ,
108                                              NodeFirstCreation , NodeLastModification  ,
109                                              NodeEditorRelease , NodeAuthor ,
110                                              NodeComment , GeneratedName ,
111                                              X , Y ,
112                                              Graph_prof_debug , Graph_fdebug ) ;
113     _ComputingNode = (GraphBase::ComputingNode *) _InLineNode ;
114     break ;
115   }
116   case SUPERV::GOTONode : {
117     cdebug << "GraphEditor::InNode::InNode SUPERV::GOTONode : " << NodeName << endl ;
118     _GOTONode = new GraphBase::GOTONode( ORB , ptrNamingService ,
119                                          aFuncName[0].c_str() , *aPythonFunction[0] ,
120                                          NodeName , akind ,
121                                          NodeFirstCreation , NodeLastModification  ,
122                                          NodeEditorRelease , NodeAuthor ,
123                                          NodeComment , GeneratedName ,
124                                          X , Y ,
125                                          Graph_prof_debug , Graph_fdebug ) ;
126     _ComputingNode = (GraphBase::ComputingNode *) _GOTONode ;
127     _InLineNode = (GraphBase::InLineNode *) _ComputingNode ;
128     break ;
129   }
130   case SUPERV::LoopNode : {
131     cdebug << "GraphEditor::InNode::InNode SUPERV::LoopNode : " << NodeName << endl ;
132     _LoopNode = new GraphBase::LoopNode( ORB , ptrNamingService ,
133                                          aFuncName[0].c_str() , *aPythonFunction[0] ,
134                                          aFuncName[1].c_str() , *aPythonFunction[1] ,
135                                          aFuncName[2].c_str() , *aPythonFunction[2] ,
136                                          NodeName , akind ,
137                                          NodeFirstCreation , NodeLastModification  ,
138                                          NodeEditorRelease , NodeAuthor ,
139                                          NodeComment , GeneratedName ,
140                                          X , Y ,
141                                          Graph_prof_debug , Graph_fdebug ) ;
142     _ComputingNode = (GraphBase::ComputingNode *) _LoopNode ;
143     _GOTONode = (GraphBase::GOTONode *) _ComputingNode ;
144     _InLineNode = (GraphBase::InLineNode *) _ComputingNode ;
145     break ;
146   }
147   case SUPERV::EndLoopNode : {
148     cdebug << "GraphEditor::InNode::InNode SUPERV::EndOfLoopNode : " << NodeName << endl ;
149     _EndOfLoopNode = new GraphBase::EndOfLoopNode(
150                                          ORB , ptrNamingService ,
151                                          aFuncName[0].c_str() , *aPythonFunction[0] ,
152                                          NodeName , akind ,
153                                          NodeFirstCreation , NodeLastModification  ,
154                                          NodeEditorRelease , NodeAuthor ,
155                                          NodeComment , GeneratedName ,
156                                          X , Y ,
157                                          Graph_prof_debug , Graph_fdebug ) ;
158     _ComputingNode = (GraphBase::ComputingNode *) _EndOfLoopNode ;
159     _GOTONode = (GraphBase::GOTONode *) _ComputingNode ;
160     _InLineNode = (GraphBase::InLineNode *) _ComputingNode ;
161     break ;
162   }
163   case SUPERV::SwitchNode : {
164     cdebug << "GraphEditor::InNode::InNode SUPERV::SwitchNode : " << NodeName << endl ;
165     _SwitchNode = new GraphBase::SwitchNode( ORB , ptrNamingService ,
166                                              aFuncName[0].c_str() , *aPythonFunction[0] ,
167                                              NodeName , akind ,
168                                              NodeFirstCreation , NodeLastModification  ,
169                                              NodeEditorRelease , NodeAuthor ,
170                                              NodeComment , GeneratedName ,
171                                              X , Y ,
172                                              Graph_prof_debug , Graph_fdebug ) ;
173     _ComputingNode = (GraphBase::ComputingNode *) _SwitchNode ;
174     _GOTONode = (GraphBase::GOTONode *) _ComputingNode ;
175     _InLineNode = (GraphBase::InLineNode *) _ComputingNode ;
176     break ;
177   }
178   case SUPERV::EndSwitchNode : {
179     cdebug << "GraphEditor::InNode::InNode SUPERV::EndOfSwitchNode : " << NodeName << endl ;
180     _EndOfSwitchNode = new GraphBase::EndOfSwitchNode(
181                                              ORB , ptrNamingService ,
182                                              aFuncName[0].c_str() , *aPythonFunction[0] ,
183                                              NodeName , akind ,
184                                              NodeFirstCreation , NodeLastModification  ,
185                                              NodeEditorRelease , NodeAuthor ,
186                                              NodeComment , GeneratedName ,
187                                              X , Y ,
188                                              Graph_prof_debug , Graph_fdebug ) ;
189     _ComputingNode = (GraphBase::ComputingNode *) _EndOfSwitchNode ;
190     _GOTONode = (GraphBase::GOTONode *) _ComputingNode ;
191     _InLineNode = (GraphBase::InLineNode *) _ComputingNode ;
192     break ;
193   }
194   case SUPERV::DataFlowNode : {
195     cdebug << "GraphEditor::InNode::InNode ERROR SUPERV::DataFlowNode : " << NodeName << endl ;
196   }
197   case SUPERV::UnknownNode : {
198     cdebug << "GraphEditor::InNode::InNode ERROR SUPERV::UnknownNode : " << NodeName << endl ;
199   }
200   }
201   _ComputingNode->InNode( this ) ;
202   cdebug_out << "GraphEditor::InNode::InNode " << (void *) this
203              << " _ComputingNode " << (void *) _ComputingNode  << endl ;
204 }
205
206 GraphEditor::InNode::~InNode() {
207 }
208