Salome HOME
code improvement
[modules/kernel.git] / src / KernelHelpers / SALOME_KernelServices.cxx
index adf8eced51e447c75daff6495f856cd31b9718d8..71f9456602d0cfa5e80b761f1f9f6c12d295a389 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2015  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
@@ -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 getStudyServant() {
+    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.