From: Ovidiu Mircescu Date: Mon, 20 Dec 2021 15:41:23 +0000 (+0100) Subject: Sessionless mode for exe components. X-Git-Tag: EMC2P_V_1_3_5-rc1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=005a2afee71e224e6bd2b817bb3a6bd21c16e234;p=tools%2Fyacsgen.git Sessionless mode for exe components. --- diff --git a/module_generator/cpp_tmpl.py b/module_generator/cpp_tmpl.py index d6d3a41..f3438f7 100644 --- a/module_generator/cpp_tmpl.py +++ b/module_generator/cpp_tmpl.py @@ -31,6 +31,7 @@ cxxCompo=""" #include ${CalciumInterface} #include +#include #include #include #include @@ -230,7 +231,6 @@ extern "C" CORBA::Object_var obj; try { - SALOME_NamingService * salomens = new SALOME_NamingService(orb); obj = orb->resolve_initial_references("RootPOA"); PortableServer::POA_var poa = PortableServer::POA::_narrow(obj); PortableServer::POAManager_var pman = poa->the_POAManager(); @@ -243,7 +243,18 @@ extern "C" obj=myEngine->POA_${module}_ORB::${component}::_this(); Engines::EngineComponent_var component = Engines::EngineComponent::_narrow(obj); string component_registerName = containerName + "/" + instanceName; - salomens->Register(component,component_registerName.c_str()); + Engines::EmbeddedNamingService_var embedded_NS = container->get_embedded_NS_if_ssl(); + if( CORBA::is_nil(embedded_NS)) + { + // Use the salome session to get the naming service + SALOME_NamingService salome_NS(orb); + salome_NS.Register(component,component_registerName.c_str()); + } + else + { + SALOME_Embedded_NamingService_Client ns_client(embedded_NS); + ns_client.Register(component,component_registerName.c_str()); + } orb->run(); orb->destroy(); }