OTB  9.0.0
Orfeo Toolbox
otbWrapperParameterGroup.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 otbWrapperParameterGroup_h
22 #define otbWrapperParameterGroup_h
23 
24 #include "itkObject.h"
25 #include "otbWrapperParameter.h"
26 #include <vector>
27 #include <string>
28 
29 namespace otb
30 {
31 namespace Wrapper
32 {
33 
39 class OTBApplicationEngine_EXPORT ParameterGroup : public Parameter
40 {
41 public:
44  typedef itk::SmartPointer<Self> Pointer;
45  typedef itk::SmartPointer<const Self> ConstPointer;
46 
47  itkNewMacro(Self);
48 
49  itkTypeMacro(ParameterList, Parameter);
50 
51  void AddParameter(Parameter::Pointer p);
52 
55  bool ReplaceParameter(std::string& key, Parameter::Pointer p);
56 
58  void AddChoice(std::string paramKey, std::string paramName);
59 
61  void ClearChoices(std::string paramKey);
62 
64  std::vector<int> GetSelectedItems(std::string paramKey);
65 
69  void AddParameter(ParameterType type, std::string paramKey, std::string paramName);
70 
71  Parameter::Pointer GetParameterByIndex(unsigned int i, bool follow = true);
72 
73  Parameter::Pointer GetParameterByKey(std::string name, bool follow = true);
74 
75  void Clear()
76  {
77  m_ParameterList.clear();
78  }
79 
83  std::string GetParameterTypeAsString(ParameterType paramType);
84 
85  /* Get the parameter type from its string version of ParameterType enum */
86  ParameterType GetParameterTypeFromString(const std::string& paramType);
87 
88  unsigned int GetNumberOfParameters();
89 
90  std::vector<std::string> GetParametersKeys(bool recursive = true);
91 
92  // Always has value
93  bool HasValue() const override
94  {
95  return true;
96  }
97 
100  static Parameter* ResolveParameter(Parameter* param);
101 
102  ParameterType GetType() const override
103  {
104  return ParameterType_Group;
105  }
106 
107 protected:
108  ParameterGroup();
109  ~ParameterGroup() override;
110 
111  typedef std::vector<Parameter::Pointer> ParameterListType;
113 
114 private:
115  ParameterGroup(const ParameterGroup&) = delete;
116  void operator=(const ParameterGroup&) = delete;
117 };
118 }
119 }
120 
121 #endif
otb::Wrapper::ParameterGroup::ParameterListType
std::vector< Parameter::Pointer > ParameterListType
Definition: otbWrapperParameterGroup.h:111
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::ParameterList
This class represents a InputImage parameter.
Definition: otbWrapperParameterList.h:42
otb::Wrapper::ParameterGroup::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbWrapperParameterGroup.h:44
otb::Wrapper::ParameterGroup::GetType
ParameterType GetType() const override
Definition: otbWrapperParameterGroup.h:102
otb::Wrapper::ParameterGroup::Superclass
Parameter Superclass
Definition: otbWrapperParameterGroup.h:43
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::Wrapper::ParameterGroup::Clear
void Clear()
Definition: otbWrapperParameterGroup.h:75
otb::Wrapper::ParameterType_Group
@ ParameterType_Group
Definition: otbWrapperTypes.h:55
otb::Wrapper::ParameterGroup
Definition: otbWrapperParameterGroup.h:39
otb::Wrapper::Parameter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbWrapperParameter.h:55
otb::Wrapper::ParameterGroup::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbWrapperParameterGroup.h:45
otb::Wrapper::ParameterGroup::m_ParameterList
ParameterListType m_ParameterList
Definition: otbWrapperParameterGroup.h:112
otb::Wrapper::ParameterGroup::HasValue
bool HasValue() const override
Definition: otbWrapperParameterGroup.h:93
otb::Wrapper::ParameterGroup::Self
ParameterGroup Self
Definition: otbWrapperParameterGroup.h:42
otbWrapperParameter.h
otb::Wrapper::ParameterType
ParameterType
Definition: otbWrapperTypes.h:37