OTB  10.0.0
Orfeo Toolbox
otbWrapperDirectoryParameter.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 otbWrapperDirectoryParameter_h
22 #define otbWrapperDirectoryParameter_h
23 
25 #include "otbMacro.h"
26 
27 #include <string>
28 
29 namespace otb
30 {
31 namespace Wrapper
32 {
33 
39 class OTBApplicationEngine_EXPORT DirectoryParameter : public Parameter
40 {
41 public:
45  typedef itk::SmartPointer<Self> Pointer;
46  typedef itk::SmartPointer<const Self> ConstPointer;
47 
49  itkNewMacro(Self);
50 
52  itkTypeMacro(DirectoryParameter, Parameter);
53 
54  bool HasValue() const override
55  {
56  return m_StringParam->HasValue();
57  }
58 
59  // Set/Get Value
60  otbSetObjectMemberMacro(StringParam, Value, std::string);
61  otbGetObjectMemberConstMacro(StringParam, Value, std::string);
62 
63  // Clear Value
64  void ClearValue() override
65  {
66  m_StringParam->ClearValue();
67  }
68 
69  // Reimplement the SetActive method
70  void SetActive(bool value) override
71  {
72  Superclass::SetActive(value);
73  m_StringParam->SetActive(value);
74  }
75 
76  // GetActive method
77  otbGetObjectMemberConstMacro(StringParam, Active, bool);
78 
79  virtual ParameterType GetType() const override
80  {
82  }
83 
84  std::string ToString() const override
85  {
86  return GetValue();
87  }
88 
89  void FromString(const std::string& value) override
90  {
91  SetValue(value);
92  }
93 
94 protected:
97  {
98  m_StringParam = StringParameter::New();
99  }
100 
103  {
104  }
105 
106 private:
108  void operator =(const DirectoryParameter&); // purposely not
109  // implemented
110 
112 
113 }; // End class Parameter
114 
115 } // End namespace Wrapper
116 } // End namespace otb
117 
118 #endif
This class represent a string parameter for the wrapper framework.
virtual ParameterType GetType() const override
DirectoryParameter(const DirectoryParameter &)=delete
otbSetObjectMemberMacro(StringParam, Value, std::string)
otbGetObjectMemberConstMacro(StringParam, Active, bool)
itk::SmartPointer< const Self > ConstPointer
otbGetObjectMemberConstMacro(StringParam, Value, std::string)
void FromString(const std::string &value) override
This class represent a parameter for the wrapper framework This class is a high level class represent...
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.