Salome HOME
0023299: [CEA] Finalize multi-study removal
[modules/kernel.git] / src / KernelHelpers / SALOME_KernelServices.cxx
index 3f47016bda8aa18a23adc93bc36689252a16d3a4..4b3a07d70c34acb7798cdf6586639bc7965ea0ec 100644 (file)
@@ -1,9 +1,9 @@
-// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // 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
@@ -61,18 +61,17 @@ namespace KERNEL {
 
 
   /**
-   * This returns a static reference to the SALOME study manager. The
-   * study manager can be used to retrieve a study or to get
-   * informations about a study.
+   * This returns a static reference to the SALOME study. The
+   * study can be used to get informations about it.
    */
-  SALOMEDS::StudyManager_ptr getStudyManager() {
-    static SALOMEDS::StudyManager_ptr aStudyManager;
-    if(CORBA::is_nil(aStudyManager)){
+  SALOMEDS::Study_ptr getStudy() {
+    static SALOMEDS::Study_ptr aStudy;
+    if(CORBA::is_nil(aStudy)){
       SALOME_NamingService *aNamingService = getNamingService();
-      CORBA::Object_ptr anObject = aNamingService->Resolve("/myStudyManager");
-      aStudyManager = SALOMEDS::StudyManager::_narrow(anObject);
+      CORBA::Object_ptr anObject = aNamingService->Resolve("/Study");
+      aStudy = SALOMEDS::Study::_narrow(anObject);
     }
-    return aStudyManager;
+    return aStudy;
   }
 
   /**
@@ -117,27 +116,6 @@ namespace KERNEL {
     return resourcesManager;
   }
 
-  /**
-   * This returns the study with the specified id if it's defined in
-   * the SALOME study manager. Returns null otherwise.
-   * Please not that it is just a shortcut, and you may prefer use
-   * directly the study manager:
-   *    KERNEL::getStudyManager()->GetStudyByID(aStudyId)
-   */
-  SALOMEDS::Study_ptr getStudyById(int aStudyId) {
-    if ( aStudyId < 0 ) {
-      INFOS("ERR: trying to get a study with ID<0");
-      return SALOMEDS::Study::_nil();
-    }
-    return getStudyManager()->GetStudyByID(aStudyId);
-  }
-
-  int getStudyId(SALOMEDS::Study_ptr study) {
-    if( CORBA::is_nil(study) ) return -1;
-    return study->StudyId();
-  }
-
-
   /**
    * This function retrieve the CORBA object reference from the study
    * object wrapping it.