OTB  10.0.0
Orfeo Toolbox
otbWrapperStringParameter.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 otbWrapperStringParameter_h
22 #define otbWrapperStringParameter_h
23 
24 #include <string>
25 #include "otbWrapperParameter.h"
26 
27 namespace otb
28 {
29 namespace Wrapper
30 {
31 
37 class OTBApplicationEngine_EXPORT StringParameter : public Parameter
38 {
39 public:
43  typedef itk::SmartPointer<Self> Pointer;
44  typedef itk::SmartPointer<const Self> ConstPointer;
45 
47  itkNewMacro(Self);
48 
50  itkTypeMacro(StringParameter, Parameter);
51 
53  void SetValue(const std::string& value)
54  {
55  m_Value = value;
56  SetActive(true);
57  }
59 
61  const std::string& GetValue() const
62  {
63  return m_Value;
64  }
65 
66  bool HasValue() const override
67  {
68  return !m_Value.empty();
69  }
70 
71  void ClearValue() override
72  {
73  m_Value = "";
74  }
75 
76  ParameterType GetType() const override
77  {
78  return ParameterType_String;
79  }
80 
81  std::string ToString() const override
82  {
83  return m_Value;
84  }
85 
86  void FromString(const std::string& value) override
87  {
88  SetValue(value);
89  }
90 
91 protected:
94  {
95  }
96 
98  ~StringParameter() override
99  {
100  }
101 
102  std::string m_Value;
103 
104 private:
106  void operator=(const StringParameter&) = delete;
107 
108 }; // End class Parameter
109 
110 } // End namespace Wrapper
111 } // End namespace otb
112 
113 #endif
This class represent a parameter for the wrapper framework This class is a high level class represent...
This class represent a string parameter for the wrapper framework.
ParameterType GetType() const override
void FromString(const std::string &value) override
void operator=(const StringParameter &)=delete
itk::SmartPointer< const Self > ConstPointer
void SetValue(const std::string &value)
StringParameter(const StringParameter &)=delete
std::string ToString() const override
const std::string & GetValue() const
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.