From: srn Date: Mon, 20 Feb 2006 11:21:54 +0000 (+0000) Subject: Added a factory methods to convert CORBA SALOMEDS objects to SALOMEDSClient wrappers X-Git-Tag: Tag_09032006~8 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=66ba22abe4f3df357b8a73147a5c49512ebffd56;p=modules%2Fkernel.git Added a factory methods to convert CORBA SALOMEDS objects to SALOMEDSClient wrappers --- diff --git a/src/SALOMEDS/SALOMEDS.cxx b/src/SALOMEDS/SALOMEDS.cxx index ae488ad0a..4a35577e1 100644 --- a/src/SALOMEDS/SALOMEDS.cxx +++ b/src/SALOMEDS/SALOMEDS.cxx @@ -26,13 +26,28 @@ // Module : SALOME // $Header$ - #ifndef WNT #include +#include +#include +#include +#include +#include +#include #else #include "SALOMEDS.hxx" +#include "SALOMEDS_StudyManager.hxx" +#include "SALOMEDS_Study.hxx" +#include "SALOMEDS_SObject.hxx" +#include "SALOMEDS_SComponent.hxx" +#include "SALOMEDSClient.hxx" +#include "SALOMEDS_StudyManager_i.hxx" #endif +// IDL headers +#include +#include CORBA_SERVER_HEADER(SALOMEDS) + using namespace SALOMEDS; // PAL8065: san -- Global recursive mutex for SALOMEDS methods @@ -55,3 +70,48 @@ void SALOMEDS::unlock() { Locker::MutexDS.unlock(); } + + + +// srn: Added new library methods that create basic SALOMEDS objects (StudyManager, Study, SComponent, SObject) + +//============================================================================= +/*! + * C factory, accessible with dlsym, after dlopen + */ +//============================================================================= + + +extern "C" +{ + +SALOMEDSClient_StudyManager* StudyManagerFactory() +{ + return new SALOMEDS_StudyManager(); +} + +SALOMEDSClient_Study* StudyFactory(SALOMEDS::Study_ptr theStudy) +{ + return new SALOMEDS_Study(theStudy); +} + +SALOMEDSClient_SObject* SObjectFactory(SALOMEDS::SObject_ptr theSObject) +{ + return new SALOMEDS_SObject(theSObject); +} + +SALOMEDSClient_SComponent* SComponentFactory(SALOMEDS::SComponent_ptr theSComponent) +{ + return new SALOMEDS_SComponent(theSComponent); +} + +SALOMEDSClient_StudyManager* CreateStudyManager(CORBA::ORB_ptr orb, PortableServer::POA_ptr root_poa) +{ + SALOMEDS_StudyManager_i * aStudyManager_i = new SALOMEDS_StudyManager_i(orb, root_poa); + // Activate the objects. This tells the POA that the objects are ready to accept requests. + PortableServer::ObjectId_var aStudyManager_iid = root_poa->activate_object(aStudyManager_i); + aStudyManager_i->register_name("/myStudyManager"); + return new SALOMEDS_StudyManager(); +} + +}