Salome HOME
0bb2a91154b929c39c3ca92a52fad09a626e4357
[modules/superv.git] / src / GraphEditor / DataFlowEditor_InNode.hxx
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.hxx
25 //  Module : SUPERV
26
27 #ifndef _DATAFLOWEDITOR_INNODE_HXX
28 #define _DATAFLOWEDITOR_INNODE_HXX
29
30 #include "DataFlowBase_Graph.hxx"
31 #include "DataFlowBase_FactoryNode.hxx"
32 #include "DataFlowBase_GOTONode.hxx"
33 #include "DataFlowBase_LoopNode.hxx"
34 #include "DataFlowBase_EndOfLoopNode.hxx"
35 #include "DataFlowBase_SwitchNode.hxx"
36 #include "DataFlowBase_EndOfSwitchNode.hxx"
37
38 namespace GraphEditor {
39
40   class InNode : public GraphBase::Base {
41
42     private:
43
44       GraphBase::ComputingNode       * _ComputingNode ;
45       GraphBase::FactoryNode         * _FactoryNode ;
46       GraphBase::InLineNode          * _InLineNode ;
47       GraphBase::GOTONode            * _GOTONode ;
48       GraphBase::LoopNode            * _LoopNode ;
49       GraphBase::EndOfLoopNode       * _EndOfLoopNode ;
50       GraphBase::SwitchNode          * _SwitchNode ;
51       GraphBase::EndOfSwitchNode     * _EndOfSwitchNode ;
52       GraphBase::Graph               * _GraphMacroNode ;
53     
54     public:
55
56       InNode() ;
57 //      InNode(GraphBase::GOTONode * aGOTONode ) ;
58       InNode( CORBA::ORB_ptr ORB, 
59               SALOME_NamingService* ptrNamingService ,
60               GraphBase::ListOfFuncName aFuncName ,
61               GraphBase::ListOfPythonFunctions aPythonFunction ,
62               const SALOME_ModuleCatalog::Service& NodeService ,
63               const char *NodeComponentName ,
64               const char* NodeInterfaceName ,
65               const char *NodeName ,
66               const SUPERV::KindOfNode akind ,
67               const SUPERV::SDate NodeFirstCreation ,
68               const SUPERV::SDate NodeLastModification ,
69               const char * NodeEditorRelease ,
70               const char * NodeAuthor ,
71               const char * NodeComputer ,
72               const char * NodeComment ,
73               const bool   GeneratedName ,
74               const int NodeX ,
75               const int NodeY ,
76               int * Graph_prof_debug = NULL ,
77               ofstream * Graph_fdebug = NULL ) ;
78       virtual ~InNode() ;
79
80       char * Name() const { return _ComputingNode->Name() ; } ;
81       const char *const * NamePtr() const {
82                           return _ComputingNode->NamePtr() ; } ;
83
84       SUPERV::KindOfNode Kind() const {
85                          return _ComputingNode->Kind() ; } ;
86       const bool IsComputingNode() const {
87                  return _ComputingNode->IsComputingNode() ; } ;
88       const bool IsFactoryNode() const {
89                  return _ComputingNode->IsFactoryNode() ; } ;
90       const bool IsInLineNode() const {
91                  return _ComputingNode->IsInLineNode() ; } ;
92       const bool IsOneOfInLineNodes() const {
93                  return _ComputingNode->IsOneOfInLineNodes() ; } ;
94       const bool IsOneOfGOTONodes() const {
95                  return _ComputingNode->IsOneOfGOTONodes() ; } ;
96       const bool IsMacroNode() const {
97                  return _ComputingNode->IsMacroNode() ; } ;
98       const bool IsDataFlowNode() const {
99                  return _ComputingNode->IsDataFlowNode() ; } ;
100       const bool IsDataStreamNode() const {
101                  return _ComputingNode->IsDataStreamNode() ; } ;
102       const bool IsGOTONode() const {
103                  return _ComputingNode->IsGOTONode() ; } ;
104       const bool IsLoopNode() const {
105                  return _ComputingNode->IsLoopNode() ; } ;
106       const bool IsEndLoopNode() const {
107                  return _ComputingNode->IsEndLoopNode() ; } ;
108       const bool IsSwitchNode() const {
109                  return _ComputingNode->IsSwitchNode() ; } ;
110       const bool IsEndSwitchNode() const {
111                  return _ComputingNode->IsEndSwitchNode() ; } ;
112       const bool IsHeadNode() const {
113                  return _ComputingNode->IsHeadNode() ; } ;
114       GraphBase::ComputingNode * ComputingNode() {
115                                  return _ComputingNode ; } ;
116       GraphBase::FactoryNode * FactoryNode() {
117                                return _FactoryNode ; } ;
118       GraphBase::GOTONode * GOTONode() {
119                             if ( _GOTONode )
120                               return _GOTONode ;
121                             if ( _LoopNode )
122                               return _LoopNode ;
123                             if ( _EndOfLoopNode )
124                               return _EndOfLoopNode ;
125                             if ( _SwitchNode )
126                               return _SwitchNode ;
127                             if ( _EndOfSwitchNode )
128                               return _EndOfSwitchNode ;
129                             return NULL ;
130                             } ;
131       GraphBase::GOTONode * GOTONode() const {
132                             if ( _GOTONode )
133                               return _GOTONode ;
134                             if ( _LoopNode )
135                               return _LoopNode ;
136                             if ( _EndOfLoopNode )
137                               return _EndOfLoopNode ;
138                             if ( _SwitchNode )
139                               return _SwitchNode ;
140                             if ( _EndOfSwitchNode )
141                               return _EndOfSwitchNode ;
142                             return NULL ;
143                             } ;
144       GraphBase::InLineNode * InLineNode() {
145                               GraphBase::InLineNode * aNode = GOTONode() ;
146                               if ( aNode == NULL )
147                                 return _InLineNode ;
148                               return aNode ;
149                               } ;
150       GraphBase::InLineNode * InLineNode() const {
151                               GraphBase::InLineNode * aNode = GOTONode() ;
152                               if ( aNode == NULL )
153                                 return _InLineNode ;
154                               return aNode ;
155                               } ;
156       GraphBase::LoopNode * LoopNode() {
157                             return _LoopNode ; } ;
158       GraphBase::EndOfLoopNode * EndOfLoopNode() {
159                                  return _EndOfLoopNode ; } ;
160       GraphBase::SwitchNode * SwitchNode() {
161                               return _SwitchNode ; } ;
162       GraphBase::EndOfSwitchNode * EndOfSwitchNode() {
163                                    return _EndOfSwitchNode ; } ;
164       GraphBase::Graph * GraphMacroNode() {
165                          return _GraphMacroNode ; } ;
166
167       SUPERV::CNode_var ObjRef() const { return _ComputingNode->ObjRef() ; } ;
168       void SetObjRef(SUPERV::CNode_var aNode) {
169                      _ComputingNode->SetObjRef( aNode ) ; } ;
170
171       CNode_Impl * ObjImpl() const { return _ComputingNode->ObjImpl() ; } ;
172       void SetObjImpl( CNode_Impl * aGraph ) {
173                        _ComputingNode->SetObjImpl( aGraph ) ; } ;
174
175       const SALOME_ModuleCatalog::Service * GetService() const {
176             return _ComputingNode->GetService() ; } ;
177
178       SUPERV::SDate FirstCreation() const {
179                     return _ComputingNode->FirstCreation() ; } ;
180       SUPERV::SDate LastModification() const {
181                     return _ComputingNode->LastModification() ; } ;
182       char* Author() const {
183 //JR 17.02.2005 Memory Leak            return my_strdup( _ComputingNode->Author() ) ; }
184             return _ComputingNode->Author() ; }
185       char* EditorRelease() const {
186 //JR 17.02.2005 Memory Leak            return my_strdup( _ComputingNode->EditorRelease() ) ; } ;
187             return _ComputingNode->EditorRelease() ; } ;
188       char * Comment() const {
189 //JR 17.02.2005 Memory Leak             return my_strdup( _ComputingNode->Comment() ) ; } ;
190              return _ComputingNode->Comment() ; } ;
191       bool Author( const char * anAuthor ) {
192            return _ComputingNode->Author( anAuthor ) ; } ;
193       bool EditorRelease( const char* anEditorRelease ) {
194            return _ComputingNode->EditorRelease( anEditorRelease ) ; } ;
195       bool Comment( const char *c ) {
196            return _ComputingNode->Comment( c ) ; };
197
198       GraphBase::SNode * GetInfo() {
199                          return _ComputingNode->GetInfo() ; } ;
200
201       GraphBase::InPort * AddInPort( const char * InputParameterName ,
202                                      const char * InputParameterType ,
203                                      const SUPERV::KindOfPort aKindOfPort ) {
204                           return _ComputingNode->AddInPort( InputParameterName ,
205                                                             InputParameterType ,
206                                                             aKindOfPort ) ; } ;
207       GraphBase::OutPort * AddOutPort( const char * OutputParameterName ,
208                                        const char * OutputParameterType ,
209                                        const SUPERV::KindOfPort aKindOfPort ) {
210                            return _ComputingNode->AddOutPort( OutputParameterName ,
211                                                               OutputParameterType ,
212                                                               aKindOfPort ) ; } ;
213       int IncrDataStreamInPorts() {
214         return _ComputingNode->IncrDataStreamInPorts() ;
215       } ;
216       int IncrDataStreamOutPorts() {
217         return _ComputingNode->IncrDataStreamOutPorts() ;
218       } ;
219
220       void DelInPort( const char * InputParameterName ) {
221            _ComputingNode->DelInPort( InputParameterName ) ; } ;
222       void DelOutPort( const char * OutputParameterName ) {
223            _ComputingNode->DelOutPort( OutputParameterName ) ; } ;
224
225       bool IsLinked(const char * ToServiceParameterName ) {
226            return _ComputingNode->IsLinked( ToServiceParameterName ) ; } ;
227       bool HasInput(const char * ToServiceParameterName ) {
228            return _ComputingNode->HasInput( ToServiceParameterName ) ; } ;
229
230 //      void InOutPort( GraphBase::InPort * InputPort ,
231 //                      GraphBase::OutPort * OutputPort ) {
232 //           return _ComputingNode->InOutPort( InputPort , OutputPort ) ; } ;
233
234       const int GetNodeInPortsSize() const {
235                 return _ComputingNode->GetNodeInPortsSize() ; } ;
236       const GraphBase::InPort *GetNodeInPort(int i) const {
237                               return _ComputingNode->GetNodeInPort( i ) ; } ;
238       GraphBase::InPort *GetChangeNodeInPort(int i) const {
239                         return _ComputingNode->GetChangeNodeInPort( i ) ; } ;
240       const int GetNodeOutPortsSize() const {
241                 return _ComputingNode->GetNodeOutPortsSize() ; } ;
242       const GraphBase::OutPort *GetNodeOutPort(int i) const {
243                                return _ComputingNode->GetNodeOutPort( i ) ; } ;
244       GraphBase::OutPort *GetChangeNodeOutPort(int i) const {
245                          return _ComputingNode->GetChangeNodeOutPort( i ) ; } ;
246
247       const GraphBase::InPort *GetInPort( const char *name ) {
248             return _ComputingNode->GetInPort( name ) ; } ;
249       const GraphBase::OutPort *GetOutPort( const char *name ) {
250             return _ComputingNode->GetOutPort( name ) ; } ;
251       GraphBase::InPort *GetChangeInPort( const char *name ) {
252                         return _ComputingNode->GetChangeInPort( name ) ; } ;
253       GraphBase::OutPort *GetChangeOutPort( const char *name ) {
254                          return _ComputingNode->GetChangeOutPort( name ) ; } ;
255
256       void SetPythonFunction( const char * aFuncName ,
257                               const SUPERV::ListOfStrings & aPythonFunction ) {
258            InLineNode()->SetPythonFunction( aFuncName , aPythonFunction ) ; }
259       const SUPERV::ListOfStrings * PythonFunction() const {
260             return InLineNode()->PythonFunction() ; } ;
261       char * PyFuncName() const {
262              return InLineNode()->PyFuncName() ; } ;
263
264       void SetPyMorePythonFunction( const char * aMoreName ,
265                                     const SUPERV::ListOfStrings & aMorePythonFunction ) {
266            _LoopNode->SetMorePythonFunction( aMoreName , aMorePythonFunction ) ; }
267       SUPERV::ListOfStrings * PyMorePythonFunction() const {
268                     return _LoopNode->MorePythonFunction() ; } ;
269       char * PyMoreName() {
270              return _LoopNode->PyMoreName() ; };
271
272       void SetPyNextPythonFunction( const char * aNextName ,
273                                const SUPERV::ListOfStrings & aNextPythonFunction ) {
274            _LoopNode->SetNextPythonFunction( aNextName , aNextPythonFunction ) ; }
275       SUPERV::ListOfStrings * PyNextPythonFunction() const {
276                     return _LoopNode->NextPythonFunction() ; } ;
277       char * PyNextName() {
278              return _LoopNode->PyNextName() ; } ;
279
280       void CoupledNode( GraphBase::InLineNode * aCoupledNode ) {
281            _GOTONode->CoupledNode( aCoupledNode ) ; } ;
282       GraphBase::InLineNode * CoupledNode() {
283                               return _GOTONode->CoupledNode() ; } ;
284
285       int SubGraph() {
286           return _ComputingNode->SubGraph() ; } ;
287       int SubStreamGraph() {
288           return _ComputingNode->SubStreamGraph() ; } ;
289
290       char * ComponentName() const {
291              return _FactoryNode->ComponentName() ; } ;
292       char * InterfaceName() const {
293              return _FactoryNode->InterfaceName() ; } ;
294       char * Computer() const {
295              return _FactoryNode->Computer() ; } ;
296
297       bool ComponentName( const char * aComponentName ) {
298            return _FactoryNode->ComponentName( aComponentName ) ; } ;
299       bool InterfaceName( const char * anInterfaceName ) {
300            return _FactoryNode->InterfaceName( anInterfaceName ) ; } ;
301       bool Computer( const char *c ) {
302            return _FactoryNode->Computer( c ) ; } ;
303
304       void Coordinates( const int X , const int Y ) {
305            _ComputingNode->Coordinates( X , Y ) ; } ;
306       int XCoordinate () {
307           return _ComputingNode->XCoordinate () ; } ;
308       int YCoordinate () {
309           return _ComputingNode->YCoordinate () ; } ;
310   };
311   
312
313 };
314
315 #endif