Salome HOME
sources v1.2
[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 <strstream>
30 #include <iostream>
31
32 #include "DataFlowEditor_InNode.hxx"
33
34 GraphEditor::InNode::InNode() {
35 }
36
37 GraphEditor::InNode::InNode( CORBA::ORB_ptr ORB, 
38                              SALOME_NamingService* ptrNamingService ,
39                              GraphBase::ListOfFuncName aFuncName ,
40                              GraphBase::ListOfPythonFunctions aPythonFunction ,
41                              const SALOME_ModuleCatalog::Service& aService ,
42                              const char * ComponentName ,
43                              const char* NodeInterfaceName ,
44                              const char * NodeName ,
45                              const SUPERV::KindOfNode akind ,
46                              const SUPERV::SDate NodeFirstCreation ,
47                              const SUPERV::SDate NodeLastModification  ,
48                              const char * NodeEditorRelease ,
49                              const char * NodeAuthor ,
50                              const char * NodeComputer ,
51                              const char * NodeComment ,
52                              const bool   GeneratedName ,
53                              const int X ,
54                              const int Y ,
55                              int * Graph_prof_debug,
56                              ostream * Graph_fdebug) {
57   SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ;
58
59   _ComputingNode = NULL ;
60   _FactoryNode = NULL ;
61   _InLineNode = NULL ;
62   _GOTONode = NULL ;
63   _LoopNode = NULL ;
64   _EndOfLoopNode = NULL ;
65   _SwitchNode = NULL ;
66   _EndOfSwitchNode = NULL ;
67   switch ( akind ) {
68   case SUPERV::ComputingNode : {
69     cdebug << "GraphEditor::InNode::InNode SUPERV::ComputingNode : " << NodeName ;
70     _ComputingNode = new GraphBase::ComputingNode( ORB , ptrNamingService , aService ,
71                                                    NodeName , akind ,
72                                                    NodeFirstCreation ,
73                                                    NodeLastModification  ,
74                                                    NodeEditorRelease , NodeAuthor ,
75                                                    NodeComment , GeneratedName ,
76                                                    X , Y ,
77                                                    Graph_prof_debug , Graph_fdebug ) ;
78     break ;
79   }
80   case SUPERV::FactoryNode : {
81     cdebug << "GraphEditor::InNode::InNode SUPERV::FactoryNode : " << NodeName ;
82     _FactoryNode = new GraphBase::FactoryNode( ORB , ptrNamingService , aService ,
83                                                ComponentName , NodeInterfaceName ,
84                                                NodeName , akind ,
85                                                NodeFirstCreation ,
86                                                NodeLastModification  ,
87                                                NodeEditorRelease , NodeAuthor ,
88                                                NodeComputer , NodeComment ,
89                                                GeneratedName , X , Y ,
90                                                Graph_prof_debug , Graph_fdebug ) ;
91     _ComputingNode = (GraphBase::ComputingNode *) _FactoryNode ;
92     break ;
93   }
94   case SUPERV::InLineNode : {
95     cdebug << "GraphEditor::InNode::InNode SUPERV::InLineNode : " << NodeName ;
96     _InLineNode = new GraphBase::InLineNode( ORB , ptrNamingService ,
97                                              aFuncName[0].c_str() , *aPythonFunction[0] ,
98                                              NodeName , akind ,
99                                              NodeFirstCreation , NodeLastModification  ,
100                                              NodeEditorRelease , NodeAuthor ,
101                                              NodeComment , GeneratedName ,
102                                              X , Y ,
103                                              Graph_prof_debug , Graph_fdebug ) ;
104     _ComputingNode = (GraphBase::ComputingNode *) _InLineNode ;
105     break ;
106   }
107   case SUPERV::GOTONode : {
108     cdebug << "GraphEditor::InNode::InNode SUPERV::GOTONode : " << NodeName ;
109     _GOTONode = new GraphBase::GOTONode( ORB , ptrNamingService ,
110                                          aFuncName[0].c_str() , *aPythonFunction[0] ,
111                                          NodeName , akind ,
112                                          NodeFirstCreation , NodeLastModification  ,
113                                          NodeEditorRelease , NodeAuthor ,
114                                          NodeComment , GeneratedName ,
115                                          X , Y ,
116                                          Graph_prof_debug , Graph_fdebug ) ;
117     _ComputingNode = (GraphBase::ComputingNode *) _GOTONode ;
118     break ;
119   }
120   case SUPERV::LoopNode : {
121     cdebug << "GraphEditor::InNode::InNode SUPERV::LoopNode : " << NodeName ;
122     _LoopNode = new GraphBase::LoopNode( ORB , ptrNamingService ,
123                                          aFuncName[0].c_str() , *aPythonFunction[0] ,
124                                          aFuncName[1].c_str() , *aPythonFunction[1] ,
125                                          aFuncName[2].c_str() , *aPythonFunction[2] ,
126                                          NodeName , akind ,
127                                          NodeFirstCreation , NodeLastModification  ,
128                                          NodeEditorRelease , NodeAuthor ,
129                                          NodeComment , GeneratedName ,
130                                          X , Y ,
131                                          Graph_prof_debug , Graph_fdebug ) ;
132     _ComputingNode = (GraphBase::ComputingNode *) _LoopNode ;
133     _GOTONode = (GraphBase::GOTONode *) _ComputingNode ;
134     break ;
135   }
136   case SUPERV::EndLoopNode : {
137     cdebug << "GraphEditor::InNode::InNode SUPERV::EndOfLoopNode : " << NodeName ;
138     _EndOfLoopNode = new GraphBase::EndOfLoopNode(
139                                          ORB , ptrNamingService ,
140                                          aFuncName[0].c_str() , *aPythonFunction[0] ,
141                                          NodeName , akind ,
142                                          NodeFirstCreation , NodeLastModification  ,
143                                          NodeEditorRelease , NodeAuthor ,
144                                          NodeComment , GeneratedName ,
145                                          X , Y ,
146                                          Graph_prof_debug , Graph_fdebug ) ;
147     _ComputingNode = (GraphBase::ComputingNode *) _EndOfLoopNode ;
148     _GOTONode = (GraphBase::GOTONode *) _ComputingNode ;
149     break ;
150   }
151   case SUPERV::SwitchNode : {
152     cdebug << "GraphEditor::InNode::InNode SUPERV::SwitchNode : " << NodeName ;
153     _SwitchNode = new GraphBase::SwitchNode( ORB , ptrNamingService ,
154                                              aFuncName[0].c_str() , *aPythonFunction[0] ,
155                                              NodeName , akind ,
156                                              NodeFirstCreation , NodeLastModification  ,
157                                              NodeEditorRelease , NodeAuthor ,
158                                              NodeComment , GeneratedName ,
159                                              X , Y ,
160                                              Graph_prof_debug , Graph_fdebug ) ;
161     _ComputingNode = (GraphBase::ComputingNode *) _SwitchNode ;
162     _GOTONode = (GraphBase::GOTONode *) _ComputingNode ;
163     break ;
164   }
165   case SUPERV::EndSwitchNode : {
166     cdebug << "GraphEditor::InNode::InNode SUPERV::EndOfSwitchNode : " << NodeName ;
167     _EndOfSwitchNode = new GraphBase::EndOfSwitchNode(
168                                              ORB , ptrNamingService ,
169                                              aFuncName[0].c_str() , *aPythonFunction[0] ,
170                                              NodeName , akind ,
171                                              NodeFirstCreation , NodeLastModification  ,
172                                              NodeEditorRelease , NodeAuthor ,
173                                              NodeComment , GeneratedName ,
174                                              X , Y ,
175                                              Graph_prof_debug , Graph_fdebug ) ;
176     _ComputingNode = (GraphBase::ComputingNode *) _EndOfSwitchNode ;
177     _GOTONode = (GraphBase::GOTONode *) _ComputingNode ;
178     break ;
179   }
180   }
181   cdebug << "GraphEditor::InNode::InNode "  << (void *) this
182          << " _ComputingNode " << (void *) _ComputingNode  ;
183   _ComputingNode->InNode( this ) ;
184 }
185
186 GraphEditor::InNode::~InNode() {
187 }
188