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