OTB  10.0.0
Orfeo Toolbox
otbWrapperChoiceParameter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2024 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 otbWrapperChoiceParameter_h
22 #define otbWrapperChoiceParameter_h
23 
25 #include <string>
26 
27 namespace otb
28 {
29 namespace Wrapper
30 {
31 
40 class OTBApplicationEngine_EXPORT ChoiceParameter : public Parameter
41 {
42 public:
46  typedef itk::SmartPointer<Self> Pointer;
47  typedef itk::SmartPointer<const Self> ConstPointer;
48 
50  itkNewMacro(Self);
51 
53  itkTypeMacro(ChoiceParameter, Parameter);
54 
56  void AddChoice(std::string choicekey, std::string choiceName);
57 
59  std::string GetChoiceKey(int i) const;
60 
62  std::vector<std::string> GetChoiceKeys();
63 
65  std::string GetChoiceName(int i);
66 
68  std::vector<std::string> GetChoiceNames();
69 
72 
75 
77  std::vector<std::string> GetParametersKeys();
78 
80  unsigned int GetNbChoices(void);
81 
83  virtual void SetValue(unsigned int v);
84 
86  virtual void SetValue(std::string choiceKey);
87 
89  virtual unsigned int GetValue() const;
90 
91  bool HasValue() const override;
92  void ClearValue() override;
93 
94  ParameterType GetType() const override;
95 
96  int ToInt() const override;
97  void FromInt(int value) override;
98 
99  std::string ToString() const override;
100  void FromString(const std::string& value) override;
101 
102 protected:
105 
107  ~ChoiceParameter() override;
108 
109  struct Choice
110  {
112  {
113  }
114 
115  std::string m_Key;
116  std::string m_Name;
118  };
119 
120  typedef std::vector<Choice> ChoiceList;
122 
123  unsigned int m_CurrentChoice;
124 
125 private:
127  void operator=(const ChoiceParameter&) = delete;
128 
129 }; // End class Parameter
130 
131 } // End namespace Wrapper
132 } // End namespace otb
133 
134 #endif
This class represent a multiple choice parameter for the wrapper framework.
bool HasValue() const override
int ToInt() const override
ParameterType GetType() const override
itk::SmartPointer< const Self > ConstPointer
virtual void SetValue(unsigned int v)
virtual unsigned int GetValue() const
ParameterGroup::Pointer GetChoiceParameterGroupByKey(std::string choiceKey)
std::vector< std::string > GetChoiceNames()
void FromInt(int value) override
ChoiceParameter(const ChoiceParameter &)=delete
std::string ToString() const override
std::vector< std::string > GetParametersKeys()
ParameterGroup::Pointer GetChoiceParameterGroupByIndex(int i)
unsigned int GetNbChoices(void)
virtual void SetValue(std::string choiceKey)
void AddChoice(std::string choicekey, std::string choiceName)
std::vector< std::string > GetChoiceKeys()
void operator=(const ChoiceParameter &)=delete
void FromString(const std::string &value) override
std::string GetChoiceName(int i)
std::string GetChoiceKey(int i) const
itk::SmartPointer< Self > Pointer
This class represent a parameter for the wrapper framework This class is a high level class represent...
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.