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