]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
Study is OK
authorAnthony GEAY <anthony.geay@edf.fr>
Fri, 19 Feb 2021 16:37:38 +0000 (17:37 +0100)
committerAnthony GEAY <anthony.geay@edf.fr>
Fri, 19 Feb 2021 16:37:38 +0000 (17:37 +0100)
src/SALOMEDS/SALOMEDS.cxx
src/SALOMEDSClient/SALOMEDSClient_ClientFactory.cxx
src/SALOMEDSClient/SALOMEDSClient_ClientFactory.hxx

index 1a73c312f7c3d572f9c24fe1f02ae1474d6c9d58..8a1013f595af8990994f2ab9e53ec2a8d49573ae 100644 (file)
@@ -35,6 +35,7 @@
 #include "SALOMEDSClient.hxx"
 #include "SALOMEDSClient_IParameters.hxx"
 #include "SALOMEDS_IParameters.hxx"
+#include "SALOME_Fake_NamingService.hxx"
 
 #include "SALOMEDS_Defines.hxx"
 
@@ -105,10 +106,8 @@ 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) ) {
@@ -136,6 +135,20 @@ extern "C"
     }
   }
 
+  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)
   {
index 2edcbdf5c0e4deac2d34cf5af2dbf797b6c9ae63..ca89d0be487ef822b1ba1f63c915e91ce3487174 100644 (file)
@@ -40,14 +40,15 @@ static void* _libHandle = NULL;
 #endif
 #endif
 
-#define SOBJECT_FACTORY      "SObjectFactory"
-#define SCOMPONENT_FACTORY   "SComponentFactory"
-#define STUDY_FACTORY        "StudyFactory"
-#define STUDY_CREATE         "CreateStudy"
-#define BUILDER_FACTORY      "BuilderFactory"
-#define GET_PARAMETERS       "GetIParameters"
-#define CONVERT_SOBJECT      "ConvertSObject"
-#define CONVERT_BUILDER      "ConvertBuilder"
+#define SOBJECT_FACTORY         "SObjectFactory"
+#define SCOMPONENT_FACTORY      "SComponentFactory"
+#define STUDY_FACTORY           "StudyFactory"
+#define STUDY_CREATE            "CreateStudy"
+#define STUDY_CREATE_WITHOUT_NS "CreateStudyWithoutNS"
+#define BUILDER_FACTORY         "BuilderFactory"
+#define GET_PARAMETERS          "GetIParameters"
+#define CONVERT_SOBJECT         "ConvertSObject"
+#define CONVERT_BUILDER         "ConvertBuilder"
 
 typedef SALOMEDSClient_SObject* (*SOBJECT_FACTORY_FUNCTION) (SALOMEDS::SObject_ptr);
 typedef SALOMEDSClient_SComponent* (*SCOMPONENT_FACTORY_FUNCTION) (SALOMEDS::SComponent_ptr);
@@ -129,6 +130,19 @@ void ClientFactory::createStudy(CORBA::ORB_ptr orb, PortableServer::POA_ptr poa)
   if(aCreateFactory) aCreateFactory(orb, poa);
 }
 
+void ClientFactory::createStudyWithoutNS(CORBA::ORB_ptr orb, PortableServer::POA_ptr poa)
+{
+#ifdef WIN32
+  if(!_libHandle) _libHandle = ::LoadLibrary(SALOMEDS_LIB_NAME);
+  if(!aCreateFactory) aCreateFactory = (STUDY_CREATE_FUNCTION)::GetProcAddress(_libHandle, STUDY_CREATE_WITHOUT_NS);
+#else
+  if(!_libHandle) _libHandle = dlopen(SALOMEDS_LIB_NAME, RTLD_LAZY | RTLD_GLOBAL);
+  if(!aCreateFactory) aCreateFactory = (STUDY_CREATE_FUNCTION) dlsym(_libHandle, STUDY_CREATE_WITHOUT_NS);
+#endif
+
+  if(aCreateFactory) aCreateFactory(orb, poa);
+}
+
 _PTR(StudyBuilder) ClientFactory::StudyBuilder(SALOMEDS::StudyBuilder_ptr theStudyBuilder)
 {
   SALOMEDSClient_StudyBuilder* studyBuilder = NULL;
index 6aa8d501a26183b0ba922a539b5d03d1729b4439..9775b018c1a09404fb58c0827619ff884204a2c7 100644 (file)
@@ -62,6 +62,11 @@ public:
    *  Creates and returns a client Study wrapper
    */
   static void createStudy(CORBA::ORB_ptr orb, PortableServer::POA_ptr poa);
+  
+  /*!
+   * Creates and returns a client Study wrapper without external NS process
+   */
+  static void createStudyWithoutNS(CORBA::ORB_ptr orb, PortableServer::POA_ptr poa);
 
   /*!
    *  Returns a client StudyBuilder wrapper that corresponds %theStudy