From 1e013859ff6fae99e226a171ac856459c48fd266 Mon Sep 17 00:00:00 2001 From: Ovidiu Mircescu Date: Mon, 20 Dec 2021 16:41:23 +0100 Subject: [PATCH] Sessionless mode for exe components. --- module_generator/cpp_tmpl.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) 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(); } -- 2.39.2