1 // Copyright (C) 2006-2019 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef _RUNTIMESALOME_HXX_
21 #define _RUNTIMESALOME_HXX_
24 #include "YACSRuntimeSALOMEExport.hxx"
26 // rnv: avoid compilation warning on Linux : "_POSIX_C_SOURCE" and "_XOPEN_SOURCE" are redefined
27 #ifdef _POSIX_C_SOURCE
28 #undef _POSIX_C_SOURCE
35 #include <omniORB4/CORBA.h>
36 #include <omniORBpy.h>
37 #include "Runtime.hxx"
48 YACSRUNTIMESALOME_EXPORT RuntimeSALOME* getSALOMERuntime();
55 class YACSRUNTIMESALOME_EXPORT RuntimeSALOME: public Runtime
57 static Runtime* getSingleton() { return Runtime::_singleton; }
72 static void setRuntime(long flags = UsePython+UseCorba+UseXml+UseCpp+UseSalome,
73 int argc = 0, char* argv[] = NULL);
75 friend RuntimeSALOME* getSALOMERuntime();
77 virtual std::string getVersion() const;
79 virtual void init(long flags, int argc, char* argv[]);
81 virtual std::vector< std::pair<std::string,int> > getCatalogOfComputeNodes() const;
82 virtual InputPort* createInputPort(const std::string& name,
83 const std::string& impl,
87 virtual OutputPort* createOutputPort(const std::string& name,
88 const std::string& impl,
91 virtual InputDataStreamPort* createInputDataStreamPort(const std::string& name,
92 Node *node,TypeCode *type);
94 virtual OutputDataStreamPort* createOutputDataStreamPort(const std::string& name,
95 Node *node,TypeCode *type);
97 virtual DataNode* createInDataNode(const std::string& kind,const std::string& name);
98 virtual DataNode* createOutDataNode(const std::string& kind,const std::string& name);
99 virtual InlineFuncNode* createFuncNode(const std::string& kind,const std::string& name);
100 virtual InlineNode* createScriptNode(const std::string& kind,const std::string& name);
102 virtual ServiceNode* createRefNode(const std::string& kind,const std::string& name);
103 virtual ServiceNode* createCompoNode(const std::string& kind,const std::string& name);
104 virtual ServiceInlineNode *createSInlineNode(const std::string& kind, const std::string& name);
105 virtual ComponentInstance* createComponentInstance(const std::string& name,
106 const std::string& kind="");
108 virtual Container *createContainer(const std::string& kind="");
110 virtual WhileLoop* createWhileLoop(const std::string& name);
111 virtual ForLoop* createForLoop(const std::string& name);
112 virtual OptimizerLoop* createOptimizerLoop(const std::string& name,const std::string& algLib,
113 const std::string& factoryName,bool algInitOnFile,
114 const std::string& kind="", Proc * procForTypes = NULL);
115 virtual Bloc* createBloc(const std::string& name);
116 virtual Proc* createProc(const std::string& name);
118 virtual TypeCode * createInterfaceTc(const std::string& id, const std::string& name,
119 std::list<TypeCodeObjref *> ltc);
120 virtual TypeCode * createSequenceTc(const std::string& id, const std::string& name, TypeCode *content);
121 virtual TypeCodeStruct * createStructTc(const std::string& id, const std::string& name);
123 virtual InputPort* adapt(InputPort* source,
124 const std::string& impl,
125 TypeCode * type,bool init=false) throw (ConversionException);
127 virtual InputPort* adapt(InPropertyPort* source,
128 const std::string& impl,
129 TypeCode * type,bool init=false) throw (ConversionException);
131 virtual InputPort* adaptNeutral(InputPort* source,
132 const std::string& impl,
133 TypeCode * type,bool init) throw (ConversionException);
135 virtual InputPort* adapt(InputCorbaPort* source,
136 const std::string& impl,
137 TypeCode * type,bool init) throw (ConversionException);
139 virtual InputPort* adaptCorbaToCorba(InputCorbaPort* source,
140 TypeCode * type) throw (ConversionException);
142 virtual InputPort* adaptCorbaToNeutral(InputCorbaPort* source,
143 TypeCode * type) throw (ConversionException);
145 virtual InputPort* adaptCorbaToPython(InputCorbaPort* source,
146 TypeCode * type) throw (ConversionException);
148 virtual InputPort* adaptCorbaToCpp(InputCorbaPort* source,
149 TypeCode * type) throw (ConversionException);
151 virtual InputPort* adaptCorbaToXml(InputCorbaPort* source,
152 TypeCode * type) throw (ConversionException);
154 virtual InputPort* adapt(InputPyPort* source,
155 const std::string& impl,
156 TypeCode * type,bool init) throw (ConversionException);
158 virtual InputPort* adaptPythonToCorba(InputPyPort* source,
159 TypeCode * type) throw (ConversionException);
161 virtual InputPort* adaptPythonToNeutral(InputPyPort* source,
162 TypeCode * type) throw (ConversionException);
164 virtual InputPort* adaptPythonToPython(InputPyPort* source,
165 TypeCode * type,bool init) throw (ConversionException);
167 virtual InputPort* adaptPythonToXml(InputPyPort* source,
168 TypeCode * type) throw (ConversionException);
170 virtual InputPort* adaptPythonToCpp(InputPyPort* source,
171 TypeCode * type) throw (ConversionException);
173 virtual InputPort* adapt(InputCppPort* source,
174 const std::string& impl,
175 TypeCode * type,bool init) throw (ConversionException);
177 virtual InputPort* adaptCppToCorba(InputCppPort* source,
178 TypeCode * type) throw (ConversionException);
180 virtual InputPort* adaptCppToNeutral(InputCppPort* source,
181 TypeCode * type) throw (ConversionException);
183 virtual InputPort* adaptCppToPython(InputCppPort* source,
184 TypeCode * type) throw (ConversionException);
186 virtual InputPort* adaptCppToXml(InputCppPort* source,
187 TypeCode * type) throw (ConversionException);
189 virtual InputPort* adaptCppToCpp(InputCppPort* source,
190 TypeCode * type) throw (ConversionException);
192 virtual InputPort* adapt(InputXmlPort* source,
193 const std::string& impl,
194 TypeCode * type,bool init) throw (ConversionException);
196 virtual InputPort* adaptXmlToCorba(InputXmlPort* source,
197 TypeCode * type) throw (ConversionException);
199 virtual InputPort* adaptXmlToPython(InputXmlPort* inport,
200 TypeCode * type) throw (ConversionException);
202 virtual InputPort* adaptXmlToCpp(InputXmlPort* inport,
203 TypeCode * type) throw (ConversionException);
205 virtual InputPort* adaptXmlToNeutral(InputXmlPort* inport,
206 TypeCode * type) throw (ConversionException);
207 virtual InputPort* adaptXmlToXml(InputXmlPort* inport,
208 TypeCode * type,bool init) throw (ConversionException);
211 virtual InputPort* adaptNeutralToXml(InputPort* inport,
212 TypeCode * type) throw (ConversionException);
214 virtual InputPort* adaptNeutralToPython(InputPort* inport,
215 TypeCode * type) throw (ConversionException);
217 virtual InputPort* adaptNeutralToCorba(InputPort* inport,
218 TypeCode * type) throw (ConversionException);
220 virtual InputPort* adaptNeutralToCpp(InputPort* inport,
221 TypeCode * type) throw (ConversionException);
223 virtual void* convertNeutral(TypeCode * type, Any *data);
224 virtual std::string convertNeutralAsString(TypeCode * type, Any *data);
225 virtual std::string convertPyObjectToString(PyObject* ob);
226 virtual PyObject* convertStringToPyObject(const std::string& s);
228 virtual ~RuntimeSALOME();
230 CORBA::ORB_ptr getOrb() const;
231 PyObject * getPyOrb() const;
232 PyObject * getBuiltins() const;
233 DynamicAny::DynAnyFactory_ptr getDynFactory() const;
234 omniORBpyAPI* getApi();
235 PyObject * get_omnipy();
238 RuntimeSALOME(); // singleton
239 RuntimeSALOME(long flags, int argc, char* argv[]); // singleton
244 DynamicAny::DynAnyFactory_var _dynFactory;
248 bool _usePython, _useCorba, _useCpp, _useXml;