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