All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DateTimeProperty.h
Go to the documentation of this file.
1 /* Copyright (C) 2008-2013 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/DateTimeProperty.h
22 
23  \brief The type for date and time types.
24 */
25 
26 #ifndef __TERRALIB_DATATYPE_INTERNAL_DATETIMEPROPERTY_H
27 #define __TERRALIB_DATATYPE_INTERNAL_DATETIMEPROPERTY_H
28 
29 // TerraLib
30 #include "Enums.h"
31 #include "SimpleProperty.h"
32 
33 namespace te
34 {
35  namespace dt
36  {
37  /*!
38  \class DateTimeProperty
39 
40  \brief The type for date and time types: date, date period, date duration, time duration, time instant, time period, time instant with time zone or time period with time zone.
41 
42  \ingroup datatype
43 
44  \sa SimpleProperty, Property, NumericProperty, ArrayProperty, StringProperty, CompositeProperty
45  */
47  {
48  public:
49 
50  /*!
51  \brief It constructs a new date and time property.
52 
53  \param name The attribute name.
54  \param dateType The date and time subtype. Must be one of: TIME_STAMP, TIME_STAMP_TZ, DATE, DATETIME, TIME or TIME_TZ.
55  \param isRequired It indicates if the the property is required (mandatory) or not.
56  \param defaultValue The default value to be used, if none is informed.
57  \param id The property identifier.
58  \param parent A reference to the parent Property of the new object if it has one.
59 
60  \post The date time property will take the ownership of the defaultValue.
61 
62  \warning The identifier value (id) may be used by data source implementations. So, don't rely on its value!
63  */
64  DateTimeProperty(const std::string& name,
65  DateTimeType dateType = DATE,
66  DateTimeResolution dtResolution = UNKNOWN,
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  */
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  DateTimeProperty& operator=(const DateTimeProperty& rhs);
90 
91  /*!
92  \brief It returns the date time property sub type.
93 
94  \return The string property sub type.
95  */
96  DateTimeType getSubType() const { return m_dSubType; }
97 
98  /*!
99  \brief It sets the date time property sub type.
100 
101  \param t The date time property sub type.
102  */
103  void setSubtype(DateTimeType t) { m_dSubType = t; }
104 
105  /*!
106  \brief It returns the date time resolution.
107 
108  \return The date and time resolution.
109  */
110  DateTimeResolution getResolution() const { return m_dtResolution; }
111 
112  /*!
113  \brief It sets the date time resolution.
114 
115  \param r The date time resolution.
116  */
117  void setResolution(DateTimeResolution r) { m_dtResolution = r; }
118 
119  /*!
120  \brief It returns a clone of the object.
121 
122  The new property will NOT have associations to other properties.
123 
124  \return A clone of the object.
125  */
126  Property* clone() const;
127 
128  protected:
129 
130  DateTimeType m_dSubType; //!< The sub-type of this date time property.
131  DateTimeResolution m_dtResolution; //!< The date and time resolution.
132  };
133 
134  } // end namespace dt
135 } // end namespace te
136 
137 #endif // __TERRALIB_DATATYPE_INTERNAL_DATETIMEPROPERTY_H
138 
DateTimeResolution
The date and time resolution.
Definition: Enums.h:57
An atomic property like an integer or double.
An atomic property like an integer or double.
#define TEDATATYPEEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:99
The type for date and time types: date, date period, date duration, time duration, time instant, time period, time instant with time zone or time period with time zone.
~DateTimeProperty()
Destructor.
DateTimeType getSubType() const
It returns the date time property sub type.
DateTimeResolution m_dtResolution
The date and time resolution.
General enumerations for the data type module.
DateTimeResolution getResolution() const
It returns the date time resolution.
void setResolution(DateTimeResolution r)
It sets the date time resolution.
DateTimeType
The subtype of date and time type.
Definition: Enums.h:38
DateTimeType m_dSubType
The sub-type of this date time property.
It models a property definition.
Definition: Property.h:59
void setSubtype(DateTimeType t)
It sets the date time property sub type.