OTB  9.0.0
Orfeo Toolbox
otbWrapperChoiceParameter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2022 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 
71  ParameterGroup::Pointer GetChoiceParameterGroupByIndex(int i);
72 
74  ParameterGroup::Pointer GetChoiceParameterGroupByKey(std::string choiceKey);
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:
104  ChoiceParameter();
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:
126  ChoiceParameter(const ChoiceParameter&) = delete;
127  void operator=(const ChoiceParameter&) = delete;
128 
129 }; // End class Parameter
130 
131 } // End namespace Wrapper
132 } // End namespace otb
133 
134 #endif
otb::Wrapper::ChoiceParameter::m_ChoiceList
ChoiceList m_ChoiceList
Definition: otbWrapperChoiceParameter.h:121
otb::Wrapper::Parameter
This class represent a parameter for the wrapper framework This class is a high level class represent...
Definition: otbWrapperParameter.h:49
otb::Wrapper::ParameterGroup::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbWrapperParameterGroup.h:44
otb::Wrapper::ChoiceParameter
This class represent a multiple choice parameter for the wrapper framework.
Definition: otbWrapperChoiceParameter.h:40
otb::Wrapper::ChoiceParameter::Choice::m_Key
std::string m_Key
Definition: otbWrapperChoiceParameter.h:115
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::Wrapper::ChoiceParameter::Choice
Definition: otbWrapperChoiceParameter.h:109
otb::Wrapper::ChoiceParameter::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbWrapperChoiceParameter.h:47
otb::Wrapper::ChoiceParameter::Choice::Choice
Choice()
Definition: otbWrapperChoiceParameter.h:111
otb::Wrapper::ChoiceParameter::Choice::m_AssociatedParameter
ParameterGroup::Pointer m_AssociatedParameter
Definition: otbWrapperChoiceParameter.h:117
otb::Wrapper::ChoiceParameter::ChoiceList
std::vector< Choice > ChoiceList
Definition: otbWrapperChoiceParameter.h:120
otb::Wrapper::ChoiceParameter::Choice::m_Name
std::string m_Name
Definition: otbWrapperChoiceParameter.h:116
otb::Wrapper::ChoiceParameter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbWrapperChoiceParameter.h:46
otbWrapperParameterGroup.h
otb::Wrapper::ChoiceParameter::m_CurrentChoice
unsigned int m_CurrentChoice
Definition: otbWrapperChoiceParameter.h:123
otb::Wrapper::ChoiceParameter::Self
ChoiceParameter Self
Definition: otbWrapperChoiceParameter.h:44
otb::Wrapper::MetaDataHelper::GetType
OTBApplicationEngine_EXPORT MDType GetType(const std::string &val)
otb::Wrapper::ChoiceParameter::Superclass
Parameter Superclass
Definition: otbWrapperChoiceParameter.h:45
otb::Wrapper::ParameterType
ParameterType
Definition: otbWrapperTypes.h:37