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