X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2Fruntime_swig%2FSALOMERuntime.i;h=40a200ad244b428f66c54499ffddeadbc3dd37e8;hb=1894c52d0838df8676e770bef061fc23ca436452;hp=b7eb87f44a8f501a92d276db985e90fce43d09d8;hpb=14ddeddd588b20887c99de78c95d402527062012;p=modules%2Fyacs.git diff --git a/src/runtime_swig/SALOMERuntime.i b/src/runtime_swig/SALOMERuntime.i index b7eb87f44..40a200ad2 100644 --- a/src/runtime_swig/SALOMERuntime.i +++ b/src/runtime_swig/SALOMERuntime.i @@ -1,4 +1,4 @@ -// Copyright (C) 2006-2014 CEA/DEN, EDF R&D +// Copyright (C) 2006-2024 CEA, EDF // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -44,6 +44,7 @@ %{ #include "SalomeContainer.hxx" +#include "SalomeHPContainer.hxx" #include "RuntimeSALOME.hxx" #include "SALOMEDispatcher.hxx" #include "SalomeProc.hxx" @@ -58,11 +59,14 @@ #include "TypeConversions.hxx" #include "TypeCode.hxx" #include "VisitorSaveSalomeSchema.hxx" +#include "VisitorSalomeSaveState.hxx" #include "SalomeOptimizerLoop.hxx" #include "DistributedPythonNode.hxx" #include "PyOptimizerAlg.hxx" #include "PyStdout.hxx" +#include "ExecutorSwig.hxx" #include +#include "Catalog.hxx" %} // ---------------------------------------------------------------------------- @@ -75,13 +79,30 @@ if (!omnipy) { PyErr_SetString(PyExc_ImportError,(char*)"Cannot import _omnipy"); - return; + return NULL; } PyObject* pyapi = PyObject_GetAttrString(omnipy, (char*)"API"); - api = (omniORBPYAPI*)PyCObject_AsVoidPtr(pyapi); + api = (omniORBpyAPI*)PyCapsule_GetPointer(pyapi,"_omnipy.API"); Py_DECREF(pyapi); %} +%{ +static PyObject *convertContainer2(YACS::ENGINE::Container *cont, int owner=0) +{ + if(!cont) + return SWIG_NewPointerObj((void*)cont,SWIGTYPE_p_YACS__ENGINE__Container, owner); + if(dynamic_cast(cont)) + { + return SWIG_NewPointerObj((void*)dynamic_cast(cont),SWIGTYPE_p_YACS__ENGINE__SalomeHPContainer, owner); + } + if(dynamic_cast(cont)) + { + return SWIG_NewPointerObj((void*)dynamic_cast(cont),SWIGTYPE_p_YACS__ENGINE__SalomeContainer, owner); + } + return SWIG_NewPointerObj((void*)cont,SWIGTYPE_p_YACS__ENGINE__Container, owner); +} +%} + // ---------------------------------------------------------------------------- #ifdef SWIGPYTHON @@ -117,6 +138,7 @@ %include %include "SalomeContainer.hxx" +%include "SalomeHPContainer.hxx" %include "RuntimeSALOME.hxx" %include "SALOMEDispatcher.hxx" %include "SalomeProc.hxx" @@ -132,6 +154,17 @@ %include "SalomeOptimizerLoop.hxx" %include "DistributedPythonNode.hxx" +namespace YACS +{ + namespace ENGINE + { + void schemaSaveState(Proc* proc, + Executor* exec, + const std::string& xmlSchemaFile); + } +} + + %extend YACS::ENGINE::OutputPresetPort { void setDataPy(PyObject *ob) @@ -195,4 +228,22 @@ // becomes a real derived class, this will have to be changed. %rename(OptimizerAlgSync) YACS::ENGINE::PyOptimizerAlgBase; %rename(OptimizerAlgASync) YACS::ENGINE::PyOptimizerAlgASync; + %include "PyOptimizerAlg.hxx" + +%newobject YACS::ENGINE::RuntimeSALOME::createAnyPyObject; + +%extend YACS::ENGINE::RuntimeSALOME +{ + PyObject *createContainer(const std::string& kind="") + { + YACS::ENGINE::Container *ret(self->createContainer(kind)); + return convertContainer2(ret,SWIG_POINTER_OWN | 0); + } + + Any* createAnyPyObject(PyObject * pyobj) + { + return convertPyObjectNeutral(self->getBuiltinCatalog()->_typeMap["pyobj"], + pyobj); + } +}