OTB  6.7.0
Orfeo Toolbox
otbWrapperParameterGroup.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 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
40  : public Parameter
41 {
42 public:
47 
48  itkNewMacro(Self);
49 
50  itkTypeMacro(ParameterList, Parameter);
51 
52  void AddParameter(Parameter::Pointer p);
53 
56  bool ReplaceParameter(std::string &key, Parameter::Pointer p);
57 
59  void AddChoice(std::string paramKey, std::string paramName);
60 
62  void ClearChoices(std::string paramKey);
63 
65  std::vector<int> GetSelectedItems(std::string paramKey);
66 
70  void AddParameter(ParameterType type, std::string paramKey, std::string paramName);
71 
72  Parameter::Pointer GetParameterByIndex(unsigned int i, bool follow=true);
73 
74  Parameter::Pointer GetParameterByKey(std::string name, bool follow=true);
75 
76  void Clear()
77  {
78  m_ParameterList.clear();
79  }
80 
84  std::string GetParameterTypeAsString(ParameterType paramType);
85 
86  /* Get the parameter type from its string version of ParameterType enum */
87  ParameterType GetParameterTypeFromString(const std::string& paramType);
88 
89  unsigned int GetNumberOfParameters();
90 
91  std::vector<std::string> GetParametersKeys(bool recursive = true);
92 
93  // Always has value
94  bool HasValue() const override
95  {
96  return true;
97  }
98 
101  static Parameter* ResolveParameter(Parameter *param);
102 
103  ParameterType GetType() const override
104  {
105  return ParameterType_Group;
106  }
107 
108 protected:
109  ParameterGroup();
110  ~ParameterGroup() override;
111 
112  typedef std::vector<Parameter::Pointer> ParameterListType;
114 
115 private:
116  ParameterGroup(const ParameterGroup &) = delete;
117  void operator =(const ParameterGroup&) = delete;
118 
119 };
120 
121 }
122 }
123 
124 #endif
itk::SmartPointer< Self > Pointer
This class represent a parameter for the wrapper framework This class is a high level class represent...
ParameterType GetType() const override
This class represents a InputImage parameter.
std::vector< Parameter::Pointer > ParameterListType
itk::SmartPointer< const Self > ConstPointer