From 2c8bb3a752a17486f737b73f1a4f6b6d5dd4af90 Mon Sep 17 00:00:00 2001 From: Otmane Lahlou <otmane.lahlou@c-s.fr> Date: Mon, 5 Sep 2011 16:29:10 +0200 Subject: [PATCH] ENH : add a method IsApplicationReady that checks that all the mandatory parameters are set --- Code/Core/otbWrapperApplication.cxx | 21 +++++++++++++++++++++ Code/Core/otbWrapperApplication.h | 5 +++++ 2 files changed, 26 insertions(+) diff --git a/Code/Core/otbWrapperApplication.cxx b/Code/Core/otbWrapperApplication.cxx index a7a9f673e5..8c0042384f 100644 --- a/Code/Core/otbWrapperApplication.cxx +++ b/Code/Core/otbWrapperApplication.cxx @@ -580,6 +580,27 @@ Application::GetDoExecuteProgress() return res; } +bool +Application::IsApplicationReady() +{ + // Check if all the mandatory parameters are set + bool ready = true; + + std::vector<std::string> paramList = GetParametersKeys(true); + for (std::vector<std::string>::const_iterator it = paramList.begin(); + it != paramList.end(); + ++it) + { + // Check all Input Parameters + if (!this->HasValue(*it) && IsMandatory(*it)) + { + ready = false; + } + } + + return ready; +} + } } diff --git a/Code/Core/otbWrapperApplication.h b/Code/Core/otbWrapperApplication.h index 44eddb86f4..cbb828ce66 100644 --- a/Code/Core/otbWrapperApplication.h +++ b/Code/Core/otbWrapperApplication.h @@ -146,6 +146,11 @@ public: /* Returns the description of a parameter */ std::vector<std::string> GetChoiceNames(std::string paramKey); + /* Is the application ready to be executed : All the mandatory + * parameters have to be set + */ + bool IsApplicationReady(); + /* Set an integer value * -- GitLab