# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+include(${SWIG_USE_FILE})
+
INCLUDE_DIRECTORIES(
${OMNIORB_INCLUDE_DIR}
${PTHREAD_INCLUDE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/../SALOMETraceCollector/Test
${CMAKE_CURRENT_SOURCE_DIR}/../KernelHelpers
${PROJECT_BINARY_DIR}/idl
+ ${CMAKE_CURRENT_SOURCE_DIR}
)
SET(SCRIPTS
IF(SALOME_BUILD_TESTS)
ADD_SUBDIRECTORY(Test)
ENDIF(SALOME_BUILD_TESTS)
+
+SET(KernelContainer_HEADERS KernelContainer.hxx KernelContainer.i)
+SET(KernelContainer_SOURCES KernelContainer.cxx ${KernelContainer_HEADERS})
+SET_SOURCE_FILES_PROPERTIES(KernelContainer.i PROPERTIES CPLUSPLUS ON)
+SET_SOURCE_FILES_PROPERTIES(KernelContainer.i PROPERTIES SWIG_FLAGS "-py3")
+SET_SOURCE_FILES_PROPERTIES(KernelContainer_wrap.cpp PROPERTIES COMPILE_FLAGS "-DHAVE_CONFIG_H")
+SET(_swig_SCRIPTS ${CMAKE_CURRENT_BINARY_DIR}/KernelContainer.py )
+IF(${CMAKE_VERSION} VERSION_LESS "3.8.0")
+ SWIG_ADD_MODULE(KernelContainer python ${KernelContainer_SOURCES})
+ELSE()
+ SWIG_ADD_LIBRARY(KernelContainer LANGUAGE python SOURCES ${KernelContainer_SOURCES})
+ENDIF()
+IF(${MACHINE} STREQUAL WINDOWS)
+ SET_TARGET_PROPERTIES(_KernelContainer PROPERTIES DEBUG_OUTPUT_NAME _KernelContainer_d)
+ENDIF(${MACHINE} STREQUAL WINDOWS)
+SWIG_LINK_LIBRARIES(KernelContainer ${PYTHON_LIBRARIES} ${PLATFORM_LIBS} SalomeContainer SalomeKernelHelpers)
+install(TARGETS _KernelContainer DESTINATION ${SALOME_INSTALL_LIBS})
+install(FILES ${KernelContainer_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS})
+SALOME_INSTALL_SCRIPTS("${_swig_SCRIPTS}" ${SALOME_INSTALL_BINS} EXTRA_DPYS "${SWIG_MODULE_KernelContainer_REAL_NAME}")
--- /dev/null
+// Copyright (C) 2022 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
+//
+
+#include "KernelContainer.hxx"
+
+#include "SALOME_Container_i.hxx"
+#include "SALOME_KernelORB.hxx"
+
+std::string GetContainerInstance()
+{
+ Engines::Container_var cont = KERNEL::getContainerRefSA();
+ CORBA::ORB_ptr orb = KERNEL::getORB();
+ CORBA::String_var ior = orb->object_to_string(cont);
+ return std::string(ior.in());
+}
--- /dev/null
+// Copyright (C) 2022 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
+//
+
+#pragma once
+
+#include <string>
+
+std::string GetContainerInstance();
--- /dev/null
+// Copyright (C) 2022 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
+//
+
+%module KernelContainer
+
+%include "std_string.i"
+
+%{
+#include "KernelContainer.hxx"
+%}
+
+%inline
+{
+ std::string GetContainerInstance();
+}
+
+%pythoncode %{
+def myContainer():
+ import Engines
+ import CORBA
+ orb=CORBA.ORB_init([''])
+ return orb.string_to_object(GetContainerInstance())
+%}
import KernelLauncher
cm = KernelLauncher.myContainerManager()
lcc = StandAloneLifecyle(cm, KernelLauncher.myResourcesManager())
+ # create a FactoryServer Container servant
+ import KernelContainer
+ KernelContainer.myContainer()
# activate poaManager to accept co-localized CORBA calls.
from KernelSDS import GetDSMInstance
import sys