Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[modules/superv.git] / src / GraphEditor / DataFlowEditor_DataFlow.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.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //
23 //
24 //  File   : DataFlowEditor_DataFlow.hxx
25 //  Module : SUPERV
26
27 #ifndef _DATAFLOWEDITOR_DATAFLOW_HXX
28 #define _DATAFLOWEDITOR_DATAFLOW_HXX
29
30 #include "DataFlowEditor_OutNode.hxx"
31
32 namespace GraphExecutor {
33   
34   class DataFlow;
35
36
37
38 namespace GraphEditor {
39
40   class DataFlow : public GraphEditor::OutNode {
41     
42     private :
43
44       SALOME_NamingService*     _theNamingService ;
45       GraphExecutor::DataFlow * _DataFlowExecutor ;
46       bool                      _ReadOnly ;
47       bool                      _Executing ;
48       bool                      _EditedAfterExecution ;
49
50     public:
51
52       DataFlow();
53       DataFlow( CORBA::ORB_ptr ORB, SALOME_NamingService * ptrNamingService ,
54                 const char * DataFlowName ,
55                 const char * DebugFileName ,
56                 const SUPERV::KindOfNode aKindOfNode );
57       DataFlow( CORBA::ORB_ptr ORB, SALOME_NamingService * ptrNamingService ,
58                 const SALOME_ModuleCatalog::Service& DataFlowService ,
59                 const char * DataFlowComponentName ,
60                 const char * DataFlowInterfaceName ,
61                 const char * DataFlowName ,
62                 const SUPERV::KindOfNode DataFlowkind = SUPERV::ComputingNode ,
63                 const SUPERV::SDate DataFlowFirstCreation = SUPERV::SDate() ,
64                 const SUPERV::SDate DataFlowLastModification = SUPERV::SDate() ,
65                 const char * DataFlowEditorRelease = NULLSTRING ,
66                 const char * DataFlowAuthor = NULLSTRING ,
67                 const char * DataFlowComputer = NULLSTRING ,
68                 const char * DataFlowComment = NULLSTRING ,
69                 const char * DebugFileName = NULLSTRING ) ;
70       virtual ~DataFlow();
71
72       void ReadOnly() ;
73       char * DataFlowInfo() ;
74       char * DataNodeInfo() ;
75       char * NodeInfo( const char * aNodeName ) ;
76
77       bool LoadDataFlow( const GraphBase::SGraph * aDataFlow ) ;
78 //      bool LoadXml( const char * myFileName ) ;
79       bool LoadXml( const char * myFileName , GraphBase::ListOfSGraphs & aListOfDataFlows ) ;
80       bool LoadInfo( const GraphBase::SNode &aDataFlowInfo ) ;
81
82       bool SaveXml(const char * myFileName ) ;
83       bool SavePy(const char * myFileName ) ;
84
85
86 //      void DateModification() ;
87
88       GraphBase::ListOfSGraphs * GetDataFlows() ;
89       GraphBase::SNode * GetInfo() const ;
90       GraphBase::ListOfSNodes * GetNodes() const ;
91       GraphBase::ListOfSLinks * GetLinks() const ;
92       GraphBase::ListOfSGraphs * GetGraphs() const ;
93       GraphBase::ListOfSLinks * GetDatas() const ;
94       const SALOME_ModuleCatalog::Service * GetService() ;
95
96       GraphEditor::InNode * AddService (
97                             SALOME_ModuleCatalog::Service& aService ,
98                             const char * NodeComponentName ,
99                             const char * NodeInterfaceName ) {
100              return AddNode( aService , NodeComponentName ,
101                              NodeInterfaceName ) ; } ;
102       GraphEditor::InNode * AddNode(
103                         const SALOME_ModuleCatalog::Service& NodeService ,
104                         const char * NodeComponentName ,
105                         const char * NodeInterfaceName ,
106                         const char * NodeName = NULLSTRING ,
107                         const SUPERV::KindOfNode NodeKindOfNode = SUPERV::ComputingNode ,
108                         GraphBase::ListOfFuncName aFuncName = GraphBase::ListOfFuncName() ,
109                         GraphBase::ListOfPythonFunctions aPythonFunction = GraphBase::ListOfPythonFunctions() ,
110                         const SUPERV::SDate NodeFirstCreation = SUPERV::SDate() ,
111                         const SUPERV::SDate NodeLastModification = SUPERV::SDate() ,
112                         const char * NodeEditorRelease = NULLSTRING ,
113                         const char * NodeAuthor = NULLSTRING ,
114                         const char * NodeComputer = NULLSTRING ,
115                         const char * NodeComment = NULLSTRING ,
116                         const int NodeX = 0 ,
117                         const int NodeY = 0 ) ;
118       GraphEditor::InNode * GetNode( const char* NodeName ) ;
119       bool RemoveNode( const char * NodeName ) ;
120       bool ReNameNode( const char * OldNodeName ,
121                        const char * NewNodeName ) ;
122
123       const SALOME_ModuleCatalog::Service * NodeService( const char * NodeName ) ;
124
125       void Coordinates( const int X , const int Y ) ;
126       const int XCoordinate() ;
127       const int YCoordinate() ;
128       void Coordinates( const char * NodeName , const int X , const int Y ) ;
129       const int XCoordinate( const char * NodeName ) ;
130       const int YCoordinate( const char * NodeName ) ;
131
132       const GraphBase::InPort * GetInPort( const char * name ) ;
133       const GraphBase::OutPort * GetOutPort( const char * name ) ;
134       GraphBase::InPort * GetChangeInPort( const char * name ) ;
135       GraphBase::OutPort * GetChangeOutPort( const char * name ) ;
136
137       bool HasInput(const char * ToServiceParameterName ) ;
138
139 //      bool AddLinkValue( const char * FromNodeName ,
140 //                         const char * FromServiceParameterName ,
141 //                         const char * ToNodeName ,
142 //                         const char * ToServiceParameterName ,
143 //                         const CORBA::Any aValue ) {
144 //           return AddLinkValue( FromNodeName, FromServiceParameterName , ToNodeName ,
145 //                                ToServiceParameterName , aValue ) ; } ;
146       bool AddLink( const char * FromNodeName ,
147                     const char * FromServiceParameterName ,
148                     const char * ToNodeName ,
149                     const char * ToServiceParameterName ) ;
150
151       bool RemoveLink( const char * FromNodeName ,
152                        const char * FromServiceParameterName ,
153                        const char * ToNodeName ,
154                        const char * ToServiceParameterName ) ;
155
156       bool GetLink(const char * ToNodeName ,
157                    const char * ToServiceParameterName ,
158                    char ** FromNodeName ,
159                    char ** FromServiceParameterName ) ;
160       GraphBase::SLink * GetLink( GraphBase::ComputingNode * aNode ,
161                                   const char* ToServiceParameterName ) ;
162
163       bool AddLinkCoord( const char * FromNodeName ,
164                          const char * FromServiceParameterName ,
165                          const char * ToNodeName ,
166                          const char * ToServiceParameterName ,
167                          const int nXY ,
168                          const int * X ,
169                          const int * Y ) ;
170       bool AddLinkCoord( const char * FromNodeName ,
171                          const char * FromServiceParameterName ,
172                          const char * ToNodeName ,
173                          const char * ToServiceParameterName ,
174                          const int index ,
175                          const int X ,
176                          const int Y ) ;
177       bool ChangeLinkCoord( const char * FromNodeName ,
178                             const char * FromServiceParameterName ,
179                             const char * ToNodeName ,
180                             const char * ToServiceParameterName ,
181                             const int index ,
182                             const int X ,
183                             const int Y ) ;
184       bool RemoveLinkCoord( const char * FromNodeName ,
185                             const char * FromServiceParameterName ,
186                             const char * ToNodeName ,
187                             const char * ToServiceParameterName ,
188                             const int index ) ;
189       int GetLinkCoordSize( const char * FromNodeName ,
190                             const char * FromServiceParameterName ,
191                             const char * ToNodeName ,
192                             const char * ToServiceParameterName ) ;
193       bool GetLinkCoord( const char * FromNodeName ,
194                          const char * FromServiceParameterName ,
195                          const char * ToNodeName ,
196                          const char * ToServiceParameterName ,
197                          int * X , int * Y ) ;
198       bool GetLinkCoord( const char * FromNodeName ,
199                          const char * FromServiceParameterName ,
200                          const char * ToNodeName ,
201                          const char * ToServiceParameterName ,
202                          const int index , CORBA::Long &X , CORBA::Long &Y ) ;
203
204       bool AddInputData( const char * ToNodeName ,
205                          const char * ToParameterName ,
206                          const CORBA::Any aValue = CORBA::Any() ) ;
207
208 //JR 30.03.2005      const CORBA::Any * GetInData( const char * ToNodeName ,
209       const CORBA::Any GetInData( const char * ToNodeName ,
210                                   const char * ToParameterName ) ;
211 //JR 30.03.2005      const CORBA::Any * GetOutData( const char * FromNodeName ,
212       const CORBA::Any GetOutData( const char * FromNodeName ,
213                                    const char * FromParameterName ) ;
214
215 //      bool IsValid(bool kLoopSwitch = true ) ;
216       bool IsValid() ;
217       bool IsExecutable() ;
218
219       void Executing() ; // asv : removed a bool parameter, use Editing() to set _Executing = false
220       bool IsExecuting() ;
221       void Editing() ;
222       bool IsEditing() ;
223       bool UnValid() ;
224       void EditedAfterExecution(bool EditedAfterExecution ) ;
225       bool EditedAfterExecution() ;
226
227       bool IsReadOnly() ;
228
229       long LevelMax() ;
230       SUPERV::ListOfStrings * LevelNodes(long aLevel ) ;
231       long ThreadsMax() ;
232       long SubGraphsNumber() ;
233       long SubStreamGraphsNumber() ;
234
235       void Executor(GraphExecutor::DataFlow * DataFlowExecutor ) ;
236       GraphExecutor::DataFlow * Executor() const ;
237
238   };
239
240 };
241
242 #include "DataFlowEditor_DataFlow.lxx"
243
244 ostream & operator << (ostream &,const GraphEditor::DataFlow & G);
245 ostream & operator << (ostream &,const SUPERV::SDate &);
246
247 #endif
248
249
250