from SHAPERSTUDY import SHAPERSTUDY_No_Session
from SALOME_ContainerPy import SALOME_ContainerPy_Gen_i
import PortableServer
+ import KernelServices
obj = orb.resolve_initial_references("RootPOA")
poa = obj._narrow(PortableServer.POA)
pman = poa._get_the_POAManager()
#
pman.activate()
#
- servant = SHAPERSTUDY_No_Session(orb,poa,conId,"FactoryServer","SHAPERSTUDY_inst_1","SHAPERSTUDY")
+ compoName = "SHAPERSTUDY"
+ servant = SHAPERSTUDY_No_Session(orb,poa,conId,"FactoryServer","SHAPERSTUDY_inst_1",compoName)
ret = servant.getCorbaRef()
+ KernelServices.RegisterCompo(compoName,ret)
return ret
raise RuntimeError("Undealed situation cont = {} module = {}".format(contName,moduleName))
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+include(${SWIG_USE_FILE})
+
INCLUDE_DIRECTORIES(
${PTHREAD_INCLUDE_DIR}
${OMNIORB_INCLUDE_DIR}
+ ${PYTHON_INCLUDE_DIRS}
${PROJECT_BINARY_DIR}/salome_adm
${CMAKE_CURRENT_SOURCE_DIR}/../NamingService
${CMAKE_CURRENT_SOURCE_DIR}/../SALOMELocalTrace
${CMAKE_CURRENT_SOURCE_DIR}/../Container
${CMAKE_CURRENT_SOURCE_DIR}/../Notification
${CMAKE_CURRENT_SOURCE_DIR}/../GenericObj
+ ${CMAKE_CURRENT_SOURCE_DIR}
${PROJECT_BINARY_DIR}/idl
)
TARGET_LINK_LIBRARIES(KernelHelpersUseCases SalomeKernelHelpers ${SalomeKernelHelpers_LIBS})
INSTALL(TARGETS KernelHelpersUseCases DESTINATION ${SALOME_INSTALL_BINS})
+#
+
+SET(KernelServices_HEADERS KernelServices.hxx KernelServices.i)
+SET(KernelServices_SOURCES KernelServices.cxx ${KernelServices_HEADERS})
+SET_SOURCE_FILES_PROPERTIES(KernelServices.i PROPERTIES CPLUSPLUS ON)
+SET_SOURCE_FILES_PROPERTIES(KernelServices.i PROPERTIES SWIG_FLAGS "-py3")
+SET_SOURCE_FILES_PROPERTIES(KernelServices_wrap.cpp PROPERTIES COMPILE_FLAGS "-DHAVE_CONFIG_H")
+SET(_swig_SCRIPTS ${CMAKE_CURRENT_BINARY_DIR}/KernelServices.py )
+IF(${CMAKE_VERSION} VERSION_LESS "3.8.0")
+ SWIG_ADD_MODULE(KernelServices python ${KernelServices_SOURCES})
+ELSE()
+ SWIG_ADD_LIBRARY(KernelServices LANGUAGE python SOURCES ${KernelServices_SOURCES})
+ENDIF()
+SWIG_LINK_LIBRARIES(KernelServices ${PYTHON_LIBRARIES} ${PLATFORM_LIBS} SalomeKernelHelpers)
+install(TARGETS _KernelServices DESTINATION ${SALOME_INSTALL_LIBS})
+install(FILES ${KernelServices_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS})
+SALOME_INSTALL_SCRIPTS("${_swig_SCRIPTS}" ${SALOME_INSTALL_BINS} EXTRA_DPYS "${SWIG_MODULE_KernelServices_REAL_NAME}")
+
+#
+
FILE(GLOB COMMON_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx")
INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${SALOME_INSTALL_HEADERS})
--- /dev/null
+// Copyright (C) 2021 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 "SALOME_KernelServices.hxx"
+
+void RegisterCompoInternal(const std::string& compoName, const std::string& compoIOR)
+{
+ CORBA::ORB_ptr orb = KERNEL::getORB();
+ CORBA::Object_var obj = orb->string_to_object(compoIOR.c_str());
+ KERNEL::RegisterCompo(compoName,obj);
+}
+
+std::string RetrieveCompoInternal(const std::string& compoName)
+{
+ CORBA::Object_var obj = KERNEL::RetrieveCompo(compoName);
+ CORBA::ORB_ptr orb = KERNEL::getORB();
+ CORBA::String_var ior = orb->object_to_string(obj);
+ return std::string(ior.in());
+}
--- /dev/null
+// Copyright (C) 2021 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 <string>
+
+void RegisterCompoInternal(const std::string& compoName, const std::string& compoIOR);
+std::string RetrieveCompoInternal(const std::string& compoName);
--- /dev/null
+// Copyright (C) 2021 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 KernelServices
+
+%include "std_string.i"
+
+%{
+#include "KernelServices.hxx"
+%}
+
+%inline
+{
+ void RegisterCompoInternal(const std::string& compoName, const std::string& compoIOR);
+ std::string RetrieveCompoInternal(const std::string& compoName);
+}
+
+%pythoncode %{
+def RegisterCompo(compoName,compoRef):
+ import CORBA
+ orb=CORBA.ORB_init([''])
+ RegisterCompoInternal(compoName,orb.object_to_string(compoRef))
+
+def RetrieveCompo(compoName):
+ import CORBA
+ orb=CORBA.ORB_init([''])
+ return orb.string_to_object(RetrieveCompoInternal(compoName))
+%}