ParameterDescriptor.h
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20  /*!
21  \file terralib/process/ParameterDescriptor.h
22 
23  \brief This class represents the description of a parameter
24  */
25 
26 #ifndef __TERRALIB_PROCESS_INTERNAL_PARAMETERDESCRIPTOR_H
27 #define __TERRALIB_PROCESS_INTERNAL_PARAMETERDESCRIPTOR_H
28 
29  // TerraLib
30 #include "Config.h"
31 
32 #include "../datatype/Enums.h"
33 
34 //STL include files
35 #include <memory>
36 #include <string>
37 
38 namespace te
39 {
40  namespace process
41  {
42  class ParameterValue;
43 
44  /*!
45  \class Task
46 
47  \brief This class represents the description of a parameter
48  */
50  {
51  public:
52 
53  enum class Direction { INPUT, OUTPUT };
54 
55  //!< Constructor
56  ParameterDescriptor(const std::string& name = "", int dataType = te::dt::UNKNOWN_TYPE, bool isRequired = true, Direction type = Direction::INPUT);
57 
58  //!< Copy constructor
60 
61  /*! \brief Virtual destructor. */
63 
64  //!< Assigment operator
66 
67  //!< Gets the parameter name
68  const std::string getName() const;
69 
70  //!< Sets the parameter name
71  void setName(const std::string& name);
72 
73  //!< Gets the parameter description
74  const std::string getDescription() const;
75 
76  //!< Sets the parameter description
77  void setDescription(const std::string& description);
78 
79  //!< Gets the parameter data type
80  int getDataType() const;
81 
82  //!< Sets the parameter data type
83  void setDataType(int dataType);
84 
85  //!< Checks if the parameter is required
86  bool isRequired() const;
87 
88  //!< Sets the parameter to be required
89  void setRequired(bool required);
90 
91  //!< Gets the parameter type
93 
94  //!< Sets the parameter type
95  void setDirection(Direction direction);
96 
97  //!< Gets the default value. If not set, returns null
99 
100  //!< Sets the default value. This object wille TAKE THE OWNERSHIP of the pointer
101  void setDefaultValue(ParameterValue* defaultValue);
102 
103  //!< Checks if the given value is valid basedon the descriptor metadata
104  bool isValueValid(const te::process::ParameterValue* value) const;
105 
106  protected:
107 
108  std::string m_name;
109  std::string m_description;
113  std::unique_ptr<ParameterValue> m_defaultValue;
114  };
115  } // end namespace process
116 } // end namespace te
117 
118 #endif // __TERRALIB_PROCESS_INTERNAL_PARAMETERDESCRIPTOR_H
119 
void setDescription(const std::string &description)
Gets the parameter data type.
virtual ParameterDescriptor & operator=(const ParameterDescriptor &rhs)
Gets the parameter name.
const std::string getName() const
Sets the parameter name.
const ParameterValue * getDefaultValue() const
Sets the default value. This object wille TAKE THE OWNERSHIP of the pointer.
bool isRequired() const
Sets the parameter to be required.
virtual ~ParameterDescriptor()
Virtual destructor.
void setDataType(int dataType)
Checks if the parameter is required.
int getDataType() const
Sets the parameter data type.
std::unique_ptr< ParameterValue > m_defaultValue
void setDirection(Direction direction)
Gets the default value. If not set, returns null.
void setDefaultValue(ParameterValue *defaultValue)
Checks if the given value is valid basedon the descriptor metadata.
Direction getDirection() const
Sets the parameter type.
void setName(const std::string &name)
Gets the parameter description.
ParameterDescriptor(const std::string &name="", int dataType=te::dt::UNKNOWN_TYPE, bool isRequired=true, Direction type=Direction::INPUT)
Copy constructor.
void setRequired(bool required)
Gets the parameter type.
bool isValueValid(const te::process::ParameterValue *value) const
const std::string getDescription() const
Sets the parameter description.
ParameterDescriptor(const ParameterDescriptor &rhs)
@ UNKNOWN_TYPE
Definition: Enums.h:185
TerraLib.
#define TEPROCESSEXPORT
Definition: Config.h:47
Proxy configuration file for TerraView (see terraview_config.h).