1 // SUPERV GraphEditor : contains classes that permit edition of graphs
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : DataFlowEditor_DataFlow.hxx
27 #ifndef _DATAFLOWEDITOR_DATAFLOW_HXX
28 #define _DATAFLOWEDITOR_DATAFLOW_HXX
30 //#include "DataFlowExecutor_DataFlow.hxx"
32 #include "DataFlowExecutor_DataFlow.hxx"
33 #include "DataFlowEditor_OutNode.hxx"
35 namespace GraphEditor {
37 class DataFlow : public GraphEditor::OutNode {
41 SALOME_NamingService* _theNamingService ;
42 GraphExecutor::DataFlow * _DataFlowExecutor ;
45 bool _EditedAfterExecution ;
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 = NULL ,
62 const char * DataFlowAuthor = NULL ,
63 const char * DataFlowComputer = NULL ,
64 const char * DataFlowComment = NULL ,
65 const char * DebugFileName = NULL ) ;
69 char * DataFlowInfo() ;
70 char * DataNodeInfo() ;
71 char * NodeInfo( const char * aNodeName ) ;
73 bool LoadDataFlow( const GraphBase::SGraph *aDataFlow ) ;
74 bool LoadXml( const char* myFileName ) ;
75 bool LoadInfo( const GraphBase::SNode &aDataFlowInfo ) ;
77 bool SaveXml(const char* myFileName ) ;
78 bool SavePy(const char* myFileName ) ;
81 // void DateModification() ;
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() ;
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 = NULL ,
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 = NULL ,
108 const char * NodeAuthor = NULL ,
109 const char * NodeComputer = NULL ,
110 const char * NodeComment = NULL ,
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 ) ;
118 const SALOME_ModuleCatalog::Service * NodeService( const char * NodeName ) ;
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 ) ;
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 ) ;
132 bool HasInput(const char * ToServiceParameterName ) ;
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() ) ;
147 bool RemoveLink( const char* FromNodeName ,
148 const char* FromServiceParameterName ,
149 const char* ToNodeName ,
150 const char* ToServiceParameterName ) ;
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 ) ;
159 bool AddLinkCoord( const char* FromNodeName ,
160 const char* FromServiceParameterName ,
161 const char* ToNodeName ,
162 const char* ToServiceParameterName ,
166 bool AddLinkCoord( const char* FromNodeName ,
167 const char* FromServiceParameterName ,
168 const char* ToNodeName ,
169 const char* ToServiceParameterName ,
173 bool ChangeLinkCoord( const char* FromNodeName ,
174 const char* FromServiceParameterName ,
175 const char* ToNodeName ,
176 const char* ToServiceParameterName ,
180 bool RemoveLinkCoord( const char* FromNodeName ,
181 const char* FromServiceParameterName ,
182 const char* ToNodeName ,
183 const char* ToServiceParameterName ,
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 ,
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 ) ;
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 ) ;
208 const CORBA::Any *GetInData( const char * ToNodeName ,
209 const char * ToParameterName ) ;
210 const CORBA::Any *GetOutData( const char * FromNodeName ,
211 const char * FromParameterName ) ;
214 bool IsExecutable() ;
218 void EditedAfterExecution(bool EditedAfterExecution ) ;
219 bool EditedAfterExecution() ;
224 SUPERV::ListOfStrings * LevelNodes(long aLevel ) ;
226 long GraphsNumber() ;
228 void Executor(GraphExecutor::DataFlow * DataFlowExecutor ) ;
229 GraphExecutor::DataFlow * GraphEditor::DataFlow::Executor() const ;
235 #include "DataFlowEditor_DataFlow.lxx"
237 ostream & operator << (ostream &,const GraphEditor::DataFlow & G);
238 ostream & operator << (ostream &,const SUPERV::SDate &);