OTB  6.7.0
Orfeo Toolbox
otbWrapperParameter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES)
3  *
4  * This file is part of Orfeo Toolbox
5  *
6  * https://www.orfeo-toolbox.org/
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 
21 #ifndef otbWrapperParameter_h
22 #define otbWrapperParameter_h
23 
24 
25 #include "OTBApplicationEngineExport.h"
26 #include "otbMacro.h"
27 #include "otbWrapperTypes.h"
28 
29 
30 #include <itkObjectFactory.h>
31 
32 
33 #include <string>
34 
35 
36 namespace otb
37 {
38 namespace Wrapper
39 {
40 
49 class OTBApplicationEngine_EXPORT Parameter
50  : public itk::Object
51 {
52 public:
54  typedef Parameter Self;
58 
60  itkTypeMacro(Parameter, itk::Object);
61 
63  virtual void SetName(const std::string&);
64  virtual const char* GetName() const;
66 
68  virtual void SetDescription(const std::string&);
69  virtual const std::string & GetDescription() const;
71 
73  virtual void SetKey(const std::string&);
74  virtual const char* GetKey() const;
76 
78  virtual void SetActive(bool flag);
79  bool GetActive(bool recurseParents = false) const;
81 
83  virtual void SetMandatory(bool flag);
84  virtual bool GetMandatory() const;
85  virtual void MandatoryOn();
86  virtual void MandatoryOff();
88 
90  virtual void SetAutomaticValue(bool flag);
91 
93  virtual bool GetAutomaticValue() const;
94 
96  void AutomaticValueOn();
97 
99  void AutomaticValueOff();
100 
102  virtual void SetUserLevel(const UserLevel level);
103 
105  virtual UserLevel GetUserLevel() const;
106 
108  virtual void SetRole(const Role role);
109 
111  virtual Role GetRole() const;
112 
116  virtual void Reset();
117 
118  virtual bool HasValue() const = 0;
119 
120  virtual bool HasUserValue() const;
121 
122  virtual void SetUserValue(bool isUserValue);
123 
124  virtual void ClearValue();
125 
127  virtual void SetRoot(const Parameter::Pointer root);
128 
129  virtual const Parameter::Pointer GetRoot() const;
130 
132  virtual bool IsRoot() const;
133 
137  virtual void AddChild(Parameter::Pointer child);
138 
139 
143  virtual std::vector<Parameter::Pointer > GetChildrenList();
144 
146  virtual ParameterType GetType() const = 0;
147 
149  [[noreturn]] void TypeError(const std::string& target_type) const;
150 
154  virtual int ToInt() const;
155  virtual float ToFloat() const;
156  virtual std::string ToString() const;
157  virtual std::vector<std::string> ToStringList() const;
159 
160  virtual void FromInt(int);
161  virtual void FromFloat(float);
162  virtual void FromString(const std::string&);
163  virtual void FromStringList(const std::vector<std::string>&);
164 
165 protected:
167  Parameter();
168 
170  std::string m_Name;
171 
173  std::string m_Description;
174 
176  std::string m_Key;
177 
180 
182  bool m_Active;
183 
186 
188 
191 
194 
196  std::vector<Parameter::Pointer > m_ChildrenList;
197 
198 private:
199  Parameter(const Parameter &) = delete;
200  void operator =(const Parameter&) = delete;
201 
202 }; // End class Parameter
203 
204 } // End namespace Wrapper
205 } // End namespace otb
206 
207 #endif
itk::WeakPointer< Parameter > m_Root
This class represent a parameter for the wrapper framework This class is a high level class represent...
itk::SmartPointer< const Self > ConstPointer
std::vector< Parameter::Pointer > m_ChildrenList
OTBApplicationEngine_EXPORT MDType GetType(const std::string &val)
const char * ToString(const QString &str)
Append the content of a StringVector object to the content of a QStringList object.
Definition: mvdAlgorithm.h:521
itk::SmartPointer< Self > Pointer