Salome HOME
Additional fix for delete boolean parameter in method: "updateObjBrowser"
[modules/kernel.git] / src / SALOMEDSClient / SALOMEDSClient_ClientFactory.cxx
index 3c832879bd183dd150b10c2f4a65bb76ccdc462f..77d1861b754aa8c0f54aff494bbf3d8005f4a7a8 100644 (file)
@@ -1,21 +1,25 @@
-// Copyright (C) 2005  OPEN CASCADE, CEA, EDF R&D, LEG
-//           PRINCIPIA R&D, EADS CCR, Lip6, BV, CEDRAT
+// 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
+//
 // 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.
-// 
-// This library is distributed in the hope that it will be useful 
-// but WITHOUT ANY WARRANTY; without even the implied warranty of 
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+// License as published by the Free Software Foundation; either
+// 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 // Lesser General Public License for more details.
-// 
-// You should have received a copy of the GNU Lesser General Public  
-// License along with this library; if not, write to the Free Software 
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-// 
+//
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-// 
+//
+
 #include "SALOMEDSClient_ClientFactory.hxx"
 
 #ifdef WIN32
@@ -31,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"
@@ -42,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)&);
@@ -54,16 +56,13 @@ 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;
 static CONVERT_BUILDER_FUNCTION aConvertBuilder = NULL;
 
-using namespace std;
-
 _PTR(SObject) ClientFactory::SObject(SALOMEDS::SObject_ptr theSObject)
 {
   SALOMEDSClient_SObject* so = NULL;
@@ -112,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)