OTB  6.7.0
Orfeo Toolbox
otbWrapperStringParameter.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 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
38  : public Parameter
39 {
40 public:
46 
48  itkNewMacro(Self);
49 
51  itkTypeMacro(StringParameter, Parameter);
52 
54  void SetValue( const std::string & value )
55  {
56  m_Value = value;
57  SetActive( true );
58  }
60 
62  const std::string & GetValue() const
63  {
64  return m_Value;
65  }
66 
67  bool HasValue() const override
68  {
69  return !m_Value.empty();
70  }
71 
72  void ClearValue() override
73  {
74  m_Value = "";
75  }
76 
77  ParameterType GetType() const override
78  {
79  return ParameterType_String;
80  }
81 
82  std::string ToString() const override
83  {
84  return m_Value;
85  }
86 
87  void FromString(const std::string& value) override
88  {
89  SetValue(value);
90  }
91 
92 protected:
95  {}
96 
98  ~StringParameter() override
99  {}
100 
101  std::string m_Value;
102 
103 private:
104  StringParameter(const StringParameter &) = delete;
105  void operator =(const StringParameter&) = delete;
106 
107 }; // End class Parameter
108 
109 } // End namespace Wrapper
110 } // End namespace otb
111 
112 #endif
This class represent a parameter for the wrapper framework This class is a high level class represent...
void FromString(const std::string &value) override
const std::string & GetValue() const
itk::SmartPointer< const Self > ConstPointer
std::string ToString() const override
ParameterType GetType() const override
This class represent a string parameter for the wrapper framework.
void SetValue(const std::string &value)