From 5618a4bc48382e86076771553b7738313b5d57f3 Mon Sep 17 00:00:00 2001 From: Otmane Lahlou <otmane.lahlou@c-s.fr> Date: Wed, 9 Nov 2011 18:17:00 +0100 Subject: [PATCH] ENH: use the StringParameter as a member of the class, and not as an inherited class --- .../otbWrapperDirectoryParameter.h | 42 ++++++++++++++++--- 1 file changed, 37 insertions(+), 5 deletions(-) diff --git a/Code/ApplicationEngine/otbWrapperDirectoryParameter.h b/Code/ApplicationEngine/otbWrapperDirectoryParameter.h index ea44113cf1..5c4803539b 100644 --- a/Code/ApplicationEngine/otbWrapperDirectoryParameter.h +++ b/Code/ApplicationEngine/otbWrapperDirectoryParameter.h @@ -18,8 +18,10 @@ #ifndef __otbWrapperDirectoryParameter_h #define __otbWrapperDirectoryParameter_h -#include <string> #include "otbWrapperStringParameter.h" +#include "otbMacro.h" + +#include <string> namespace otb { @@ -30,12 +32,12 @@ namespace Wrapper * \brief This class represent a string parameter for the wrapper framework */ class DirectoryParameter - : public StringParameter + : public Parameter { public: /** Standard class typedef */ typedef DirectoryParameter Self; - typedef StringParameter Superclass; + typedef Parameter Superclass; typedef itk::SmartPointer<Self> Pointer; typedef itk::SmartPointer<const Self> ConstPointer; @@ -45,10 +47,37 @@ public: /** RTTI support */ itkTypeMacro(DirectoryParameter, Parameter); + bool HasValue() const + { + return m_StringParam->HasValue(); + } + + // Set/Get Value + otbSetObjectMemberMacro(StringParam, Value , std::string); + otbGetObjectMemberMacro(StringParam, Value , std::string); + + // Clear Value + void ClearValue() + { + m_StringParam->ClearValue(); + } + + // Reimplement the SetActive method + void SetActive( const bool value ) + { + Superclass::SetActive( value ); + m_StringParam->SetActive( value ); + } + + // GetActive method + otbGetObjectMemberConstMacro(StringParam, Active, bool); + protected: /** Constructor */ DirectoryParameter() - {} + { + m_StringParam = StringParameter::New(); + } /** Destructor */ virtual ~DirectoryParameter() @@ -56,7 +85,10 @@ protected: private: DirectoryParameter(const DirectoryParameter &); //purposely not implemented - void operator =(const DirectoryParameter&); //purposely not implemented + void operator =(const DirectoryParameter&); //purposely not + //implemented + + StringParameter::Pointer m_StringParam; }; // End class Parameter -- GitLab