]> SALOME platform Git repositories - modules/superv.git/blob - src/GraphBase/DataFlowBase_Base.hxx
Salome HOME
NRI : Merge from V1_2.
[modules/superv.git] / src / GraphBase / DataFlowBase_Base.hxx
1 //  SUPERV GraphBase : contains fondamental classes for Services, Input Ports, Output Ports Links and Nodes.
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   : DataFlowBase_Base.hxx
25 //  Author : Jean Rahuel, CEA
26 //  Module : SUPERV
27 //  $Header:
28
29 #ifndef _DATAFLOW_BASE_HXX
30 #define _DATAFLOW_BASE_HXX
31
32 #include <iostream>
33 #include <fstream>
34 #include <strstream>
35 #include <iomanip>
36 #include <string>
37 #include <map>
38 #include <vector>
39 #include <list>
40
41 #include <qdom.h>
42
43 #include "CORBA.h"
44
45 #include <SALOMEconfig.h>
46 #include CORBA_CLIENT_HEADER(SUPERV)
47
48 #include "utilities.h"
49 #include "OpUtil.hxx"
50
51 #include "SALOME_NamingService.hxx"
52
53 extern char *SuperVision_Version ;
54
55 extern char *NULLSTRING ;
56
57 extern char *FACTORYSERVER ;
58
59 inline char * my_strdup( const char * s ) {
60   if (s == NULL) return NULL;
61
62   size_t l = strlen(s) + 1;
63   char * t = new char[l];
64   strcpy(t, s);
65   return t;
66 }
67
68 enum StatusOfPort { NotConnected , PortConnected , PortAndDataConnected ,
69                     DataConnected } ;
70
71 namespace GraphBase {
72
73   struct SCoord {
74     long theX ;
75     long theY ;
76   };
77     
78   typedef vector<SCoord> ListOfCoords;
79
80   typedef string FuncName ;
81
82   typedef vector< FuncName > ListOfFuncName ;
83
84   typedef vector<const SUPERV::ListOfStrings *> ListOfPythonFunctions ;
85
86   struct NodeParameter {
87     SALOME_ModuleCatalog::ServicesParameter theInParameter ;
88     SALOME_ModuleCatalog::ServicesParameter theOutParameter ;
89   };
90
91   typedef vector<NodeParameter> ListOfParameters;
92
93   struct SNode {
94     string                        theComponentName ;
95     string                        theInterfaceName ;
96     string                        theName ;
97     SUPERV::KindOfNode            theKind ;
98     string                        theCoupledNode ;
99     SALOME_ModuleCatalog::Service theService ;
100     ListOfParameters              theListOfParameters ;
101     ListOfFuncName                theListOfFuncName ;
102     ListOfPythonFunctions         theListOfPythonFunctions ;
103     SUPERV::SDate                 theFirstCreation ;
104     SUPERV::SDate                 theLastModification ;
105     string                        theEditorRelease ;
106     string                        theAuthor ;
107     string                        theContainer;
108     string                        theComment;
109     SCoord                        theCoords ;
110   };
111
112   typedef vector<SNode> ListOfNodes;
113
114   struct ServicesData {
115     SALOME_ModuleCatalog::ServicesParameter aDataParameter ;
116     CORBA::Any                              aDataValue;
117   };
118
119   typedef vector<ServicesData> ListOfServicesData;
120
121   struct SLink {
122     string       FromNodeName ;
123     string       FromServiceParameterName ;
124     string       ToNodeName ;
125     string       ToServiceParameterName ;
126     CORBA::Any   aLinkValue;
127     ListOfCoords aListOfCoords ;
128   };
129
130   typedef vector<SLink> ListOfLinks;
131
132   struct SGraph {
133     SNode        Info ;
134     ListOfNodes  Nodes ;
135     ListOfLinks  Links ;
136     ListOfLinks  Datas ;
137   };
138
139   typedef vector<SGraph> ListOfGraphs;
140
141   class Base {
142
143     private:   
144
145       CORBA::ORB_ptr _Orb ;
146
147     public:   
148
149       int *     _prof_debug;
150       ostream * _fdebug;
151                      
152       Base() ;
153       virtual ~Base() {} ;
154
155       void SetDebug( CORBA::ORB_ptr ORB ,
156                      int * prof_debug , ostream * fdebug ) ;
157
158       char * ObjectToString( CORBA::Object_ptr obj ) const ;
159       CORBA::Object_ptr StringToObject(char * obj ) const ;
160
161   } ;
162 # ifdef _DEBUG_
163
164 #   define cdebug \
165            if ( GraphBase::Base::_prof_debug ) \
166              *GraphBase::Base::_fdebug << "      " /*<< setw(3*(*GraphBase::Base::_prof_debug)) */<< " "
167
168 #   define cdebug_in \
169            if ( GraphBase::Base::_prof_debug ) \
170              *GraphBase::Base::_fdebug << endl << "-->" /*<< setw(3*((*GraphBase::Base::_prof_debug)++)) */<< " "
171
172 #   define cdebug_out \
173            if ( GraphBase::Base::_prof_debug ) \
174              *GraphBase::Base::_fdebug << endl << "<--" /*<< setw(3*(--(*GraphBase::Base::_prof_debug)))*/ << " "
175 # else
176
177 #   define cdebug while (false) std::cerr
178 #   define cdebug_in  cdebug
179 #   define cdebug_out cdebug
180 #   define debugFile(x) 
181
182 # endif
183
184 } ;
185
186 #endif