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;
161 %newobject *::cloneAlways;
164 //Take ownership : transfer it from C++ (has to be completed)
165 %newobject YACS::ENGINE::Loop::edRemoveNode;
166 %newobject YACS::ENGINE::Switch::edReleaseDefaultNode;
167 %newobject YACS::ENGINE::Switch::edReleaseCase;
168 %newobject YACS::ENGINE::DynParaLoop::edRemoveNode;
169 %newobject YACS::ENGINE::DynParaLoop::edRemoveInitNode;
170 //No other way to do ??
171 %feature("pythonappend") YACS::ENGINE::Bloc::edRemoveChild(Node *node)%{
175 %newobject *::createSequenceTc;
176 %newobject *::createInterfaceTc;
177 %newobject *::createStructTc;
178 %newobject *::createType;
180 %newobject YACS::ENGINE::TypeCode::interfaceTc;
181 %newobject YACS::ENGINE::TypeCode::sequenceTc;
182 %newobject YACS::ENGINE::TypeCode::structTc;
185 * End of ownership section
189 %include <define.hxx>
190 %include <YACSBasesExport.hxx>
191 %include <Exception.hxx>
192 %include <YACSlibEngineExport.hxx>
193 %include <ConversionException.hxx>
194 %include <Runtime.hxx>
195 %include <PropertyInterface.hxx>
197 PYEXCEPTION(YACS::ENGINE::Executor::RunW)
198 PYEXCEPTION(YACS::ENGINE::Executor::RunB)
199 PYEXCEPTION(YACS::ENGINE::Executor::setExecMode)
200 PYEXCEPTION(YACS::ENGINE::Executor::resumeCurrentBreakPoint)
201 PYEXCEPTION(YACS::ENGINE::Executor::stopExecution)
202 PYEXCEPTION(YACS::ENGINE::Executor::waitPause)
203 PYEXCEPTION(YACS::ENGINE::ComponentInstance::load)
205 %include <Executor.hxx>
207 EXCEPTION(YACS::ENGINE::ExecutorSwig::RunPy)
208 EXCEPTION(YACS::ENGINE::ExecutorSwig::waitPause)
209 %include <ExecutorSwig.hxx>
211 %include <RefCounter.hxx>
215 %ignore YACS::ENGINE::TypeCode::getOrBuildAnyFromZippedData;
216 %include <TypeCode.hxx>
218 %include <Scheduler.hxx>
220 %include <Dispatcher.hxx>
221 %include <DeploymentTree.hxx>
223 %extend YACS::ENGINE::Port
225 int __cmp__(Port* other)
237 %include <DataPort.hxx>
238 %include <InPort.hxx>
239 %include <OutPort.hxx>
240 %include <InGate.hxx>
241 %include <OutGate.hxx>
242 %include <DataFlowPort.hxx>
243 %include <DataStreamPort.hxx>
245 %include <LinkInfo.hxx>
246 %include <Logger.hxx>
248 %include <ComponentInstance.hxx>
249 %include <Container.hxx>
250 %include <InputPort.hxx>
251 %extend YACS::ENGINE::InputPort
253 void edInitXML(const char * s)
255 self->edInit("XML",s);
257 void edInitPy(PyObject* ob)
259 self->edInit("Python",ob);
262 %include <InPropertyPort.hxx>
263 %extend YACS::ENGINE::InPropertyPort
265 void edInitXML(const char * s)
267 self->edInit("XML",s);
269 void edInitPy(PyObject* ob)
271 self->edInit("Python",ob);
275 %template(edInitInt) YACS::ENGINE::InputPort::edInit<int>;
276 %template(edInitBool) YACS::ENGINE::InputPort::edInit<bool>;
277 %template(edInitString) YACS::ENGINE::InputPort::edInit<std::string>;
278 %template(edInitDbl) YACS::ENGINE::InputPort::edInit<double>;
280 %include <AnyInputPort.hxx>
281 %include <ConditionInputPort.hxx>
282 %include <OutputPort.hxx>
283 %include <AnyOutputPort.hxx>
284 %include <InputDataStreamPort.hxx>
285 %include <OutputDataStreamPort.hxx>
286 %include <DataPort.hxx>
289 %extend YACS::ENGINE::Node
291 int __cmp__(Node* other)
304 %include <ElementaryNode.hxx>
305 %include <InlineNode.hxx>
306 %include <ServiceNode.hxx>
307 %include <ServiceInlineNode.hxx>
308 %include <ServerNode.hxx>
309 %include <DataNode.hxx>
311 %include <ComposedNode.hxx>
312 %include <StaticDefinedComposedNode.hxx>
317 %include <ForLoop.hxx>
318 %include <DynParaLoop.hxx>
319 %include <WhileLoop.hxx>
320 %include <ForEachLoop.hxx>
321 %include <OptimizerLoop.hxx>
322 %include <Switch.hxx>
323 %include <Visitor.hxx>
324 %include <VisitorSaveSchema.hxx>
325 %include <ComponentDefinition.hxx>
326 %include <Catalog.hxx>
329 %include <AlternateThread.hxx>
330 %include <AlternateThreadPT.hxx>
332 // Ignore class OptimizerAlgASync to avoid confusion with class
333 // OptimizerAlgASync in module SALOMERuntime
334 %ignore YACS::ENGINE::OptimizerAlgASync;
335 %include <OptimizerAlg.hxx>
337 %extend YACS::ENGINE::ConditionInputPort
341 return self->getValue();
345 %extend YACS::ENGINE::AnyInputPort
347 PyObject * getPyObj()
349 return (PyObject *)getRuntime()->convertNeutral(self->edGetType(),self->getValue());
353 %extend YACS::ENGINE::AnyOutputPort
355 PyObject * getPyObj()
357 return (PyObject *)getRuntime()->convertNeutral(self->edGetType(),self->getValue());
361 %newobject YACS::ENGINE::SequenceAny::__getitem__;
362 %extend YACS::ENGINE::SequenceAny
364 Any* __getitem__(int i)
366 if (i < self->size())
373 throw std::length_error("index too large");
377 %newobject YACS::ENGINE::StructAny::__getitem__;
378 %extend YACS::ENGINE::StructAny
380 Any* __getitem__(const char * key)
382 AnyPtr a=(*self)[key];