From 109894e0c8f516b258793b42d62f857598b803f3 Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Thu, 14 Jan 2021 07:28:03 +0100 Subject: [PATCH] WIP --- src/KernelHelpers/SALOME_KernelServices.cxx | 25 ++++++++++++++++++++- src/KernelHelpers/SALOME_KernelServices.hxx | 3 ++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/KernelHelpers/SALOME_KernelServices.cxx b/src/KernelHelpers/SALOME_KernelServices.cxx index b4fa7ad6e..4ca01ee7a 100644 --- a/src/KernelHelpers/SALOME_KernelServices.cxx +++ b/src/KernelHelpers/SALOME_KernelServices.cxx @@ -21,6 +21,10 @@ #include "SALOME_KernelServices.hxx" +#include + +std::map _compo_map; + namespace KERNEL { /** @@ -161,5 +165,24 @@ namespace KERNEL { es.text = CORBA::string_dup(text); return SALOME::SALOME_Exception(es); } - + + void RegisterCompo(const std::string& compoName, CORBA::Object_var compoPtr) + { + _compo_map[compoName] = compoPtr; + } + + CORBA::Object_var RetrieveCompo(const std::string& compoName) + { + auto it = _compo_map.find(compoName); + if( it != _compo_map.end() ) + { + return (*it).second; + } + else + { + SALOME::SALOME_Exception ex(createSalomeException("RetrieveCompo : not implemented yet !")); + throw ex; + //GetLCC()->FindOrLoad_Component( "FactoryServer", compoName ); + } + } } diff --git a/src/KernelHelpers/SALOME_KernelServices.hxx b/src/KernelHelpers/SALOME_KernelServices.hxx index 2e163429d..d232b1483 100644 --- a/src/KernelHelpers/SALOME_KernelServices.hxx +++ b/src/KernelHelpers/SALOME_KernelServices.hxx @@ -53,7 +53,8 @@ namespace KERNEL { KERNELHELPERS_EXPORT CORBA::Object_ptr SObjectToObject(SALOMEDS::SObject_ptr); - + KERNELHELPERS_EXPORT void RegisterCompo(const std::string& compoName, CORBA::Object_var compoPtr); + KERNELHELPERS_EXPORT CORBA::Object_var RetrieveCompo(const std::string& compoName); /*! * This template function provides you with the servant (CORBA * object narrowed to its interface) corresponding to the specified -- 2.39.2