1 // Copyright (C) 2006-2014 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
21 "All is needed to create and execute a calculation schema."
24 %module(docstring=DOCSTRING) pilot
27 //work around SWIG bug #1863647
28 #if SWIG_VERSION >= 0x010336
29 #define SwigPyIterator pilot_PySwigIterator
31 #define PySwigIterator pilot_PySwigIterator
35 %feature("autodoc", "1");
37 %include "engtypemaps.i"
45 #include "TypeCode.hxx"
46 #include "ComponentDefinition.hxx"
47 #include "Visitor.hxx"
48 #include "VisitorSaveSchema.hxx"
49 #include "VisitorSaveState.hxx"
50 #include "LinkInfo.hxx"
51 #include "Catalog.hxx"
52 #include "Executor.hxx"
53 #include "ExecutorSwig.hxx"
54 #include "Dispatcher.hxx"
55 #include "Container.hxx"
56 #include "HomogeneousPoolContainer.hxx"
58 #include "DeploymentTree.hxx"
59 #include "ComponentInstance.hxx"
60 #include "DataNode.hxx"
62 using namespace YACS::ENGINE;
70 PyObject* omnipy = PyImport_ImportModule((char*)"_omnipy");
73 PyErr_SetString(PyExc_ImportError,(char*)"Cannot import _omnipy");
76 PyObject* pyapi = PyObject_GetAttrString(omnipy, (char*)"API");
77 api = (omniORBPYAPI*)PyCObject_AsVoidPtr(pyapi);
82 %ignore YACS::ENGINE::Any::operator[];
83 %ignore YACS::ENGINE::TypeCode::operator=;
84 %ignore YACS::ENGINE::DeploymentTree::operator=;
86 %ignore YACS::ENGINE::Runtime::_tc_double;
87 %ignore YACS::ENGINE::Runtime::_tc_int;
88 %ignore YACS::ENGINE::Runtime::_tc_bool;
89 %ignore YACS::ENGINE::Runtime::_tc_string;
90 %ignore YACS::ENGINE::Runtime::_tc_file;
91 %rename(StateLoader) YACS::ENGINE::StateLoader; // to suppress a 503 warning
92 %rename(NbDoneLoader) YACS::ENGINE::NbDoneLoader; // to suppress a 503 warning
93 %rename(getRuntime) YACS::ENGINE::getRuntime; // to suppress a 503 warning
94 %rename(_from) YACS::ENGINE::DataLinkInfo::from ; // to suppress a 314 warning
95 %rename(_from) YACS::ENGINE::StreamLinkInfo::from ; // to suppress a 314 warning
100 %template() std::pair<std::string, YACS::ENGINE::TypeCode *>;
101 %template() std::pair<std::string, YACS::ENGINE::Node *>;
102 %template() std::pair<std::string, YACS::ENGINE::InlineNode *>;
103 %template() std::pair<std::string, YACS::ENGINE::ServiceNode *>;
104 %template() std::pair<std::string, YACS::ENGINE::Container *>;
105 %template() std::pair<YACS::ENGINE::OutPort *,YACS::ENGINE::InPort *>;
106 %template() std::pair<YACS::ENGINE::InPort *,YACS::ENGINE::OutPort *>;
107 //%template(TCmap) std::map<std::string, YACS::ENGINE::TypeCode *>;
108 REFCOUNT_TEMPLATE(TCmap,YACS::ENGINE::TypeCode)
109 %template(NODEmap) std::map<std::string, YACS::ENGINE::Node *>;
110 %template(INODEmap) std::map<std::string, YACS::ENGINE::InlineNode *>;
111 %template(SNODEmap) std::map<std::string, YACS::ENGINE::ServiceNode *>;
112 //%template(CONTAINmap) std::map<std::string, YACS::ENGINE::Container *>;
113 REFCOUNT_TEMPLATE(CONTAINmap,YACS::ENGINE::Container)
114 %template(strvec) std::vector<std::string>;
115 %template(linksvec) std::vector< std::pair<YACS::ENGINE::OutPort *,YACS::ENGINE::InPort *> >;
116 %template(linkvec) std::vector< std::pair<YACS::ENGINE::InPort *,YACS::ENGINE::OutPort *> >;
117 %template(instreamlist) std::list<YACS::ENGINE::InputDataStreamPort *>;
118 %template(outstreamlist) std::list<YACS::ENGINE::OutputDataStreamPort *>;
120 %template() std::pair<std::string, YACS::ENGINE::CatalogLoader *>;
121 %template(loadermap) std::map<std::string,YACS::ENGINE::CatalogLoader *>;
122 %template() std::pair<std::string, YACS::ENGINE::ComposedNode *>;
123 %template(composedmap) std::map<std::string,YACS::ENGINE::ComposedNode *>;
124 %template() std::pair<std::string, YACS::ENGINE::ComponentDefinition *>;
125 %template(compomap) std::map<std::string, YACS::ENGINE::ComponentDefinition *>;
126 %template() std::pair<std::string, std::string>;
127 %template(propmap) std::map<std::string, std::string>;
129 REFCOUNT_TEMPLATE(CompoInstmap,YACS::ENGINE::ComponentInstance)
132 * End of Template section
135 %typemap(out) Container *
137 $result=convertContainer($1,$owner);
140 %typemap(out) YACS::ENGINE::Container *
142 $result=convertContainer($1,$owner);
148 //Take ownership : it is not the default (constructor) as it is a factory
149 %newobject *::createProc;
150 %newobject *::createScriptNode;
151 %newobject *::createFuncNode;
152 %newobject *::createRefNode;
153 %newobject *::createCompoNode;
154 %newobject *::createSInlineNode;
155 %newobject *::createInDataNode;
156 %newobject *::createOutDataNode;
157 %newobject *::createBloc;
158 %newobject *::createForLoop;
159 %newobject *::createForEachLoop;
160 %newobject *::createWhileLoop;
161 %newobject *::createSwitch;
162 %newobject *::loadCatalog;
163 %newobject *::createComponentInstance;
164 %newobject *::createContainer;
167 %newobject *::createInputPort;
168 %newobject *::createOutputPort;
169 %newobject *::createInputDataStreamPort;
170 %newobject *::createOutputDataStreamPort;
172 %newobject *::cloneAlways;
173 %newobject *::cloneWithoutCompAndContDeepCpy;
176 //Take ownership : transfer it from C++ (has to be completed)
177 %newobject YACS::ENGINE::Loop::edRemoveNode;
178 %newobject YACS::ENGINE::Switch::edReleaseDefaultNode;
179 %newobject YACS::ENGINE::Switch::edReleaseCase;
180 %newobject YACS::ENGINE::DynParaLoop::edRemoveNode;
181 %newobject YACS::ENGINE::DynParaLoop::edRemoveInitNode;
182 //No other way to do ??
183 %feature("pythonappend") YACS::ENGINE::Bloc::edRemoveChild(Node *node)%{
187 %newobject *::createSequenceTc;
188 %newobject *::createInterfaceTc;
189 %newobject *::createStructTc;
190 %newobject *::createType;
192 %newobject YACS::ENGINE::TypeCode::interfaceTc;
193 %newobject YACS::ENGINE::TypeCode::sequenceTc;
194 %newobject YACS::ENGINE::TypeCode::structTc;
197 * End of ownership section
201 %include <define.hxx>
202 %include <YACSBasesExport.hxx>
203 %include <Exception.hxx>
204 %include <YACSlibEngineExport.hxx>
205 %include <ConversionException.hxx>
206 %include <Runtime.hxx>
207 %include <PropertyInterface.hxx>
209 PYEXCEPTION(YACS::ENGINE::Executor::RunW)
210 PYEXCEPTION(YACS::ENGINE::Executor::RunB)
211 PYEXCEPTION(YACS::ENGINE::Executor::setExecMode)
212 PYEXCEPTION(YACS::ENGINE::Executor::resumeCurrentBreakPoint)
213 PYEXCEPTION(YACS::ENGINE::Executor::stopExecution)
214 PYEXCEPTION(YACS::ENGINE::Executor::waitPause)
215 PYEXCEPTION(YACS::ENGINE::ComponentInstance::load)
217 %include <Executor.hxx>
219 EXCEPTION(YACS::ENGINE::ExecutorSwig::RunPy)
220 EXCEPTION(YACS::ENGINE::ExecutorSwig::waitPause)
221 %include <ExecutorSwig.hxx>
223 %include <RefCounter.hxx>
227 %ignore YACS::ENGINE::TypeCode::getOrBuildAnyFromZippedData;
228 %include <TypeCode.hxx>
230 %include <Scheduler.hxx>
232 %include <Dispatcher.hxx>
233 %include <DeploymentTree.hxx>
235 %extend YACS::ENGINE::Port
237 int __cmp__(Port* other)
249 %include <DataPort.hxx>
250 %include <InPort.hxx>
251 %include <OutPort.hxx>
252 %include <InGate.hxx>
253 %include <OutGate.hxx>
254 %include <DataFlowPort.hxx>
255 %include <DataStreamPort.hxx>
257 %include <LinkInfo.hxx>
258 %include <Logger.hxx>
260 %include <ComponentInstance.hxx>
261 %include <Container.hxx>
262 %include <HomogeneousPoolContainer.hxx>
263 %include <InputPort.hxx>
264 %extend YACS::ENGINE::InputPort
266 void edInitXML(const char * s)
268 self->edInit("XML",s);
270 void edInitPy(PyObject* ob)
272 self->edInit("Python",ob);
275 %include <InPropertyPort.hxx>
276 %extend YACS::ENGINE::InPropertyPort
278 void edInitXML(const char * s)
280 self->edInit("XML",s);
282 void edInitPy(PyObject* ob)
284 self->edInit("Python",ob);
288 %template(edInitInt) YACS::ENGINE::InputPort::edInit<int>;
289 %template(edInitBool) YACS::ENGINE::InputPort::edInit<bool>;
290 %template(edInitString) YACS::ENGINE::InputPort::edInit<std::string>;
291 %template(edInitDbl) YACS::ENGINE::InputPort::edInit<double>;
293 %include <AnyInputPort.hxx>
294 %include <ConditionInputPort.hxx>
295 %include <OutputPort.hxx>
296 %include <AnyOutputPort.hxx>
297 %include <InputDataStreamPort.hxx>
298 %include <OutputDataStreamPort.hxx>
299 %include <DataPort.hxx>
302 %extend YACS::ENGINE::Node
304 int __cmp__(Node* other)
317 %include <ElementaryNode.hxx>
318 %include <InlineNode.hxx>
319 %include <ServiceNode.hxx>
320 %include <ServiceInlineNode.hxx>
321 %include <ServerNode.hxx>
322 %include <DataNode.hxx>
324 %include <ComposedNode.hxx>
325 %include <StaticDefinedComposedNode.hxx>
330 %include <ForLoop.hxx>
331 %include <DynParaLoop.hxx>
332 %include <WhileLoop.hxx>
333 %include <ForEachLoop.hxx>
334 %include <OptimizerLoop.hxx>
335 %include <Switch.hxx>
336 %include <Visitor.hxx>
337 %include <VisitorSaveSchema.hxx>
338 %include <ComponentDefinition.hxx>
339 %include <Catalog.hxx>
342 %include <AlternateThread.hxx>
343 %include <AlternateThreadPT.hxx>
345 // Ignore class OptimizerAlgASync to avoid confusion with class
346 // OptimizerAlgASync in module SALOMERuntime
347 %ignore YACS::ENGINE::OptimizerAlgASync;
348 %include <OptimizerAlg.hxx>
350 %extend YACS::ENGINE::ConditionInputPort
354 return self->getValue();
358 %extend YACS::ENGINE::AnyInputPort
360 PyObject * getPyObj()
362 return (PyObject *)getRuntime()->convertNeutral(self->edGetType(),self->getValue());
366 %extend YACS::ENGINE::AnyOutputPort
368 PyObject * getPyObj()
370 return (PyObject *)getRuntime()->convertNeutral(self->edGetType(),self->getValue());
374 %newobject YACS::ENGINE::SequenceAny::__getitem__;
375 %extend YACS::ENGINE::SequenceAny
377 Any* __getitem__(int i)
379 if (i < self->size())
386 throw std::length_error("index too large");
390 %newobject YACS::ENGINE::StructAny::__getitem__;
391 %extend YACS::ENGINE::StructAny
393 Any* __getitem__(const char * key)
395 AnyPtr a=(*self)[key];