ByteArrayProperty.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/datatype/ByteArrayProperty.h
22 
23  \brief Property for byte array types.
24 */
25 
26 #ifndef __TERRALIB_DATATYPE_INTERNAL_BYTEARRAYPROPERTY_H
27 #define __TERRALIB_DATATYPE_INTERNAL_BYTEARRAYPROPERTY_H
28 
29 // TerraLib
30 #include "SimpleProperty.h"
31 
32 namespace te
33 {
34  namespace dt
35  {
36  /*!
37  \class ByteArrayProperty
38 
39  \brief Property for byte array types.
40 
41  \ingroup datatype
42 
43  \sa SimpleProperty, Property, NumericProperty, ArrayProperty, DateTimeProperty, CompositeProperty, StringProperty, BitProperty
44  */
46  {
47  public:
48 
49  /*!
50  \brief It constructs a new byte array property.
51 
52  \param name The attribute name.
53  \param nbytes The maximum number of bytes or zero for unlimited size.
54  \param isRequired It indicates if the the property is required (mandatory) or not.
55  \param defaultValue The default value to be used, if none is informed.
56  \param id The property identifier.
57  \param parent A reference to the parent Property of the new object if it has one.
58 
59  \post The byte-array property will take the ownership of the defaultValue.
60 
61  \warning The identifier value (id) may be used by data source implementations. So, don't rely on its value!
62  */
63  ByteArrayProperty(const std::string& name,
64  std::size_t nbytes = 0,
65  bool isRequired = false,
66  std::string* defaultValue = 0,
67  unsigned int id = 0,
68  Property* parent = 0);
69 
70  /*!
71  \brief Copy constructor.
72 
73  \param rhs The right-hand-side copy used to copy from.
74 
75  \note This method is used by clone().
76  */
78 
79  /*! \brief Destructor. */
81 
82  /*!
83  \brief Assignment operator.
84 
85  \param rhs The right-hand-side copy used to copy from.
86 
87  \return A reference to this object.
88  */
89  ByteArrayProperty& operator=(const ByteArrayProperty& rhs);
90 
91  /*!
92  \brief It returns the maximum number of bytes for the byte array data.
93 
94  \return The maximum number of bytes for the byte array data.
95  */
96  std::size_t getMaxSize() const { return m_nbytes; }
97 
98  /*!
99  \brief It sets the maximum number of bytes for the byte array data.
100 
101  \param size The maximum number of bytes for the byte array data.
102  */
103  void setMaxSize(std::size_t s) { m_nbytes = s; }
104 
105  /*!
106  \brief It returns a clone of the object.
107 
108  The new property will NOT have associations to other properties.
109 
110  \return A clone of the object.
111  */
112  Property* clone() const;
113 
114  protected:
115 
116  std::size_t m_nbytes; //!< The number of bits represented by the property.
117  };
118 
119  } // end namespace dt
120 } // end namespace te
121 
122 #endif // __TERRALIB_DATATYPE_INTERNAL_BYTEARRAYPROPERTY_H
123 
An atomic property like an integer or double.
It models a property definition.
Definition: Property.h:59
#define TEDATATYPEEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:61
URI C++ Library.
std::size_t m_nbytes
The number of bits represented by the property.
void setMaxSize(std::size_t s)
It sets the maximum number of bytes for the byte array data.
An atomic property like an integer or double.
std::size_t getMaxSize() const
It returns the maximum number of bytes for the byte array data.
Property for byte array types.