OTB  6.1.0
Orfeo Toolbox
otbWrapperParameterGroup.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2017 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 
28 namespace otb
29 {
30 namespace Wrapper
31 {
32 
38 class OTBApplicationEngine_EXPORT ParameterGroup
39  : public Parameter
40 {
41 public:
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 
76  void AddInXMLParameter();
77 
78  void AddOutXMLParameter();
79 
80  void Clear()
81  {
82  m_ParameterList.clear();
83  }
84 
88  std::string GetParameterTypeAsString(ParameterType paramType);
89 
90  /* Get the parameter type from its string version of ParameterType enum */
91  ParameterType GetParameterTypeFromString(std::string paramType);
92 
93  unsigned int GetNumberOfParameters();
94 
95  std::vector<std::string> GetParametersKeys(bool recursive = true);
96 
97  // Always has value
98  bool HasValue() const ITK_OVERRIDE
99  {
100  return true;
101  }
102 
105  static Parameter* ResolveParameter(Parameter *param);
106 
107 protected:
108  ParameterGroup();
109  ~ParameterGroup() ITK_OVERRIDE;
110 
111  typedef std::vector<Parameter::Pointer> ParameterListType;
112  ParameterListType m_ParameterList;
113 
114 private:
115  ParameterGroup(const ParameterGroup &); //purposely not implemented
116  void operator =(const ParameterGroup&); //purposely not implemented
117 
118 };
119 
120 }
121 }
122 
123 #endif
itk::SmartPointer< Self > Pointer
This class represent a parameter for the wrapper framework This class is a high level class represent...
bool HasValue() const ITK_OVERRIDE
std::vector< Parameter::Pointer > ParameterListType
itk::SmartPointer< const Self > ConstPointer