Salome HOME
Additional fix for delete boolean parameter in method: "updateObjBrowser"
[modules/kernel.git] / src / SALOMEDSClient / SALOMEDSClient_ClientFactory.cxx
index 2073d2ec14f947d9047bf53905b2aac62f3419ac..77d1861b754aa8c0f54aff494bbf3d8005f4a7a8 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2016  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
@@ -6,7 +6,7 @@
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 // License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -35,9 +35,8 @@ static void* _libHandle = NULL;
 #define SOBJECT_FACTORY      "SObjectFactory"
 #define SCOMPONENT_FACTORY   "SComponentFactory"
 #define STUDY_FACTORY        "StudyFactory"
+#define STUDY_CREATE         "CreateStudy"
 #define BUILDER_FACTORY      "BuilderFactory"
-#define STUDYMANAGER_FACTORY "StudyManagerFactory"
-#define STUDYMANAGER_CREATE  "CreateStudyManager"
 #define GET_PARAMETERS       "GetIParameters"
 #define CONVERT_SOBJECT      "ConvertSObject"
 #define CONVERT_STUDY        "ConvertStudy"
@@ -46,9 +45,8 @@ 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_StudyManager* (*STUDYMANAGER_FACTORY_FUNCTION) ();
+typedef void                  (*STUDY_CREATE_FUNCTION) (CORBA::ORB_ptr, PortableServer::POA_ptr);
 typedef SALOMEDSClient_StudyBuilder* (*BUILDER_FACTORY_FUNCTION) (SALOMEDS::StudyBuilder_ptr);
-typedef SALOMEDSClient_StudyManager* (*STUDYMANAGER_CREATE_FUNCTION) (CORBA::ORB_ptr, PortableServer::POA_ptr);
 typedef SALOMEDSClient_IParameters* (*GET_PARAMETERS_FACTORY) (const _PTR(AttributeParameter)&);
 typedef SALOMEDS::SObject_ptr (*CONVERT_SOBJECT_FUNCTION) (const _PTR(SObject)&);
 typedef SALOMEDS::Study_ptr (*CONVERT_STUDY_FUNCTION) (const _PTR(Study)&);
