OTB  9.0.0
Orfeo Toolbox
otbWrapperStringParameter.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 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:
105  StringParameter(const StringParameter&) = delete;
106  void operator=(const StringParameter&) = delete;
107 
108 }; // End class Parameter
109 
110 } // End namespace Wrapper
111 } // End namespace otb
112 
113 #endif
otb::Wrapper::StringParameter
This class represent a string parameter for the wrapper framework.
Definition: otbWrapperStringParameter.h:37
otb::Wrapper::StringParameter::Self
StringParameter Self
Definition: otbWrapperStringParameter.h:41
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::StringParameter::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbWrapperStringParameter.h:44
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::Wrapper::StringParameter::ClearValue
void ClearValue() override
Definition: otbWrapperStringParameter.h:71
otb::Wrapper::StringParameter::StringParameter
StringParameter()
Definition: otbWrapperStringParameter.h:93
otb::Wrapper::StringParameter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbWrapperStringParameter.h:43
otb::Wrapper::StringParameter::SetValue
void SetValue(const std::string &value)
Definition: otbWrapperStringParameter.h:53
otb::Wrapper::StringParameter::GetType
ParameterType GetType() const override
Definition: otbWrapperStringParameter.h:76
otb::Wrapper::StringParameter::m_Value
std::string m_Value
Definition: otbWrapperStringParameter.h:102
otb::Wrapper::StringParameter::ToString
std::string ToString() const override
Definition: otbWrapperStringParameter.h:81
otb::Wrapper::StringParameter::FromString
void FromString(const std::string &value) override
Definition: otbWrapperStringParameter.h:86
otb::Wrapper::ParameterType_String
@ ParameterType_String
Definition: otbWrapperTypes.h:41
otb::Wrapper::StringParameter::GetValue
const std::string & GetValue() const
Definition: otbWrapperStringParameter.h:61
otb::Wrapper::StringParameter::~StringParameter
~StringParameter() override
Definition: otbWrapperStringParameter.h:98
otb::Wrapper::StringParameter::HasValue
bool HasValue() const override
Definition: otbWrapperStringParameter.h:66
otb::Wrapper::StringParameter::Superclass
Parameter Superclass
Definition: otbWrapperStringParameter.h:42
otbWrapperParameter.h
otb::Wrapper::ParameterType
ParameterType
Definition: otbWrapperTypes.h:37