// Copyright (C) 2006-2015 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // %define DOCSTRING "All is needed to create and execute a calculation schema." %enddef %module(docstring=DOCSTRING) pilot #ifndef SWIGIMPORTED //work around SWIG bug #1863647 #if SWIG_VERSION >= 0x010336 #define SwigPyIterator pilot_PySwigIterator #else #define PySwigIterator pilot_PySwigIterator #endif #endif %feature("autodoc", "1"); %include "engtypemaps.i" #ifdef DOXYGEN_IS_OK %include docengine.i #endif %{ #include "Any.hxx" #include "TypeCode.hxx" #include "ComponentDefinition.hxx" #include "Visitor.hxx" #include "VisitorSaveSchema.hxx" #include "VisitorSaveState.hxx" #include "LinkInfo.hxx" #include "Catalog.hxx" #include "Executor.hxx" #include "ExecutorSwig.hxx" #include "Dispatcher.hxx" #include "Container.hxx" #include "HomogeneousPoolContainer.hxx" #include "Logger.hxx" #include "DeploymentTree.hxx" #include "ComponentInstance.hxx" #include "DataNode.hxx" using namespace YACS::ENGINE; %} %init %{ // init section #ifdef OMNIORB PyObject* omnipy = PyImport_ImportModule((char*)"_omnipy"); if (!omnipy) { PyErr_SetString(PyExc_ImportError,(char*)"Cannot import _omnipy"); return; } PyObject* pyapi = PyObject_GetAttrString(omnipy, (char*)"API"); api = (omniORBPYAPI*)PyCObject_AsVoidPtr(pyapi); Py_DECREF(pyapi); #endif %} %ignore YACS::ENGINE::Any::operator[]; %ignore YACS::ENGINE::TypeCode::operator=; %ignore YACS::ENGINE::DeploymentTree::operator=; %ignore operator<<; %ignore YACS::ENGINE::Runtime::_tc_double; %ignore YACS::ENGINE::Runtime::_tc_int; %ignore YACS::ENGINE::Runtime::_tc_bool; %ignore YACS::ENGINE::Runtime::_tc_string; %ignore YACS::ENGINE::Runtime::_tc_file; %rename(StateLoader) YACS::ENGINE::StateLoader; // to suppress a 503 warning %rename(NbDoneLoader) YACS::ENGINE::NbDoneLoader; // to suppress a 503 warning %rename(getRuntime) YACS::ENGINE::getRuntime; // to suppress a 503 warning %rename(_from) YACS::ENGINE::DataLinkInfo::from ; // to suppress a 314 warning %rename(_from) YACS::ENGINE::StreamLinkInfo::from ; // to suppress a 314 warning /* * Template section */ %template() std::pair; %template() std::pair; %template() std::pair; %template() std::pair; %template() std::pair; %template() std::pair; %template() std::pair; //%template(TCmap) std::map; REFCOUNT_TEMPLATE(TCmap,YACS::ENGINE::TypeCode) %template(NODEmap) std::map; %template(INODEmap) std::map; %template(SNODEmap) std::map; //%template(CONTAINmap) std::map; REFCOUNT_TEMPLATE(CONTAINmap,YACS::ENGINE::Container) %template(strvec) std::vector; %template(linksvec) std::vector< std::pair >; %template(linkvec) std::vector< std::pair >; %template(instreamlist) std::list; %template(outstreamlist) std::list; %template() std::pair; %template(loadermap) std::map; %template() std::pair; %template(composedmap) std::map; %template() std::pair; %template(compomap) std::map; %template() std::pair; %template(propmap) std::map; REFCOUNT_TEMPLATE(CompoInstmap,YACS::ENGINE::ComponentInstance) /* * End of Template section */ %typemap(out) Container * { $result=convertContainer($1,$owner); } %typemap(out) YACS::ENGINE::Container * { $result=convertContainer($1,$owner); } /* * Ownership section */ //Take ownership : it is not the default (constructor) as it is a factory %newobject *::createProc; %newobject *::createScriptNode; %newobject *::createFuncNode; %newobject *::createRefNode; %newobject *::createCompoNode; %newobject *::createSInlineNode; %newobject *::createInDataNode; %newobject *::createOutDataNode; %newobject *::createBloc; %newobject *::createForLoop; %newobject *::createForEachLoop; %newobject *::createWhileLoop; %newobject *::createSwitch; %newobject *::loadCatalog; %newobject *::createComponentInstance; %newobject *::createContainer; %newobject *::createInputPort; %newobject *::createOutputPort; %newobject *::createInputDataStreamPort; %newobject *::createOutputDataStreamPort; %newobject *::clone; %newobject *::cloneAlways; %newobject *::cloneWithoutCompAndContDeepCpy; %newobject *::New; //Take ownership : transfer it from C++ (has to be completed) %newobject YACS::ENGINE::Loop::edRemoveNode; %newobject YACS::ENGINE::Switch::edReleaseDefaultNode; %newobject YACS::ENGINE::Switch::edReleaseCase; %newobject YACS::ENGINE::DynParaLoop::edRemoveNode; %newobject YACS::ENGINE::DynParaLoop::edRemoveInitNode; //No other way to do ?? %feature("pythonappend") YACS::ENGINE::Bloc::edRemoveChild(Node *node)%{ args[1].thisown=1 %} %newobject *::createSequenceTc; %newobject *::createInterfaceTc; %newobject *::createStructTc; %newobject *::createType; %newobject YACS::ENGINE::SequenceAny::removeUnsetItemsFromThis; %newobject YACS::ENGINE::TypeCode::interfaceTc; %newobject YACS::ENGINE::TypeCode::sequenceTc; %newobject YACS::ENGINE::TypeCode::structTc; /* * End of ownership section */ %include %include %include %include %include %include %include PYEXCEPTION(YACS::ENGINE::Executor::RunW) PYEXCEPTION(YACS::ENGINE::Executor::RunB) PYEXCEPTION(YACS::ENGINE::Executor::setExecMode) PYEXCEPTION(YACS::ENGINE::Executor::resumeCurrentBreakPoint) PYEXCEPTION(YACS::ENGINE::Executor::stopExecution) PYEXCEPTION(YACS::ENGINE::Executor::waitPause) PYEXCEPTION(YACS::ENGINE::ComponentInstance::load) %include EXCEPTION(YACS::ENGINE::ExecutorSwig::RunPy) EXCEPTION(YACS::ENGINE::ExecutorSwig::waitPause) %include %include %include %ignore YACS::ENGINE::TypeCode::getOrBuildAnyFromZippedData; %include %include %include %include %include %include %extend YACS::ENGINE::Port { int __cmp__(Port* other) { if(self==other) return 0; else return 1; } long ptr() { return (long)self; } } %include %include %include %include %include %include %include %include %include %include %include %include %include %extend YACS::ENGINE::InputPort { void edInitXML(const char * s) { self->edInit("XML",s); } void edInitPy(PyObject* ob) { self->edInit("Python",ob); } } %include %extend YACS::ENGINE::InPropertyPort { void edInitXML(const char * s) { self->edInit("XML",s); } void edInitPy(PyObject* ob) { self->edInit("Python",ob); } } %template(edInitInt) YACS::ENGINE::InputPort::edInit; %template(edInitBool) YACS::ENGINE::InputPort::edInit; %template(edInitString) YACS::ENGINE::InputPort::edInit; %template(edInitDbl) YACS::ENGINE::InputPort::edInit; %include %include %include %include %include %include %include %include %extend YACS::ENGINE::Node { int __cmp__(Node* other) { if(self==other) return 0; else return 1; } long ptr() { return (long)self; } } %include %include %include %include %include %include %include %include %include %include %include %include %include %include %include %include %include %include %include %include %include %include %include %include // Ignore class OptimizerAlgASync to avoid confusion with class // OptimizerAlgASync in module SALOMERuntime %ignore YACS::ENGINE::OptimizerAlgASync; %include %extend YACS::ENGINE::ConditionInputPort { bool getPyObj() { return self->getValue(); } } %extend YACS::ENGINE::AnyInputPort { PyObject * getPyObj() { return (PyObject *)getRuntime()->convertNeutral(self->edGetType(),self->getValue()); } } %extend YACS::ENGINE::AnyOutputPort { PyObject * getPyObj() { return (PyObject *)getRuntime()->convertNeutral(self->edGetType(),self->getValue()); } } %extend YACS::ENGINE::Any { PyObject *getPyObj() { return (PyObject *)getRuntime()->convertNeutral(const_cast(self->getType()),self); } } %newobject YACS::ENGINE::SequenceAny::__getitem__; %extend YACS::ENGINE::SequenceAny { Any* __getitem__(int i) { if (i < self->size()) { AnyPtr a=(*self)[i]; a->incrRef(); return a; } else throw std::length_error("index too large"); } } %newobject YACS::ENGINE::StructAny::__getitem__; %extend YACS::ENGINE::StructAny { Any* __getitem__(const char * key) { AnyPtr a=(*self)[key]; a->incrRef(); return a; } } %extend YACS::ENGINE::ForEachLoop { PyObject *getPassedResults(Executor *execut) const { std::vector ret1; std::vector ret2; std::vector ret0(self->getPassedResults(execut,ret1,ret2)); PyObject *ret(PyTuple_New(3)); // param 0 PyObject *ret0Py(PyList_New(ret0.size())); for(std::size_t i=0;i