From 69c99ff7651908efca80b9eed2ccc479b1574b57 Mon Sep 17 00:00:00 2001
From: Otmane Lahlou <otmane.lahlou@c-s.fr>
Date: Thu, 20 Oct 2011 16:10:34 +0200
Subject: [PATCH] ENH: add methods to access to the Role of each parameter from
 application

---
 Code/ApplicationEngine/otbWrapperApplication.cxx | 13 +++++++++++++
 Code/ApplicationEngine/otbWrapperApplication.h   |  4 ++++
 2 files changed, 17 insertions(+)

diff --git a/Code/ApplicationEngine/otbWrapperApplication.cxx b/Code/ApplicationEngine/otbWrapperApplication.cxx
index b6677b42fe..48a58045ff 100644
--- a/Code/ApplicationEngine/otbWrapperApplication.cxx
+++ b/Code/ApplicationEngine/otbWrapperApplication.cxx
@@ -242,6 +242,19 @@ UserLevel Application::GetParameterUserLevel(std::string paramKey) const
   return GetParameterByKey(paramKey)->GetUserLevel();
 }
 
+
+/* Return the role (input/output) of a parameter */
+Role Application::GetParameterRole(std::string paramKey) const
+{
+  return GetParameterByKey(paramKey)->GetRole();
+}
+
+/* Return the role (input/output) of a parameter */
+void Application::SetParameterRole(std::string paramKey, Role role)
+{
+  GetParameterByKey(paramKey)->SetRole(role);
+}
+
 /* Get the parameter type from its name */
 ParameterType Application::GetParameterType(std::string paramKey) const
 {
diff --git a/Code/ApplicationEngine/otbWrapperApplication.h b/Code/ApplicationEngine/otbWrapperApplication.h
index e1f7d345ac..9711db49d4 100644
--- a/Code/ApplicationEngine/otbWrapperApplication.h
+++ b/Code/ApplicationEngine/otbWrapperApplication.h
@@ -146,6 +146,10 @@ public:
   /* Return the user level of access to a parameter */
   UserLevel GetParameterUserLevel(std::string paramKey) const;
 
+  /** Set/Get the role of the parameter */
+  Role GetParameterRole(std::string paramKey) const;
+  void SetParameterRole(std::string paramKey, Role role);
+
   /* Get the parameter type from its name */
   ParameterType GetParameterType(std::string paramKey) const;
 
-- 
GitLab