Salome HOME
f5eb187b6e01f024b860aedc38e5238ea092dd14
[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.salome-platform.org/ or email : webmaster.salome@opencascade.com
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 #if 0
38 GraphEditor::InNode::InNode(GraphBase::GOTONode * aGOTONode ) {
39   _ComputingNode = aGOTONode ;
40   _GOTONode = aGOTONode ;
41 }
42 #endif
43
44 //ostream * fdebug = NULL ;
45 GraphEditor::InNode::InNode( CORBA::ORB_ptr ORB, 
46                              SALOME_NamingService * ptrNamingService ,
47                              GraphBase::ListOfFuncName aFuncName ,
48                              GraphBase::ListOfPythonFunctions aPythonFunction ,
49                              const SALOME_ModuleCatalog::Service& aService ,
50                              const char * ComponentName ,
51                              const char * NodeInterfaceName ,
52                              const char * NodeName ,
53                              const SUPERV::KindOfNode akind ,
54                              const SUPERV::SDate NodeFirstCreation ,
55                              const SUPERV::SDate NodeLastModification  ,
56                              const char * NodeEditorRelease ,
57                              const char * NodeAuthor ,
58                              const char * NodeComputer ,
59                              const char * NodeComment ,
60                              const bool   GeneratedName ,
61                              const int NodeX ,
62                              const int NodeY ,
63                              int * Graph_prof_debug,
64                              ofstream * Graph_fdebug) {
65   SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ;
66 //  cout << "GraphEditor::InNode::InNode GraphBase::Base::_fdebug " << GraphBase::Base::_fdebug << endl ;
67   cdebug_in << "GraphEditor::InNode::InNode" << endl ;
68 //  if ( GraphBase::Base::_fdebug )
69 //    *GraphBase::Base::_fdebug << endl << "xxx-->" << " " << "GraphEditor::InNode::InNode" << endl ;
70 //  if ( fdebug )
71 //    (*fdebug) << endl << "xxxxxx-->" << " " << "GraphEditor::InNode::InNode" << endl ;
72 //  cout << "GraphEditor::InNode::InNode GraphBase::Base::_fdebug " << GraphBase::Base::_fdebug << endl ;
73   _ComputingNode = NULL ;
74   _FactoryNode = NULL ;
75   _InLineNode = NULL ;
76   _GOTONode = NULL ;
77   _LoopNode = NULL ;
78   _EndOfLoopNode = NULL ;
79   _SwitchNode = NULL ;
80   _EndOfSwitchNode = NULL ;
81   switch ( akind ) {
82   case SUPERV::ComputingNode : {
83     cdebug << "GraphEditor::InNode::InNode SUPERV::ComputingNode : " << NodeName << endl ;
84     _ComputingNode = new GraphBase::ComputingNode( ORB , ptrNamingService , aService ,
85                                                    NodeName , akind ,
86                                                    NodeFirstCreation ,
87                                                    NodeLastModification  ,
88                                                    NodeEditorRelease , NodeAuthor ,
89                                                    NodeComment , GeneratedName ,
90                                                    NodeX , NodeY ,
91                                                    Graph_prof_debug , Graph_fdebug ) ;
92     break ;
93   }
94   case SUPERV::FactoryNode : {
95 //    cout << "GraphEditor::InNode::InNode SUPERV::FactoryNode : " << NodeName << endl ;
96     cdebug << "GraphEditor::InNode::InNode SUPERV::FactoryNode : " << NodeName << endl ;
97     _FactoryNode = new GraphBase::FactoryNode( ORB , ptrNamingService , aService ,
98                                                ComponentName , NodeInterfaceName ,
99                                                NodeName , akind ,
100                                                NodeFirstCreation ,
101                                                NodeLastModification  ,
102                                                NodeEditorRelease , NodeAuthor ,
103                                                NodeComputer , NodeComment ,
104                                                GeneratedName , NodeX , NodeY ,
105                                                Graph_prof_debug , Graph_fdebug ) ;
106 //    cout << "GraphEditor::InNode::InNode SUPERV::FactoryNode : " << NodeName << endl ;
107     _ComputingNode = (GraphBase::ComputingNode *) _FactoryNode ;
108     break ;
109   }
110   case SUPERV::InLineNode : {
111     cdebug << "GraphEditor::InNode::InNode SUPERV::InLineNode : " << NodeName << endl ;
112     _InLineNode = new GraphBase::InLineNode( ORB , ptrNamingService ,
113                                              aFuncName[0].c_str() , *aPythonFunction[0] ,
114                                              NodeName , akind ,
115                                              NodeFirstCreation , NodeLastModification  ,
116                                              NodeEditorRelease , NodeAuthor ,
117                                              NodeComment , GeneratedName ,
118                                              NodeX , NodeY ,
119                                              Graph_prof_debug , Graph_fdebug ) ;
120     _ComputingNode = (GraphBase::ComputingNode *) _InLineNode ;
121     break ;
122   }
123   case SUPERV::MacroNode : {
124     cdebug << "GraphEditor::InNode::InNode SUPERV::MacroNode : " << NodeName << endl ;
125     _GraphMacroNode = new GraphBase::Graph( ORB , ptrNamingService ,
126 //                                            aFuncName[0].c_str() , *aPythonFunction[0] ,
127                                             NodeName ,
128                                             akind ,
129 //                                            NodeFirstCreation , NodeLastModification  ,
130 //                                            NodeEditorRelease , NodeAuthor ,
131 //                                            NodeComment , GeneratedName ,
132 //                                            NodeX , NodeY ,
133                                             Graph_prof_debug , Graph_fdebug ) ;
134     _ComputingNode = (GraphBase::ComputingNode *) _GraphMacroNode ;
135     _InLineNode = (GraphBase::InLineNode *) _ComputingNode ;
136     _GOTONode = (GraphBase::GOTONode *) _InLineNode ;
137     _GraphMacroNode->Coordinates( NodeX , NodeY ) ;
138     break ;
139   }
140   case SUPERV::GOTONode : {
141     cdebug << "GraphEditor::InNode::InNode SUPERV::GOTONode : " << NodeName << endl ;
142     _GOTONode = new GraphBase::GOTONode( ORB , ptrNamingService ,
143                                          aFuncName[0].c_str() , *aPythonFunction[0] ,
144                                          NodeName , akind ,
145                                          NodeFirstCreation , NodeLastModification  ,
146                                          NodeEditorRelease , NodeAuthor ,
147                                          NodeComment , GeneratedName ,
148                                          NodeX , NodeY ,
149                                          Graph_prof_debug , Graph_fdebug ) ;
150     _ComputingNode = (GraphBase::ComputingNode *) _GOTONode ;
151     _InLineNode = (GraphBase::InLineNode *) _ComputingNode ;
152     break ;
153   }
154   case SUPERV::LoopNode : {
155     cdebug << "GraphEditor::InNode::InNode SUPERV::LoopNode : " << NodeName << endl ;
156     _LoopNode = new GraphBase::LoopNode( ORB , ptrNamingService ,
157                                          aFuncName[0].c_str() , *aPythonFunction[0] ,
158                                          aFuncName[1].c_str() , *aPythonFunction[1] ,
159                                          aFuncName[2].c_str() , *aPythonFunction[2] ,
160                                          NodeName , akind ,
161                                          NodeFirstCreation , NodeLastModification  ,
162                                          NodeEditorRelease , NodeAuthor ,
163                                          NodeComment , GeneratedName ,
164                                          NodeX , NodeY ,
165                                          Graph_prof_debug , Graph_fdebug ) ;
166     _ComputingNode = (GraphBase::ComputingNode *) _LoopNode ;
167     _GOTONode = (GraphBase::GOTONode *) _ComputingNode ;
168     _InLineNode = (GraphBase::InLineNode *) _ComputingNode ;
169     break ;
170   }
171   case SUPERV::EndLoopNode : {
172     cdebug << "GraphEditor::InNode::InNode SUPERV::EndOfLoopNode : " << NodeName << endl ;
173     _EndOfLoopNode = new GraphBase::EndOfLoopNode(
174                                          ORB , ptrNamingService ,
175                                          aFuncName[0].c_str() , *aPythonFunction[0] ,
176                                          NodeName , akind ,
177                                          NodeFirstCreation , NodeLastModification  ,
178                                          NodeEditorRelease , NodeAuthor ,
179                                          NodeComment , GeneratedName ,
180                                          NodeX , NodeY ,
181                                          Graph_prof_debug , Graph_fdebug ) ;
182     _ComputingNode = (GraphBase::ComputingNode *) _EndOfLoopNode ;
183     _GOTONode = (GraphBase::GOTONode *) _ComputingNode ;
184     _InLineNode = (GraphBase::InLineNode *) _ComputingNode ;
185     break ;
186   }
187   case SUPERV::SwitchNode : {
188     cdebug << "GraphEditor::InNode::InNode SUPERV::SwitchNode : " << NodeName << endl ;
189     _SwitchNode = new GraphBase::SwitchNode( ORB , ptrNamingService ,
190                                              aFuncName[0].c_str() , *aPythonFunction[0] ,
191                                              NodeName , akind ,
192                                              NodeFirstCreation , NodeLastModification  ,
193                                              NodeEditorRelease , NodeAuthor ,
194                                              NodeComment , GeneratedName ,
195                                              NodeX , NodeY ,
196                                              Graph_prof_debug , Graph_fdebug ) ;
197     _ComputingNode = (GraphBase::ComputingNode *) _SwitchNode ;
198     _GOTONode = (GraphBase::GOTONode *) _ComputingNode ;
199     _InLineNode = (GraphBase::InLineNode *) _ComputingNode ;
200     break ;
201   }
202   case SUPERV::EndSwitchNode : {
203     cdebug << "GraphEditor::InNode::InNode SUPERV::EndOfSwitchNode : " << NodeName << endl ;
204     _EndOfSwitchNode = new GraphBase::EndOfSwitchNode(
205                                              ORB , ptrNamingService ,
206                                              aFuncName[0].c_str() , *aPythonFunction[0] ,
207                                              NodeName , akind ,
208                                              NodeFirstCreation , NodeLastModification  ,
209                                              NodeEditorRelease , NodeAuthor ,
210                                              NodeComment , GeneratedName ,
211                                              NodeX , NodeY ,
212                                              Graph_prof_debug , Graph_fdebug ) ;
213     _ComputingNode = (GraphBase::ComputingNode *) _EndOfSwitchNode ;
214     _GOTONode = (GraphBase::GOTONode *) _ComputingNode ;
215     _InLineNode = (GraphBase::InLineNode *) _ComputingNode ;
216     break ;
217   }
218   case SUPERV::DataFlowGraph : {
219     cdebug << "GraphEditor::InNode::InNode ERROR SUPERV::DataFlowGraph : " << NodeName << endl ;
220   }
221   case SUPERV::DataStreamGraph : {
222     cdebug << "GraphEditor::InNode::InNode ERROR SUPERV::DataStreamGraph : " << NodeName << endl ;
223   }
224   case SUPERV::UnknownNode : {
225     cdebug << "GraphEditor::InNode::InNode ERROR SUPERV::UnknownNode : " << NodeName << endl ;
226   }
227   }
228   _ComputingNode->InNode( this ) ;
229   cdebug_out << "GraphEditor::InNode::InNode " << (void *) this
230              << " _ComputingNode " << (void *) _ComputingNode  << endl ;
231 }
232
233 GraphEditor::InNode::~InNode() {
234 }
235