1 // Copyright (C) 2006-2008 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.
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 "All is needed to create and execute a calculation schema."
23 %module(docstring=DOCSTRING) pilot
26 //work around SWIG bug #1863647
27 #define PySwigIterator pilot_PySwigIterator
30 %feature("autodoc", "1");
32 %include "engtypemaps.i"
36 #include "TypeCode.hxx"
37 #include "ComponentDefinition.hxx"
38 #include "Visitor.hxx"
39 #include "VisitorSaveSchema.hxx"
40 #include "VisitorSaveState.hxx"
41 #include "LinkInfo.hxx"
42 #include "Catalog.hxx"
43 #include "Executor.hxx"
44 #include "ExecutorSwig.hxx"
45 #include "Dispatcher.hxx"
46 #include "Container.hxx"
48 #include "DeploymentTree.hxx"
49 #include "ComponentInstance.hxx"
50 #include "DataNode.hxx"
52 using namespace YACS::ENGINE;
60 PyObject* omnipy = PyImport_ImportModule((char*)"_omnipy");
63 PyErr_SetString(PyExc_ImportError,(char*)"Cannot import _omnipy");
66 PyObject* pyapi = PyObject_GetAttrString(omnipy, (char*)"API");
67 api = (omniORBPYAPI*)PyCObject_AsVoidPtr(pyapi);
72 %ignore YACS::ENGINE::TypeCode::operator=;
73 %ignore YACS::ENGINE::DeploymentTree::operator=;
75 %ignore YACS::ENGINE::Runtime::_tc_double;
76 %ignore YACS::ENGINE::Runtime::_tc_int;
77 %ignore YACS::ENGINE::Runtime::_tc_bool;
78 %ignore YACS::ENGINE::Runtime::_tc_string;
79 %ignore YACS::ENGINE::Runtime::_tc_file;
80 %rename(StateLoader) YACS::ENGINE::StateLoader; // to suppress a 503 warning
81 %rename(NbDoneLoader) YACS::ENGINE::NbDoneLoader; // to suppress a 503 warning
82 %rename(getRuntime) YACS::ENGINE::getRuntime; // to suppress a 503 warning
83 %rename(_from) YACS::ENGINE::DataLinkInfo::from ; // to suppress a 314 warning
84 %rename(_from) YACS::ENGINE::StreamLinkInfo::from ; // to suppress a 314 warning
89 %template() std::pair<std::string, YACS::ENGINE::TypeCode *>;
90 %template() std::pair<std::string, YACS::ENGINE::Node *>;
91 %template() std::pair<std::string, YACS::ENGINE::InlineNode *>;
92 %template() std::pair<std::string, YACS::ENGINE::ServiceNode *>;
93 %template() std::pair<std::string, YACS::ENGINE::Container *>;
94 %template() std::pair<YACS::ENGINE::OutPort *,YACS::ENGINE::InPort *>;
95 %template() std::pair<YACS::ENGINE::InPort *,YACS::ENGINE::OutPort *>;
96 //%template(TCmap) std::map<std::string, YACS::ENGINE::TypeCode *>;
97 REFCOUNT_TEMPLATE(TCmap,YACS::ENGINE::TypeCode)
98 %template(NODEmap) std::map<std::string, YACS::ENGINE::Node *>;
99 %template(INODEmap) std::map<std::string, YACS::ENGINE::InlineNode *>;
100 %template(SNODEmap) std::map<std::string, YACS::ENGINE::ServiceNode *>;
101 //%template(CONTAINmap) std::map<std::string, YACS::ENGINE::Container *>;
102 REFCOUNT_TEMPLATE(CONTAINmap,YACS::ENGINE::Container)
103 %template(strvec) std::vector<std::string>;
104 %template(linksvec) std::vector< std::pair<YACS::ENGINE::OutPort *,YACS::ENGINE::InPort *> >;
105 %template(linkvec) std::vector< std::pair<YACS::ENGINE::InPort *,YACS::ENGINE::OutPort *> >;
106 %template(instreamlist) std::list<YACS::ENGINE::InputDataStreamPort *>;
107 %template(outstreamlist) std::list<YACS::ENGINE::OutputDataStreamPort *>;
109 %template() std::pair<std::string, YACS::ENGINE::CatalogLoader *>;
110 %template(loadermap) std::map<std::string,YACS::ENGINE::CatalogLoader *>;
111 %template() std::pair<std::string, YACS::ENGINE::ComposedNode *>;
112 %template(composedmap) std::map<std::string,YACS::ENGINE::ComposedNode *>;
113 %template() std::pair<std::string, YACS::ENGINE::ComponentDefinition *>;
114 %template(compomap) std::map<std::string, YACS::ENGINE::ComponentDefinition *>;
115 %template() std::pair<std::string, std::string>;
116 %template(propmap) std::map<std::string, std::string>;
119 * End of Template section
126 //Take ownership : it is not the default (constructor) as it is a factory
127 %newobject YACS::ENGINE::Runtime::createProc;
128 %newobject YACS::ENGINE::Runtime::createScriptNode;
129 %newobject YACS::ENGINE::Runtime::createFuncNode;
130 %newobject YACS::ENGINE::Runtime::createRefNode;
131 %newobject YACS::ENGINE::Runtime::createCompoNode;
132 %newobject YACS::ENGINE::Runtime::createSInlineNode;
133 %newobject YACS::ENGINE::Runtime::createInDataNode;
134 %newobject YACS::ENGINE::Runtime::createOutDataNode;
135 %newobject YACS::ENGINE::Runtime::createBloc;
136 %newobject YACS::ENGINE::Runtime::createForLoop;
137 %newobject YACS::ENGINE::Runtime::createForEachLoop;
138 %newobject YACS::ENGINE::Runtime::createWhileLoop;
139 %newobject YACS::ENGINE::Runtime::createSwitch;
140 %newobject YACS::ENGINE::Runtime::loadCatalog;
141 %newobject YACS::ENGINE::Runtime::createComponentInstance;
142 %newobject YACS::ENGINE::Runtime::createContainer;
143 %newobject YACS::ENGINE::Runtime::createInputPort;
144 %newobject YACS::ENGINE::Runtime::createOutputPort;
145 %newobject YACS::ENGINE::Runtime::createInputDataStreamPort;
146 %newobject YACS::ENGINE::Runtime::createOutputDataStreamPort;
147 %newobject YACS::ENGINE::Node::clone;
149 //Take ownership : transfer it from C++ (has to be completed)
150 %newobject YACS::ENGINE::Loop::edRemoveNode;
151 %newobject YACS::ENGINE::Switch::edReleaseDefaultNode;
152 %newobject YACS::ENGINE::Switch::edReleaseCase;
153 %newobject YACS::ENGINE::DynParaLoop::edRemoveNode;
154 %newobject YACS::ENGINE::DynParaLoop::edRemoveInitNode;
155 //No other way to do ??
156 %feature("pythonappend") YACS::ENGINE::Bloc::edRemoveChild(Node *node)%{
160 %newobject YACS::ENGINE::Proc::createContainer;
161 %newobject YACS::ENGINE::Proc::createSequenceTc;
162 %newobject YACS::ENGINE::Proc::createInterfaceTc;
163 %newobject YACS::ENGINE::Proc::createStructTc;
164 %newobject YACS::ENGINE::Proc::createType;
166 %newobject YACS::ENGINE::TypeCode::interfaceTc;
167 %newobject YACS::ENGINE::TypeCode::sequenceTc;
168 %newobject YACS::ENGINE::TypeCode::structTc;
171 * End of ownership section
174 %include <define.hxx>
175 %include <Exception.hxx>
176 %include <ConversionException.hxx>
177 %include <Runtime.hxx>
179 PYEXCEPTION(YACS::ENGINE::Executor::RunW)
180 PYEXCEPTION(YACS::ENGINE::Executor::RunB)
181 PYEXCEPTION(YACS::ENGINE::Executor::setExecMode)
182 PYEXCEPTION(YACS::ENGINE::Executor::resumeCurrentBreakPoint)
183 PYEXCEPTION(YACS::ENGINE::Executor::stopExecution)
184 PYEXCEPTION(YACS::ENGINE::Executor::waitPause)
185 PYEXCEPTION(YACS::ENGINE::ComponentInstance::load)
187 %include <Executor.hxx>
189 EXCEPTION(YACS::ENGINE::ExecutorSwig::RunPy)
190 EXCEPTION(YACS::ENGINE::ExecutorSwig::waitPause)
191 %include <ExecutorSwig.hxx>
193 %include <RefCounter.hxx>
195 %ignore YACS::ENGINE::TypeCode::getOrBuildAnyFromZippedData;
196 %include <TypeCode.hxx>
198 %include <Scheduler.hxx>
200 %include <Dispatcher.hxx>
201 %include <DeploymentTree.hxx>
203 %extend YACS::ENGINE::Port
205 int __cmp__(Port* other)
217 %include <DataPort.hxx>
218 %include <InPort.hxx>
219 %include <OutPort.hxx>
220 %include <InGate.hxx>
221 %include <OutGate.hxx>
222 %include <DataFlowPort.hxx>
223 %include <DataStreamPort.hxx>
225 %include <LinkInfo.hxx>
226 %include <Logger.hxx>
228 %include <ComponentInstance.hxx>
229 %include <Container.hxx>
230 %include <InputPort.hxx>
231 %extend YACS::ENGINE::InputPort
233 void edInitXML(const char * s)
235 self->edInit("XML",s);
237 void edInitPy(PyObject* ob)
239 self->edInit("Python",ob);
243 %template(edInitInt) YACS::ENGINE::InputPort::edInit<int>;
244 %template(edInitBool) YACS::ENGINE::InputPort::edInit<bool>;
245 %template(edInitString) YACS::ENGINE::InputPort::edInit<std::string>;
246 %template(edInitDbl) YACS::ENGINE::InputPort::edInit<double>;
248 %include <AnyInputPort.hxx>
249 %include <ConditionInputPort.hxx>
250 %include <OutputPort.hxx>
251 %include <InputDataStreamPort.hxx>
252 %include <OutputDataStreamPort.hxx>
253 %include <DataPort.hxx>
256 %extend YACS::ENGINE::Node
258 int __cmp__(Node* other)
271 %include <ElementaryNode.hxx>
272 %include <InlineNode.hxx>
273 %include <ServiceNode.hxx>
274 %include <ServiceInlineNode.hxx>
275 %include <DataNode.hxx>
277 %include <ComposedNode.hxx>
278 %include <StaticDefinedComposedNode.hxx>
283 %include <ForLoop.hxx>
284 %include <DynParaLoop.hxx>
285 %include <WhileLoop.hxx>
286 %include <ForEachLoop.hxx>
287 %include <OptimizerAlg.hxx>
288 %include <OptimizerLoop.hxx>
289 %include <Switch.hxx>
290 %include <Visitor.hxx>
291 %include <VisitorSaveSchema.hxx>
292 %include <ComponentDefinition.hxx>
293 %include <Catalog.hxx>
295 %extend YACS::ENGINE::ConditionInputPort
299 return self->getValue();
303 %extend YACS::ENGINE::AnyInputPort
305 PyObject * getPyObj()
307 return (PyObject *)getRuntime()->convertNeutral(self->edGetType(),self->getValue());
311 %extend YACS::ENGINE::AnyOutputPort
313 PyObject * getPyObj()
315 return (PyObject *)getRuntime()->convertNeutral(self->edGetType(),self->getValue());