X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSALOMEDS%2FSALOMEDS.cxx;h=bd1c112b66994138de24829834008ef9ef675000;hb=b741d9021836f43ec742959b06b0941e1a1da7c9;hp=695992deb0208b3498cd914b929a83c9493f062f;hpb=17731f6b0ce47c3ec9564e5c25d495c0ef626ccf;p=modules%2Fkernel.git diff --git a/src/SALOMEDS/SALOMEDS.cxx b/src/SALOMEDS/SALOMEDS.cxx index 695992deb..bd1c112b6 100644 --- a/src/SALOMEDS/SALOMEDS.cxx +++ b/src/SALOMEDS/SALOMEDS.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -35,9 +35,12 @@ #include "SALOMEDSClient.hxx" #include "SALOMEDSClient_IParameters.hxx" #include "SALOMEDS_IParameters.hxx" +#include "SALOME_Fake_NamingService.hxx" #include "SALOMEDS_Defines.hxx" +#include + // IDL headers #include #include CORBA_SERVER_HEADER(SALOMEDS) @@ -103,27 +106,50 @@ extern "C" return new SALOMEDS_StudyBuilder(theBuilder); } - SALOMEDS_EXPORT - void CreateStudy(CORBA::ORB_ptr orb, PortableServer::POA_ptr root_poa) + void CreateStudyNSAbstract(CORBA::ORB_ptr orb, PortableServer::POA_ptr root_poa, SALOME_NamingService_Abstract& namingService) { - SALOME_NamingService namingService(orb); CORBA::Object_var obj = namingService.Resolve( "/Study" ); SALOMEDS::Study_var aStudy = SALOMEDS::Study::_narrow( obj ); if( CORBA::is_nil(aStudy) ) { - SALOMEDS_Study_i* aStudy_i = new SALOMEDS_Study_i(orb); + PortableServer::POAManager_var pman = root_poa->the_POAManager(); + CORBA::PolicyList policies; + policies.length(2); + //PortableServer::ThreadPolicy_var threadPol(root_poa->create_thread_policy(PortableServer::SINGLE_THREAD_MODEL)); + PortableServer::ThreadPolicy_var threadPol(root_poa->create_thread_policy(PortableServer::ORB_CTRL_MODEL)); + PortableServer::ImplicitActivationPolicy_var implicitPol(root_poa->create_implicit_activation_policy(PortableServer::IMPLICIT_ACTIVATION)); + policies[0] = PortableServer::ThreadPolicy::_duplicate(threadPol); + policies[1] = PortableServer::ImplicitActivationPolicy::_duplicate(implicitPol); + PortableServer::POA_var poa = root_poa->create_POA("KERNELStudySingleThreadPOA",pman,policies); + MESSAGE("CreateStudy: KERNELStudySingleThreadPOA: "<< poa); + threadPol->destroy(); + + SALOMEDS_Study_i::SetThePOA(poa); + SALOMEDS_Study_i* aStudy_i = new SALOMEDS_Study_i(orb,&namingService); // Activate the objects. This tells the POA that the objects are ready to accept requests. PortableServer::ObjectId_var aStudy_iid = root_poa->activate_object(aStudy_i); aStudy = aStudy_i->_this(); + KERNEL::setStudyServantSA(aStudy,poa); namingService.Register(aStudy, "/Study"); - - // Assign the value of the IOR in the study->root - CORBA::String_var IORStudy = orb->object_to_string(aStudy); - aStudy_i->GetImpl()->SetTransientReference((char*)IORStudy.in()); + aStudy_i->GetImpl()->GetDocument()->SetModified(false); aStudy_i->_remove_ref(); } } + SALOMEDS_EXPORT + void CreateStudy(CORBA::ORB_ptr orb, PortableServer::POA_ptr root_poa) + { + SALOME_NamingService namingService(orb); + CreateStudyNSAbstract(orb,root_poa,namingService); + } + + SALOMEDS_EXPORT + void CreateStudyWithoutNS(CORBA::ORB_ptr orb, PortableServer::POA_ptr root_poa) + { + SALOME_Fake_NamingService namingService(orb); + CreateStudyNSAbstract(orb,root_poa,namingService); + } + SALOMEDS_EXPORT SALOMEDSClient_IParameters* GetIParameters(const _PTR(AttributeParameter)& ap) { @@ -139,15 +165,6 @@ extern "C" return so->GetSObject(); } - SALOMEDS_EXPORT - SALOMEDS::Study_ptr ConvertStudy(const _PTR(Study)& theStudy) - { - SALOMEDS_Study* study = _CAST(Study, theStudy); - if ( !theStudy || !study ) - return SALOMEDS::Study::_nil(); - return study->GetStudy(); - } - SALOMEDS_EXPORT SALOMEDS::StudyBuilder_ptr ConvertBuilder(const _PTR(StudyBuilder)& theBuilder) {