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)
131 * End of Template section
138 //Take ownership : it is not the default (constructor) as it is a factory
139 %newobject *::createProc;
140 %newobject *::createScriptNode;
141 %newobject *::createFuncNode;
142 %newobject *::createRefNode;
143 %newobject *::createCompoNode;
144 %newobject *::createSInlineNode;
145 %newobject *::createInDataNode;
146 %newobject *::createOutDataNode;
147 %newobject *::createBloc;
148 %newobject *::createForLoop;
149 %newobject *::createForEachLoop;
150 %newobject *::createWhileLoop;
151 %newobject *::createSwitch;
152 %newobject *::loadCatalog;
153 %newobject *::createComponentInstance;
154 %newobject *::createContainer;
157 %newobject *::createInputPort;
158 %newobject *::createOutputPort;
159 %newobject *::createInputDataStreamPort;
160 %newobject *::createOutputDataStreamPort;
162 %newobject *::cloneAlways;
165 //Take ownership : transfer it from C++ (has to be completed)
166 %newobject YACS::ENGINE::Loop::edRemoveNode;
167 %newobject YACS::ENGINE::Switch::edReleaseDefaultNode;
168 %newobject YACS::ENGINE::Switch::edReleaseCase;
169 %newobject YACS::ENGINE::DynParaLoop::edRemoveNode;
170 %newobject YACS::ENGINE::DynParaLoop::edRemoveInitNode;
171 //No other way to do ??
172 %feature("pythonappend") YACS::ENGINE::Bloc::edRemoveChild(Node *node)%{
176 %newobject *::createSequenceTc;
177 %newobject *::createInterfaceTc;
178 %newobject *::createStructTc;
179 %newobject *::createType;
181 %newobject YACS::ENGINE::TypeCode::interfaceTc;
182 %newobject YACS::ENGINE::TypeCode::sequenceTc;
183 %newobject YACS::ENGINE::TypeCode::structTc;
186 * End of ownership section
190 %include <define.hxx>
191 %include <YACSBasesExport.hxx>
192 %include <Exception.hxx>
193 %include <YACSlibEngineExport.hxx>
194 %include <ConversionException.hxx>
195 %include <Runtime.hxx>
196 %include <PropertyInterface.hxx>
198 PYEXCEPTION(YACS::ENGINE::Executor::RunW)
199 PYEXCEPTION(YACS::ENGINE::Executor::RunB)
200 PYEXCEPTION(YACS::ENGINE::Executor::setExecMode)
201 PYEXCEPTION(YACS::ENGINE::Executor::resumeCurrentBreakPoint)
202 PYEXCEPTION(YACS::ENGINE::Executor::stopExecution)
203 PYEXCEPTION(YACS::ENGINE::Executor::waitPause)
204 PYEXCEPTION(YACS::ENGINE::ComponentInstance::load)
206 %include <Executor.hxx>
208 EXCEPTION(YACS::ENGINE::ExecutorSwig::RunPy)
209 EXCEPTION(YACS::ENGINE::ExecutorSwig::waitPause)
210 %include <ExecutorSwig.hxx>
212 %include <RefCounter.hxx>
216 %ignore YACS::ENGINE::TypeCode::getOrBuildAnyFromZippedData;
217 %include <TypeCode.hxx>
219 %include <Scheduler.hxx>
221 %include <Dispatcher.hxx>
222 %include <DeploymentTree.hxx>
224 %extend YACS::ENGINE::Port
226 int __cmp__(Port* other)
238 %include <DataPort.hxx>
239 %include <InPort.hxx>
240 %include <OutPort.hxx>
241 %include <InGate.hxx>
242 %include <OutGate.hxx>
243 %include <DataFlowPort.hxx>
244 %include <DataStreamPort.hxx>
246 %include <LinkInfo.hxx>
247 %include <Logger.hxx>
249 %include <ComponentInstance.hxx>
250 %include <Container.hxx>
251 %include <HomogeneousPoolContainer.hxx>
252 %include <InputPort.hxx>
253 %extend YACS::ENGINE::InputPort
255 void edInitXML(const char * s)
257 self->edInit("XML",s);
259 void edInitPy(PyObject* ob)
261 self->edInit("Python",ob);
264 %include <InPropertyPort.hxx>
265 %extend YACS::ENGINE::InPropertyPort
267 void edInitXML(const char * s)
269 self->edInit("XML",s);
271 void edInitPy(PyObject* ob)
273 self->edInit("Python",ob);
277 %template(edInitInt) YACS::ENGINE::InputPort::edInit<int>;
278 %template(edInitBool) YACS::ENGINE::InputPort::edInit<bool>;
279 %template(edInitString) YACS::ENGINE::InputPort::edInit<std::string>;
280 %template(edInitDbl) YACS::ENGINE::InputPort::edInit<double>;
282 %include <AnyInputPort.hxx>
283 %include <ConditionInputPort.hxx>
284 %include <OutputPort.hxx>
285 %include <AnyOutputPort.hxx>
286 %include <InputDataStreamPort.hxx>
287 %include <OutputDataStreamPort.hxx>
288 %include <DataPort.hxx>
291 %extend YACS::ENGINE::Node
293 int __cmp__(Node* other)
306 %include <ElementaryNode.hxx>
307 %include <InlineNode.hxx>
308 %include <ServiceNode.hxx>
309 %include <ServiceInlineNode.hxx>
310 %include <ServerNode.hxx>
311 %include <DataNode.hxx>
313 %include <ComposedNode.hxx>
314 %include <StaticDefinedComposedNode.hxx>
319 %include <ForLoop.hxx>
320 %include <DynParaLoop.hxx>
321 %include <WhileLoop.hxx>
322 %include <ForEachLoop.hxx>
323 %include <OptimizerLoop.hxx>
324 %include <Switch.hxx>
325 %include <Visitor.hxx>
326 %include <VisitorSaveSchema.hxx>
327 %include <ComponentDefinition.hxx>
328 %include <Catalog.hxx>
331 %include <AlternateThread.hxx>
332 %include <AlternateThreadPT.hxx>
334 // Ignore class OptimizerAlgASync to avoid confusion with class
335 // OptimizerAlgASync in module SALOMERuntime
336 %ignore YACS::ENGINE::OptimizerAlgASync;
337 %include <OptimizerAlg.hxx>
339 %extend YACS::ENGINE::ConditionInputPort
343 return self->getValue();
347 %extend YACS::ENGINE::AnyInputPort
349 PyObject * getPyObj()
351 return (PyObject *)getRuntime()->convertNeutral(self->edGetType(),self->getValue());
355 %extend YACS::ENGINE::AnyOutputPort
357 PyObject * getPyObj()
359 return (PyObject *)getRuntime()->convertNeutral(self->edGetType(),self->getValue());
363 %newobject YACS::ENGINE::SequenceAny::__getitem__;
364 %extend YACS::ENGINE::SequenceAny
366 Any* __getitem__(int i)
368 if (i < self->size())
375 throw std::length_error("index too large");
379 %newobject YACS::ENGINE::StructAny::__getitem__;
380 %extend YACS::ENGINE::StructAny
382 Any* __getitem__(const char * key)
384 AnyPtr a=(*self)[key];