X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHOMARD_I%2FHOMARD_Gen_i_Session.cxx;h=0275923cbbf61c96b0fd67c8d5a7b98b5ba145e4;hb=refs%2Ftags%2FV9_13_0b1;hp=0b152affa13031ff0d1657db71b1fc7de0c0b510;hpb=1f3c08317130e4d167096c23d01c5be221b720ac;p=modules%2Fhomard.git diff --git a/src/HOMARD_I/HOMARD_Gen_i_Session.cxx b/src/HOMARD_I/HOMARD_Gen_i_Session.cxx index 0b152aff..0275923c 100644 --- a/src/HOMARD_I/HOMARD_Gen_i_Session.cxx +++ b/src/HOMARD_I/HOMARD_Gen_i_Session.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2021 CEA/DEN, EDF R&D +// Copyright (C) 2021-2024 CEA, EDF // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -20,13 +20,33 @@ #include "HOMARD_Gen_i_Session.hxx" #include "SALOMEDS_Study_i.hxx" #include "SALOME_KernelServices.hxx" +#include "Utils_SINGLETON.hxx" -HOMARD_Gen_i_Session::HOMARD_Gen_i_Session( CORBA::ORB_ptr orb, PortableServer::POA_ptr poa, PortableServer::ObjectId* contId, const char* instanceName, const char* interfaceName ):HOMARD_Gen_i(orb,poa,contId,instanceName,interfaceName) +HOMARD_Gen_i_Session::HOMARD_Gen_i_Session( CORBA::ORB_ptr orb, PortableServer::POA_ptr poa, PortableServer::ObjectId* contId, const char* instanceName, const char* interfaceName ): +HOMARD_Gen_i(orb,poa,contId,instanceName,interfaceName,true) { - myStudy = SALOMEDS::Study::_duplicate(KERNEL::getStudyServant()); + myStudy = SALOMEDS::Study::_duplicate(KERNEL::getStudyServant()); + _NS = SINGLETON_::Instance(); + ASSERT(SINGLETON_::IsAlreadyExisting()); + _NS->init_orb(_orb); +} + +SALOME_ModuleCatalog::ModuleCatalog_var HOMARD_Gen_i_Session::getModuleCatalog() const +{ + CORBA::Object_var objVarN = _NS->Resolve("/Kernel/ModulCatalog"); + SALOME_ModuleCatalog::ModuleCatalog_var Catalogue = SALOME_ModuleCatalog::ModuleCatalog::_narrow(objVarN); + return Catalogue; +} + +SMESH::SMESH_Gen_var HOMARD_Gen_i_Session::retrieveSMESHInst() const +{ + SALOME_LifeCycleCORBA* myLCC = new SALOME_LifeCycleCORBA(_NS); + SMESH::SMESH_Gen_var aSmeshEngine = SMESH::SMESH_Gen::_narrow(myLCC->FindOrLoad_Component("FactoryServer","SMESH")); + return aSmeshEngine; } //============================================================================= +#include "HOMARD_Gen_i_No_Session.hxx" extern "C" { HOMARDENGINE_EXPORT @@ -37,7 +57,17 @@ extern "C" const char* interfaceName) { MESSAGE("PortableServer::ObjectId* HOMARDEngine_factory()"); - HOMARD_Gen_i_Session* myHOMARD_Gen = new HOMARD_Gen_i_Session(orb, poa, contId, instanceName, interfaceName); - return myHOMARD_Gen->getId(); + CORBA::Object_var o = poa->id_to_reference(*contId); + Engines::Container_var cont = Engines::Container::_narrow(o); + if(cont->is_SSL_mode()) + { + HOMARD_Gen_i_No_Session* myHOMARD_Gen = new HOMARD_Gen_i_No_Session(orb, poa, contId, instanceName, interfaceName); + return myHOMARD_Gen->getId(); + } + else + { + HOMARD_Gen_i_Session* myHOMARD_Gen = new HOMARD_Gen_i_Session(orb, poa, contId, instanceName, interfaceName); + return myHOMARD_Gen->getId(); + } } }