@@ -58,9 +56,8 @@ typedef SALOMEDS::StudyBuilder_ptr (*CONVERT_BUILDER_FUNCTION) (const _PTR(Study
 static SOBJECT_FACTORY_FUNCTION aSObjectFactory = NULL;
 static SCOMPONENT_FACTORY_FUNCTION aSComponentFactory = NULL;
 static STUDY_FACTORY_FUNCTION aStudyFactory = NULL;
+static STUDY_CREATE_FUNCTION aCreateFactory = NULL;
 static BUILDER_FACTORY_FUNCTION aBuilderFactory = NULL;
-static STUDYMANAGER_FACTORY_FUNCTION aManagerFactory = NULL;
-static STUDYMANAGER_CREATE_FUNCTION aCreateFactory = NULL;
 static GET_PARAMETERS_FACTORY aGetIParameters = NULL;
 static CONVERT_SOBJECT_FUNCTION aConvertSObject = NULL;
 static CONVERT_STUDY_FUNCTION aConvertStudy = NULL;
@@ -114,52 +111,33 @@ _PTR(Study) ClientFactory::Study(SALOMEDS::Study_ptr theStudy)
   return _PTR(Study)(study);
 }
 
-_PTR(StudyBuilder) ClientFactory::StudyBuilder(SALOMEDS::StudyBuilder_ptr theStudyBuilder)
+void ClientFactory::createStudy(CORBA::ORB_ptr orb, PortableServer::POA_ptr poa)
 {
-  SALOMEDSClient_StudyBuilder* studyBuilder = NULL;
-
 #ifdef WIN32
   if(!_libHandle) _libHandle = ::LoadLibrary(SALOMEDS_LIB_NAME);
-  if(!aBuilderFactory) aBuilderFactory = (BUILDER_FACTORY_FUNCTION)::GetProcAddress(_libHandle, BUILDER_FACTORY);
+  if(!aCreateFactory) aCreateFactory = (STUDY_CREATE_FUNCTION)::GetProcAddress(_libHandle, STUDY_CREATE);
 #else
   if(!_libHandle) _libHandle = dlopen(SALOMEDS_LIB_NAME, RTLD_LAZY | RTLD_GLOBAL);
-  if(!aBuilderFactory) aBuilderFactory = (BUILDER_FACTORY_FUNCTION) dlsym(_libHandle, BUILDER_FACTORY);
+  if(!aCreateFactory) aCreateFactory = (STUDY_CREATE_FUNCTION) dlsym(_libHandle, STUDY_CREATE);
 #endif
 
-  if(aBuilderFactory) studyBuilder = aBuilderFactory(theStudyBuilder); 
-  return _PTR(StudyBuilder)(studyBuilder);
+  if(aCreateFactory) aCreateFactory(orb, poa);
 }
 
-_PTR(StudyManager) ClientFactory::StudyManager()
-{
-  SALOMEDSClient_StudyManager* manager = NULL;
-
-#ifdef WIN32
-  if(!_libHandle) _libHandle = ::LoadLibrary(SALOMEDS_LIB_NAME);
-  if(!aManagerFactory) aManagerFactory = (STUDYMANAGER_FACTORY_FUNCTION)::GetProcAddress(_libHandle, STUDYMANAGER_FACTORY);
-#else
-  if(!_libHandle) _libHandle = dlopen(SALOMEDS_LIB_NAME, RTLD_LAZY | RTLD_GLOBAL);
-  if(!aManagerFactory) aManagerFactory = (STUDYMANAGER_FACTORY_FUNCTION) dlsym(_libHandle, STUDYMANAGER_FACTORY);
-#endif
-
-  if(aManagerFactory) manager = aManagerFactory(); 
-  return _PTR(StudyManager)(manager);
-}
-
-_PTR(StudyManager) ClientFactory::createStudyManager(CORBA::ORB_ptr orb, PortableServer::POA_ptr poa)
+_PTR(StudyBuilder) ClientFactory::StudyBuilder(SALOMEDS::StudyBuilder_ptr theStudyBuilder)
 {
-  SALOMEDSClient_StudyManager* manager = NULL;
+  SALOMEDSClient_StudyBuilder* studyBuilder = NULL;
 
 #ifdef WIN32
   if(!_libHandle) _libHandle = ::LoadLibrary(SALOMEDS_LIB_NAME);
-  if(!aCreateFactory) aCreateFactory = (STUDYMANAGER_CREATE_FUNCTION)::GetProcAddress(_libHandle, STUDYMANAGER_CREATE);
+  if(!aBuilderFactory) aBuilderFactory = (BUILDER_FACTORY_FUNCTION)::GetProcAddress(_libHandle, BUILDER_FACTORY);
 #else
   if(!_libHandle) _libHandle = dlopen(SALOMEDS_LIB_NAME, RTLD_LAZY | RTLD_GLOBAL);
-  if(!aCreateFactory) aCreateFactory = (STUDYMANAGER_CREATE_FUNCTION) dlsym(_libHandle, STUDYMANAGER_CREATE);
+  if(!aBuilderFactory) aBuilderFactory = (BUILDER_FACTORY_FUNCTION) dlsym(_libHandle, BUILDER_FACTORY);
 #endif
 
-  if(aCreateFactory)  manager = aCreateFactory(orb, poa);
-  return _PTR(StudyManager)(manager);
+  if(aBuilderFactory) studyBuilder = aBuilderFactory(theStudyBuilder); 
+  return _PTR(StudyBuilder)(studyBuilder);
 }
 
 _PTR(IParameters) ClientFactory::getIParameters(const _PTR(AttributeParameter)& ap)