Salome HOME
#29456 [EDF] (2022-T1) Finalization of SSL implementation
[modules/med.git] / src / MEDCalc / cmp / MEDFactoryClient.cxx
index 747286ac5a950d7ee7f0780ef96da31bad10e6d0..9fa94f1c526688de4a2ccf2b5cc1cb76663b11c3 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2015  CEA/DEN, EDF R&D
+// Copyright (C) 2007-2021  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -19,8 +19,9 @@
 
 // Author : Guillaume Boulant (EDF)
 
+#include <SALOME_KernelServices.hxx>
+
 #include "MEDFactoryClient.hxx"
-#include "SALOME_KernelServices.hxx"
 
 namespace MEDFactoryClient {
 
@@ -30,9 +31,9 @@ namespace MEDFactoryClient {
   MEDCALC::MEDFactory_ptr getFactory() {
     static MEDCALC::MEDFactory_ptr engine;
     if(CORBA::is_nil(engine)){
-      Engines::EngineComponent_var component =
-        KERNEL::getLifeCycleCORBA()->FindOrLoad_Component( "FactoryServer","MEDFactory" );
-      engine = MEDCALC::MEDFactory::_narrow(component);
+         Engines::EngineComponent_var component = 
+                 KERNEL::getLifeCycleCORBA()->FindOrLoad_Component( "FactoryServer","MEDFactory" );
+         engine = MEDCALC::MEDFactory::_narrow(component);
     }
     return engine;
   }
@@ -70,4 +71,15 @@ namespace MEDFactoryClient {
     return presentationManager;
   }
 
+  /*!
+   * This returns a singleton (static) instance of the MED commands history.
+   */
+  MEDCALC::MEDCommandsHistoryManager_ptr getCommandsHistoryManager() {
+    static MEDCALC::MEDCommandsHistoryManager_ptr commandsHistoryManager;
+    if(CORBA::is_nil(commandsHistoryManager)){
+      commandsHistoryManager = getFactory()->getCommandsHistoryManager();
+    }
+    return commandsHistoryManager;
+  }
+
 }