From b6cc023e976a035410772afaa613307c52d3099f Mon Sep 17 00:00:00 2001 From: Otmane Lahlou <otmane.lahlou@c-s.fr> Date: Tue, 8 Nov 2011 18:44:34 +0100 Subject: [PATCH] ENH: add methods to be used for setting RAMParameter --- .../otbWrapperApplication.cxx | 24 +++++++++++++++++++ .../ApplicationEngine/otbWrapperApplication.h | 6 +++++ 2 files changed, 30 insertions(+) diff --git a/Code/ApplicationEngine/otbWrapperApplication.cxx b/Code/ApplicationEngine/otbWrapperApplication.cxx index 728549bf13..601143de3e 100644 --- a/Code/ApplicationEngine/otbWrapperApplication.cxx +++ b/Code/ApplicationEngine/otbWrapperApplication.cxx @@ -1075,6 +1075,30 @@ Application::AddParameter(ParameterType type, std::string paramKey, std::string GetParameterList()->AddParameter(type, paramKey, paramName); } +void Application::AddRAMParameter(std::string paramKey, std::string paramName, unsigned int defaultValue) +{ + GetParameterList()->AddParameter(ParameterType_RAM, paramKey, paramName); + SetDefaultParameterInt(paramKey, defaultValue); +} + +void Application::AddRAMParameter() +{ + // Get the RAM Parameter from the configuration file + if (otb::ConfigurationFile::GetInstance()->IsValid() ) + { + AddRAMParameter("ram", + "Available RAM", + otb::ConfigurationFile::GetInstance()->GetAvailableRAMInMBytes()); + } + else + { + // TODO check this + AddRAMParameter("ram", + "Available RAM", + 128); + } +} + bool Application::IsApplicationReady() { diff --git a/Code/ApplicationEngine/otbWrapperApplication.h b/Code/ApplicationEngine/otbWrapperApplication.h index 0f7badb66b..e5965d7fef 100644 --- a/Code/ApplicationEngine/otbWrapperApplication.h +++ b/Code/ApplicationEngine/otbWrapperApplication.h @@ -537,6 +537,12 @@ protected: * or the path to a choice value */ void AddParameter(ParameterType type, std::string paramKey, std::string paramName); + /** Add a parameterRAM method with parameter*/ + void AddRAMParameter(std::string paramKey, std::string paramName, unsigned int defaultValue); + + /** Add a parameterRAM method with no parameter*/ + void AddRAMParameter(); + /** Remove the items added to the ListWidget */ void ClearChoices(std::string key); -- GitLab