ArrayProperty.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/ArrayProperty.h
22 
23  \brief The type for variable-length multidimensional arrays.
24 */
25 
26 #ifndef __TERRALIB_DATATYPE_INTERNAL_ARRAYPROPERTY_H
27 #define __TERRALIB_DATATYPE_INTERNAL_ARRAYPROPERTY_H
28 
29 // TerraLib
30 #include "SimpleProperty.h"
31 
32 namespace te
33 {
34  namespace dt
35  {
36  /*!
37  \class ArrayProperty
38 
39  \brief The type for variable-length multidimensional arrays.
40 
41  \ingroup datatype
42 
43  \sa Property, SimpleProperty, NumericProperty, StringProperty, DateTimeProperty, CompositeProperty
44  */
46  {
47  public:
48 
49  /*!
50  \brief It constructs a new property for array data type.
51 
52  \param name The array property name.
53  \param elementType The data type of array elements.
54  \param isRequired Tells 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 array property will take the ownership of the defaultValue.
60  \post The array property will take the ownership of the elementType.
61  \post The elementType will have array property as its parent.
62 
63  \warning The identifier value (id) may be used by data source implementations. So, don't rely on its value!
64  */
65  ArrayProperty(const std::string& name,
66  Property* elementType,
67  bool isRequired = false,
68  std::string* defaultValue = 0,
69  unsigned int id = 0,
70  Property* parent = 0);
71 
72  /*!
73  \brief Copy constructor.
74 
75  \param rhs The right-hand-side copy used to copy from.
76 
77  \note This method is used by clone().
78  */
79  ArrayProperty(const ArrayProperty& rhs);
80 
81  /*! \brief Destructor. */
82  ~ArrayProperty();
83 
84  /*!
85  \brief Assignment operator.
86 
87  \param rhs The right-hand-side copy used to copy from.
88 
89  \return A reference to this object.
90  */
91  ArrayProperty& operator=(const ArrayProperty& rhs);
92 
93  /*!
94  \brief It returns the type of array elements.
95 
96  \return The type of array elements.
97  */
98  Property* getElementType() const { return m_elementType; }
99 
100  /*!
101  \brief It sets the type of array elements.
102 
103  \param t The type of array elements.
104 
105  \post The ArrayProperty will take the ownership of the given element type.
106  \post The elementType will have ArrayProperty as its parent.
107  */
108  void setElementType(Property* t);
109 
110  /*!
111  \brief It returns a clone of the object.
112 
113  The new property will NOT have associations to other elements.
114 
115  \return A clone of the object.
116  */
117  Property* clone() const;
118 
119  protected:
120 
121  Property* m_elementType; //!< The data type of array elements.
122  };
123 
124  } // end namespace dt
125 } // end namespace te
126 
127 #endif // __TERRALIB_DATATYPE_INTERNAL_ARRAYPROPERTY_H
128 
An atomic property like an integer or double.
Property * m_elementType
The data type of array elements.
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.
Property * getElementType() const
It returns the type of array elements.
Definition: ArrayProperty.h:98
The type for variable-length multidimensional arrays.
Definition: ArrayProperty.h:45
An atomic property like an integer or double.