diff --git a/Code/ApplicationEngine/otbWrapperApplication.cxx b/Code/ApplicationEngine/otbWrapperApplication.cxx index 728549bf13e2bcbd9f10f0582b9dc24d1fafbe28..601143de3e1588aee6eba2dddbfb80a0b0556616 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 0f7badb66b03fb2092ed73dac6e822a315dc9e5f..e5965d7feffadaa09f6affc63a78a19b153c1970 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);