From 303a3dff36bc448a358277e237a84f66cca43775 Mon Sep 17 00:00:00 2001 From: mpa Date: Thu, 3 Nov 2016 16:51:42 +0300 Subject: [PATCH] Edit createStudy method --- src/SALOMEDS/SALOMEDS.cxx | 12 +++++++----- src/SALOMEDSClient/SALOMEDSClient_ClientFactory.cxx | 7 +++---- src/SALOMEDSClient/SALOMEDSClient_ClientFactory.hxx | 2 +- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/SALOMEDS/SALOMEDS.cxx b/src/SALOMEDS/SALOMEDS.cxx index 9d8112092..e228a6161 100644 --- a/src/SALOMEDS/SALOMEDS.cxx +++ b/src/SALOMEDS/SALOMEDS.cxx @@ -104,22 +104,24 @@ extern "C" } SALOMEDS_EXPORT - SALOMEDSClient_Study* CreateStudy(CORBA::ORB_ptr orb, PortableServer::POA_ptr root_poa) + void CreateStudy(CORBA::ORB_ptr orb, PortableServer::POA_ptr root_poa) { SALOME_NamingService namingService(orb); CORBA::Object_var obj = namingService.Resolve( "/Study" ); SALOMEDS::Study_var aStudy = SALOMEDS::Study::_narrow( obj ); - SALOMEDS_Study_i* aStudy_i; if( CORBA::is_nil(aStudy) ) { - aStudy_i = new SALOMEDS_Study_i(orb); + SALOMEDS_Study_i* aStudy_i = new SALOMEDS_Study_i(orb); // 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(); namingService.Register(aStudy.in(), "/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->_remove_ref(); } - aStudy_i->_remove_ref(); - return NULL; } SALOMEDS_EXPORT diff --git a/src/SALOMEDSClient/SALOMEDSClient_ClientFactory.cxx b/src/SALOMEDSClient/SALOMEDSClient_ClientFactory.cxx index 76f5221ff..b75cf0843 100644 --- a/src/SALOMEDSClient/SALOMEDSClient_ClientFactory.cxx +++ b/src/SALOMEDSClient/SALOMEDSClient_ClientFactory.cxx @@ -45,7 +45,7 @@ static void* _libHandle = NULL; typedef SALOMEDSClient_SObject* (*SOBJECT_FACTORY_FUNCTION) (SALOMEDS::SObject_ptr); typedef SALOMEDSClient_SComponent* (*SCOMPONENT_FACTORY_FUNCTION) (SALOMEDS::SComponent_ptr); typedef SALOMEDSClient_Study* (*STUDY_FACTORY_FUNCTION) (SALOMEDS::Study_ptr); -typedef SALOMEDSClient_Study* (*STUDY_CREATE_FUNCTION) (CORBA::ORB_ptr, PortableServer::POA_ptr); +typedef void (*STUDY_CREATE_FUNCTION) (CORBA::ORB_ptr, PortableServer::POA_ptr); typedef SALOMEDSClient_StudyBuilder* (*BUILDER_FACTORY_FUNCTION) (SALOMEDS::StudyBuilder_ptr); typedef SALOMEDSClient_IParameters* (*GET_PARAMETERS_FACTORY) (const _PTR(AttributeParameter)&); typedef SALOMEDS::SObject_ptr (*CONVERT_SOBJECT_FUNCTION) (const _PTR(SObject)&); @@ -111,7 +111,7 @@ _PTR(Study) ClientFactory::Study(SALOMEDS::Study_ptr theStudy) return _PTR(Study)(study); } -_PTR(Study) ClientFactory::createStudy(CORBA::ORB_ptr orb, PortableServer::POA_ptr poa) +void ClientFactory::createStudy(CORBA::ORB_ptr orb, PortableServer::POA_ptr poa) { SALOMEDSClient_Study* study = NULL; #ifdef WIN32 @@ -122,8 +122,7 @@ _PTR(Study) ClientFactory::createStudy(CORBA::ORB_ptr orb, PortableServer::POA_p if(!aCreateFactory) aCreateFactory = (STUDY_CREATE_FUNCTION) dlsym(_libHandle, STUDY_CREATE); #endif - if(aCreateFactory) study = aCreateFactory(orb, poa); - return _PTR(Study)(study); + if(aCreateFactory) aCreateFactory(orb, poa); } _PTR(StudyBuilder) ClientFactory::StudyBuilder(SALOMEDS::StudyBuilder_ptr theStudyBuilder) diff --git a/src/SALOMEDSClient/SALOMEDSClient_ClientFactory.hxx b/src/SALOMEDSClient/SALOMEDSClient_ClientFactory.hxx index 7c407f898..6e4afdf43 100644 --- a/src/SALOMEDSClient/SALOMEDSClient_ClientFactory.hxx +++ b/src/SALOMEDSClient/SALOMEDSClient_ClientFactory.hxx @@ -61,7 +61,7 @@ public: /*! * Creates and returns a client Study wrapper */ - static _PTR(Study) createStudy(CORBA::ORB_ptr orb, PortableServer::POA_ptr poa); + static void createStudy(CORBA::ORB_ptr orb, PortableServer::POA_ptr poa); /*! * Returns a client StudyBuilder wrapper that corresponds %theStudy -- 2.39.2