Orfeo Toolbox  3.16
otbWrapperParameter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ORFEO Toolbox
4  Language: C++
5  Date: $Date$
6  Version: $Revision$
7 
8 
9  Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
10  See OTBCopyright.txt for details.
11 
12 
13  This software is distributed WITHOUT ANY WARRANTY; without even
14  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  PURPOSE. See the above copyright notices for more information.
16 
17 =========================================================================*/
18 #ifndef __otbWrapperParameter_h
19 #define __otbWrapperParameter_h
20 
21 #include "otbMacro.h"
22 #include "itkObject.h"
23 #include "boost/any.hpp"
24 #include "itkObjectFactory.h"
25 
26 #include "otbWrapperTypes.h"
27 
28 namespace otb
29 {
30 namespace Wrapper
31 {
33  {
44 
50  };
51 
52 
59 class Parameter
60  : public itk::Object
61 {
62 public:
64  typedef Parameter Self;
68 
70  itkNewMacro(Self);
71 
73  itkTypeMacro(Parameter, itk::Object);
74 
76  itkSetStringMacro(Name);
77 
79  itkGetStringMacro(Name);
80 
82  itkSetStringMacro(Description);
83 
85  itkGetStringMacro(Description);
86 
88  itkSetStringMacro(Key);
89 
91  itkGetStringMacro(Key);
92 
94  itkSetMacro(Active, bool);
95 
97  itkGetConstMacro(Active, bool);
98 
100  itkSetMacro(Mandatory, bool);
101 
103  itkGetConstMacro(Mandatory, bool);
104 
106  itkBooleanMacro(Mandatory);
107 
109  itkSetMacro(AutomaticValue, bool);
110 
112  itkGetConstMacro(AutomaticValue, bool);
113 
115  itkBooleanMacro(AutomaticValue);
116 
118  itkSetEnumMacro(DefaultValueMode, DefaultValueMode);
119 
121  itkGetEnumMacro(DefaultValueMode, DefaultValueMode);
122 
124  itkSetEnumMacro(UserLevel, UserLevel);
125 
127  itkGetEnumMacro(UserLevel, UserLevel);
128 
130  itkSetEnumMacro(Role, Role);
131 
133  itkGetEnumMacro(Role, Role);
134 
138  virtual void Reset()
139  {
140  }
141 
142  virtual bool HasValue() const
143  {
144  itkExceptionMacro(<<"HasValue() method must be re-implemented by sub-classes.");
145  }
146 
147  virtual bool HasUserValue() const
148  {
149  return HasValue() && m_UserValue;
150  }
151 
152  virtual void SetUserValue(bool isUserValue)
153  {
154  m_UserValue = isUserValue;
155  }
156 
157  virtual void ClearValue()
158  {
159  itkExceptionMacro(<<"ClearValue() method must be re-implemented by sub-classes.");
160  }
161 
163  virtual void SetRoot(const Parameter::Pointer root)
164  {
165  m_Root = root.GetPointer();
166  }
167 
168  virtual const Parameter::Pointer GetRoot()
169  {
170  return m_Root.GetPointer();
171  }
172 
174  virtual bool IsRoot()
175  {
176  return (this == m_Root.GetPointer());
177  }
178 
182  virtual void AddChild(Parameter::Pointer child)
183  {
184  m_ChildrenList.push_back(child);
185  }
186 
190  virtual std::vector<Parameter::Pointer > GetChildrenList()
191  {
192  return m_ChildrenList;
193  }
194 
198  virtual bool IsChecked()
199  {
200  return m_IsChecked;
201  }
202 
204  virtual void SetChecked(const bool value)
205  {
206  m_IsChecked = value;
207  }
208 
209 protected:
211  Parameter() : m_Name(""),
212  m_Description(""),
213  m_Key(""),
214  m_Mandatory(true),
215  m_Active(false),
216  m_UserValue(false),
217  m_AutomaticValue(false),
221  m_Root(this),
222  m_IsChecked(false)
223  {}
224 
226  virtual ~Parameter()
227  {}
228 
230  std::string m_Name;
231 
233  std::string m_Description;
234 
236  std::string m_Key;
237 
240 
242  bool m_Active;
243 
246 
249 
252 
254 
257 
260 
262  std::vector<Parameter::Pointer > m_ChildrenList;
263 
266 
267 private:
268  Parameter(const Parameter &); //purposely not implemented
269  void operator =(const Parameter&); //purposely not implemented
270 
271 }; // End class Parameter
272 
273 } // End namespace Wrapper
274 } // End namespace otb
275 
276 #endif

Generated at Sun May 19 2013 01:01:49 for Orfeo Toolbox with doxygen 1.8.3.1