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"
57 #include "DeploymentTree.hxx"
58 #include "ComponentInstance.hxx"
59 #include "DataNode.hxx"
61 using namespace YACS::ENGINE;
69 PyObject* omnipy = PyImport_ImportModule((char*)"_omnipy");
72 PyErr_SetString(PyExc_ImportError,(char*)"Cannot import _omnipy");
75 PyObject* pyapi = PyObject_GetAttrString(omnipy, (char*)"API");
76 api = (omniORBPYAPI*)PyCObject_AsVoidPtr(pyapi);
81 %ignore YACS::ENGINE::Any::operator[];
82 %ignore YACS::ENGINE::TypeCode::operator=;
83 %ignore YACS::ENGINE::DeploymentTree::operator=;
85 %ignore YACS::ENGINE::Runtime::_tc_double;
86 %ignore YACS::ENGINE::Runtime::_tc_int;
87 %ignore YACS::ENGINE::Runtime::_tc_bool;
88 %ignore YACS::ENGINE::Runtime::_tc_string;
89 %ignore YACS::ENGINE::Runtime::_tc_file;
90 %rename(StateLoader) YACS::ENGINE::StateLoader; // to suppress a 503 warning
91 %rename(NbDoneLoader) YACS::ENGINE::NbDoneLoader; // to suppress a 503 warning
92 %rename(getRuntime) YACS::ENGINE::getRuntime; // to suppress a 503 warning
93 %rename(_from) YACS::ENGINE::DataLinkInfo::from ; // to suppress a 314 warning
94 %rename(_from) YACS::ENGINE::StreamLinkInfo::from ; // to suppress a 314 warning
99 %template() std::pair<std::string, YACS::ENGINE::TypeCode *>;
100 %template() std::pair<std::string, YACS::ENGINE::Node *>;
101 %template() std::pair<std::string, YACS::ENGINE::InlineNode *>;
102 %template() std::pair<std::string, YACS::ENGINE::ServiceNode *>;
103 %template() std::pair<std::string, YACS::ENGINE::Container *>;
104 %template() std::pair<YACS::ENGINE::OutPort *,YACS::ENGINE::InPort *>;
105 %template() std::pair<YACS::ENGINE::InPort *,YACS::ENGINE::OutPort *>;
106 //%template(TCmap) std::map<std::string, YACS::ENGINE::TypeCode *>;
107 REFCOUNT_TEMPLATE(TCmap,YACS::ENGINE::TypeCode)
108 %template(NODEmap) std::map<std::string, YACS::ENGINE::Node *>;
109 %template(INODEmap) std::map<std::string, YACS::ENGINE::InlineNode *>;
110 %template(SNODEmap) std::map<std::string, YACS::ENGINE::ServiceNode *>;
111 //%template(CONTAINmap) std::map<std::string, YACS::ENGINE::Container *>;
112 REFCOUNT_TEMPLATE(CONTAINmap,YACS::ENGINE::Container)
113 %template(strvec) std::vector<std::string>;
114 %template(linksvec) std::vector< std::pair<YACS::ENGINE::OutPort *,YACS::ENGINE::InPort *> >;
115 %template(linkvec) std::vector< std::pair<YACS::ENGINE::InPort *,YACS::ENGINE::OutPort *> >;
116 %template(instreamlist) std::list<YACS::ENGINE::InputDataStreamPort *>;
117 %template(outstreamlist) std::list<YACS::ENGINE::OutputDataStreamPort *>;
119 %template() std::pair<std::string, YACS::ENGINE::CatalogLoader *>;
120 %template(loadermap) std::map<std::string,YACS::ENGINE::CatalogLoader *>;
121 %template() std::pair<std::string, YACS::ENGINE::ComposedNode *>;
122 %template(composedmap) std::map<std::string,YACS::ENGINE::ComposedNode *>;
123 %template() std::pair<std::string, YACS::ENGINE::ComponentDefinition *>;
124 %template(compomap) std::map<std::string, YACS::ENGINE::ComponentDefinition *>;
125 %template() std::pair<std::string, std::string>;
126 %template(propmap) std::map<std::string, std::string>;
128 REFCOUNT_TEMPLATE(CompoInstmap,YACS::ENGINE::ComponentInstance)
130 * End of Template section
137 //Take ownership : it is not the default (constructor) as it is a factory
138 %newobject *::createProc;
139 %newobject *::createScriptNode;
140 %newobject *::createFuncNode;
141 %newobject *::createRefNode;
142 %newobject *::createCompoNode;
143 %newobject *::createSInlineNode;
144 %newobject *::createInDataNode;
145 %newobject *::createOutDataNode;
146 %newobject *::createBloc;
147 %newobject *::createForLoop;
148 %newobject *::createForEachLoop;
149 %newobject *::createWhileLoop;
150 %newobject *::createSwitch;
151 %newobject *::loadCatalog;
152 %newobject *::createComponentInstance;
153 %newobject *::createContainer;
156 %newobject *::createInputPort;
157 %newobject *::createOutputPort;
158 %newobject *::createInputDataStreamPort;
159 %newobject *::createOutputDataStreamPort;
163 //Take ownership : transfer it from C++ (has to be completed)
164 %newobject YACS::ENGINE::Loop::edRemoveNode;
165 %newobject YACS::ENGINE::Switch::edReleaseDefaultNode;
166 %newobject YACS::ENGINE::Switch::edReleaseCase;
167 %newobject YACS::ENGINE::DynParaLoop::edRemoveNode;
168 %newobject YACS::ENGINE::DynParaLoop::edRemoveInitNode;
169 //No other way to do ??
170 %feature("pythonappend") YACS::ENGINE::Bloc::edRemoveChild(Node *node)%{
174 %newobject *::createSequenceTc;
175 %newobject *::createInterfaceTc;
176 %newobject *::createStructTc;
177 %newobject *::createType;
179 %newobject YACS::ENGINE::TypeCode::interfaceTc;
180 %newobject YACS::ENGINE::TypeCode::sequenceTc;
181 %newobject YACS::ENGINE::TypeCode::structTc;
184 * End of ownership section
188 %include <define.hxx>
189 %include <YACSBasesExport.hxx>
190 %include <Exception.hxx>
191 %include <YACSlibEngineExport.hxx>
192 %include <ConversionException.hxx>
193 %include <Runtime.hxx>
194 %include <PropertyInterface.hxx>
196 PYEXCEPTION(YACS::ENGINE::Executor::RunW)
197 PYEXCEPTION(YACS::ENGINE::Executor::RunB)
198 PYEXCEPTION(YACS::ENGINE::Executor::setExecMode)
199 PYEXCEPTION(YACS::ENGINE::Executor::resumeCurrentBreakPoint)
200 PYEXCEPTION(YACS::ENGINE::Executor::stopExecution)
201 PYEXCEPTION(YACS::ENGINE::Executor::waitPause)
202 PYEXCEPTION(YACS::ENGINE::ComponentInstance::load)
204 %include <Executor.hxx>
206 EXCEPTION(YACS::ENGINE::ExecutorSwig::RunPy)
207 EXCEPTION(YACS::ENGINE::ExecutorSwig::waitPause)
208 %include <ExecutorSwig.hxx>
210 %include <RefCounter.hxx>
214 %ignore YACS::ENGINE::TypeCode::getOrBuildAnyFromZippedData;
215 %include <TypeCode.hxx>
217 %include <Scheduler.hxx>
219 %include <Dispatcher.hxx>
220 %include <DeploymentTree.hxx>
222 %extend YACS::ENGINE::Port
224 int __cmp__(Port* other)
236 %include <DataPort.hxx>
237 %include <InPort.hxx>
238 %include <OutPort.hxx>
239 %include <InGate.hxx>
240 %include <OutGate.hxx>
241 %include <DataFlowPort.hxx>
242 %include <DataStreamPort.hxx>
244 %include <LinkInfo.hxx>
245 %include <Logger.hxx>
247 %include <ComponentInstance.hxx>
248 %include <Container.hxx>
249 %include <InputPort.hxx>
250 %extend YACS::ENGINE::InputPort
252 void edInitXML(const char * s)
254 self->edInit("XML",s);
256 void edInitPy(PyObject* ob)
258 self->edInit("Python",ob);
261 %include <InPropertyPort.hxx>
262 %extend YACS::ENGINE::InPropertyPort
264 void edInitXML(const char * s)
266 self->edInit("XML",s);
268 void edInitPy(PyObject* ob)
270 self->edInit("Python",ob);
274 %template(edInitInt) YACS::ENGINE::InputPort::edInit<int>;
275 %template(edInitBool) YACS::ENGINE::InputPort::edInit<bool>;
276 %template(edInitString) YACS::ENGINE::InputPort::edInit<std::string>;
277 %template(edInitDbl) YACS::ENGINE::InputPort::edInit<double>;
279 %include <AnyInputPort.hxx>
280 %include <ConditionInputPort.hxx>
281 %include <OutputPort.hxx>
282 %include <AnyOutputPort.hxx>
283 %include <InputDataStreamPort.hxx>
284 %include <OutputDataStreamPort.hxx>
285 %include <DataPort.hxx>
288 %extend YACS::ENGINE::Node
290 int __cmp__(Node* other)
303 %include <ElementaryNode.hxx>
304 %include <InlineNode.hxx>
305 %include <ServiceNode.hxx>
306 %include <ServiceInlineNode.hxx>
307 %include <ServerNode.hxx>
308 %include <DataNode.hxx>
310 %include <ComposedNode.hxx>
311 %include <StaticDefinedComposedNode.hxx>
316 %include <ForLoop.hxx>
317 %include <DynParaLoop.hxx>
318 %include <WhileLoop.hxx>
319 %include <ForEachLoop.hxx>
320 %include <OptimizerLoop.hxx>
321 %include <Switch.hxx>
322 %include <Visitor.hxx>
323 %include <VisitorSaveSchema.hxx>
324 %include <ComponentDefinition.hxx>
325 %include <Catalog.hxx>
328 %include <AlternateThread.hxx>
329 %include <AlternateThreadPT.hxx>
331 // Ignore class OptimizerAlgASync to avoid confusion with class
332 // OptimizerAlgASync in module SALOMERuntime
333 %ignore YACS::ENGINE::OptimizerAlgASync;
334 %include <OptimizerAlg.hxx>
336 %extend YACS::ENGINE::ConditionInputPort
340 return self->getValue();
344 %extend YACS::ENGINE::AnyInputPort
346 PyObject * getPyObj()
348 return (PyObject *)getRuntime()->convertNeutral(self->edGetType(),self->getValue());
352 %extend YACS::ENGINE::AnyOutputPort
354 PyObject * getPyObj()
356 return (PyObject *)getRuntime()->convertNeutral(self->edGetType(),self->getValue());
360 %newobject YACS::ENGINE::SequenceAny::__getitem__;
361 %extend YACS::ENGINE::SequenceAny
363 Any* __getitem__(int i)
365 if (i < self->size())
372 throw std::length_error("index too large");
376 %newobject YACS::ENGINE::StructAny::__getitem__;
377 %extend YACS::ENGINE::StructAny
379 Any* __getitem__(const char * key)
381 AnyPtr a=(*self)[key];