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_OutNode.hxx
27 #ifndef _DATAFLOWEDITOR_OUTNODE_HXX
28 #define _DATAFLOWEDITOR_OUTNODE_HXX
30 #include "DataFlowBase_Graph.hxx"
32 #include "DataFlowEditor_InNode.hxx"
34 namespace GraphEditor {
36 class OutNode : public GraphBase::Graph {
51 bool LoadNodes( map< string , int > & aMapOfNodes ,
52 const GraphBase::ListOfNodes &aNodes ) ;
53 bool LoadLinks( map< string , int > & aMapOfNodes ,
54 const GraphBase::ListOfLinks &aLinks ) ;
55 bool LoadDatas( map< string , int > & aMapOfNodes ,
56 const GraphBase::ListOfLinks &aDatas ) ;
58 // bool GraphEditor::OutNode::LinkSaveXML( ostream &f , char *Tabs ,
59 bool GraphEditor::OutNode::LinkSaveXML( QDomDocument & Graph , QDomElement & link ,
60 GraphBase::SLink aLink ,
62 // bool SaveXML(ostream &f ) ;QDomDocument & Graph
63 bool SaveXML(QDomDocument & Graph ) ;
65 bool GraphEditor::OutNode::LinkSavePY( ostream &f ,
66 const char *aGraphName ,
67 GraphBase::SLink aLink ,
70 bool SavePY(ostream &f ) ;
72 void DateModification() ;
77 OutNode( CORBA::ORB_ptr ORB,
78 SALOME_NamingService* ptrNamingService ,
79 const char *DataFlowName ,
80 const char * DebugFileName );
81 OutNode( CORBA::ORB_ptr ORB,
82 SALOME_NamingService* ptrNamingService ,
83 const SALOME_ModuleCatalog::Service& DataFlowService ,
84 const char *DataFlowComponentName ,
85 const char *DataFlowInterfaceName ,
86 const char *DataFlowName ,
87 const SUPERV::KindOfNode DataFlowkind ,
88 const SUPERV::SDate DataFlowFirstCreation ,
89 const SUPERV::SDate DataFlowLastModification ,
90 const char * DataFlowEditorRelease ,
91 const char * DataFlowAuthor ,
92 const char * DataFlowComputer ,
93 const char * DataFlowComment ,
94 const char * DebugFileName ) ;
97 // SALOME_NamingService* NamingService() const {
98 // return _theNamingService ; } ;
100 bool LoadDataFlow( const GraphBase::SGraph *aDataFlow ) ;
101 bool LoadXml( const char* myFileName ) ;
102 bool LoadInfo( const GraphBase::SNode &aDataFlowInfo ) ;
104 bool SaveXml(const char* myFileName ) ;
106 bool SavePy(const char* myFileName ) ;
108 // get all DataFlow informations (for a .XML file) :
109 GraphBase::SGraph * GetDataFlow() ;
111 // void DateModification() ;
113 GraphEditor::InNode * AddNode(
114 const SALOME_ModuleCatalog::Service& NodeService ,
115 GraphBase::ListOfFuncName aFuncName ,
116 GraphBase::ListOfPythonFunctions aPythonFunction ,
117 const char* NodeComponentName ,
118 const char* NodeInterfaceName ,
119 const char* NodeName ,
120 const SUPERV::KindOfNode NodeKindOfNode ,
121 const SUPERV::SDate NodeFirstCreation ,
122 const SUPERV::SDate NodeLastModification ,
123 const char * NodeEditorRelease ,
124 const char * NodeAuthor ,
125 const char * NodeComputer ,
126 const char * NodeComment ,
129 GraphEditor::InNode * GetNode( const char* NodeName ) {
130 const GraphBase::Graph::ComputingNode * aNode = GraphBase::Graph::GetGraphNode( NodeName ) ;
132 return (GraphEditor::InNode * ) (aNode->GetInNode()) ;
135 return (GraphEditor::InNode * ) NULL ;
137 bool RemoveNode( const char* NodeName ) {
140 return GraphBase::Graph::RemoveNode( NodeName ) ; } ;
141 bool ReNameNode( const char* OldNodeName ,
142 const char* NewNodeName ) {
145 return GraphBase::Graph::ReNameNode( OldNodeName , NewNodeName ) ; } ;
147 void Coordinates( const int X , const int Y ) {
148 return GraphBase::Graph::Coordinates( X , Y ) ; } ;
149 const int XCoordinate() {
150 return GraphBase::Graph::XCoordinate() ; } ;
151 const int YCoordinate() {
152 return GraphBase::Graph::YCoordinate() ; } ;
153 void Coordinates( const char* NodeName , const int X , const int Y ) ;
154 const int XCoordinate( const char* NodeName ) ;
155 const int YCoordinate( const char* NodeName ) ;
157 const GraphBase::InPort *GetInPort( const char *name ) {
158 return GraphBase::PortsOfNode::GetInPort( name ) ; } ;
159 const GraphBase::OutPort *GetOutPort( const char *name ) {
160 return GraphBase::PortsOfNode::GetOutPort( name ) ; } ;
161 GraphBase::InPort *GetChangeInPort( const char *name ) {
162 return GraphBase::PortsOfNode::GetChangeInPort( name ) ; } ;
163 GraphBase::OutPort *GetChangeOutPort( const char *name ) {
164 return GraphBase::PortsOfNode::GetChangeOutPort( name ) ; } ;
166 bool HasInput(const char * ToServiceParameterName ) {
167 return GraphBase::ComputingNode::HasInput( ToServiceParameterName ) ;
170 bool AddLink( const char* FromNodeName ,
171 const char* FromServiceParameterName ,
172 const char* ToNodeName ,
173 const char* ToServiceParameterName ,
174 const CORBA::Any aValue ) {
177 return GraphBase::Graph::AddLink(
178 FromNodeName , FromServiceParameterName ,
179 ToNodeName , ToServiceParameterName ,
182 bool RemoveLink( const char* FromNodeName ,
183 const char* FromServiceParameterName ,
184 const char* ToNodeName ,
185 const char* ToServiceParameterName ) {
186 bool RetVal = GraphBase::Graph::RemoveLink(
188 FromServiceParameterName ,
190 ToServiceParameterName ) ;
196 bool GetLink(const char* ToNodeName ,
197 const char* ToServiceParameterName ,
198 char** FromNodeName ,
199 char** FromServiceParameterName ) {
200 return GraphBase::Graph::GetLink( ToNodeName ,
201 ToServiceParameterName ,
203 FromServiceParameterName ) ; } ;
205 bool AddLinkCoord( const char* FromNodeName ,
206 const char* FromServiceParameterName ,
207 const char* ToNodeName ,
208 const char* ToServiceParameterName ,
212 bool AddLinkCoord( const char* FromNodeName ,
213 const char* FromServiceParameterName ,
214 const char* ToNodeName ,
215 const char* ToServiceParameterName ,
219 bool ChangeLinkCoord( const char* FromNodeName ,
220 const char* FromServiceParameterName ,
221 const char* ToNodeName ,
222 const char* ToServiceParameterName ,
226 bool RemoveLinkCoord( const char* FromNodeName ,
227 const char* FromServiceParameterName ,
228 const char* ToNodeName ,
229 const char* ToServiceParameterName ,
231 int GetLinkCoordSize( const char* FromNodeName ,
232 const char* FromServiceParameterName ,
233 const char* ToNodeName ,
234 const char* ToServiceParameterName ) ;
235 bool GetLinkCoord( const char* FromNodeName ,
236 const char* FromServiceParameterName ,
237 const char* ToNodeName ,
238 const char* ToServiceParameterName ,
240 bool GetLinkCoord( const char* FromNodeName ,
241 const char* FromServiceParameterName ,
242 const char* ToNodeName ,
243 const char* ToServiceParameterName ,
244 const int index , long &X , long &Y ) ;
246 bool AddInputData( const char* ToNodeName1 ,
247 const char* ToParameterName1 ,
248 const char* ToNodeName2 ,
249 const char* ToParameterName2 ) ;
255 bool IsNotValid() const {
258 bool RetVal = _Valid ;
262 bool IsExecutable() {
270 _Executable = false ;
271 return _Executable ; } ;
272 bool IsNotExecutable() const {
273 return !_Executable ; } ;
275 const CORBA::Any *GetInData( const char *ToNodeName ,
276 const char *ToParameterName ) ;
277 const CORBA::Any *GetOutData( const char *FromNodeName ,
278 const char *FromParameterName ) ;
283 ostrstream & operator << (ostrstream &,const GraphEditor::OutNode & G);
284 ostream & operator << (ostream &,const SUPERV::SDate &);