Loading...
Searching...
No Matches
OrdinalPeriod.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/OrdinalPeriod.h
22
23 \brief A class to represent ordinal time period.
24*/
25
26#ifndef __TERRALIB_DATATYPE_INTERNAL_ORDINALPERIOD_H
27#define __TERRALIB_DATATYPE_INTERNAL_ORDINALPERIOD_H
28
29// TerraLib
30#include "DateTimePeriod.h"
31#include "SimpleData.h"
32#include "OrdinalInstant.h"
33
34namespace te
35{
36 namespace dt
37 {
38 /*!
39 \class OrdinalPeriod
40
41 \brief A class to represent ordinal time period.
42
43 A time period represented by two ordinal numbers: the first one
44 to represent the inital time and the second one the final time.
45 Examples: a time period whose initial time is the first
46 epidemiological week and the final time is the fifht epidemiological
47 week.
48
49 To understand the meaning of the ordinal numbers, a user has to use
50 extra information, such as the temporal resolution and the starting time
51 in the DateTimeProperty.
52
53 \sa DateTime
54 */
56 {
57 public:
58
59 /*! \brief Empty constructor. */
61
62 /*!
63 \brief Constructor.
64
65 \param it The initial time instant.
66 \param ft The final time instant.
67 */
69
70 /*!
71 \brief It returns the inital time instant.
72
73 \return The initial time instant.
74 */
75 Int64 getInitialTime() const { return m_initialInstant.getTimeInstant(); }
76
77 /*!
78 \brief It returns the final time instant.
79
80 \return The final time instant.
81 */
82 Int64 getFinalTime() const { return m_finalInstant.getTimeInstant(); }
83
84 /*!
85 \brief It gets the initial date time instant.
86
87 \return The initial time instant
88
89 \note The caller will take the ownership of the returned pointer.
90 */
92
93 /*!
94 \brief It gets the final date time instant.
95
96 \return The final time instant
97
98 \note The caller will take the ownership of the returned pointer.
99 */
101
102 /*!
103 \brief It sets the inital time instant.
104
105 \param it The initial time instant.
106 */
107 void setInitialInstant(Int64 it) { m_initialInstant = it; }
108
109 /*!
110 \brief It sets the final time instant.
111
112 \param ft The final time instant.
113 */
114 void setFinalInstant(Int64 ft) { m_finalInstant = ft; }
115
116 /*!
117 \brief Operator ==
118
119 \param rhs The time period to be compared.
120
121 \return It returns true if the two time periods are equal. Otherwise, it returns false.
122 */
123 bool operator==(const DateTime& rhs) const;
124
125 /*!
126 \brief Operator !=
127
128 \param rhs The time period to be compared.
129
130 \return It returns true if the two time periods are not equal. Otherwise, it returns false.
131 */
132 bool operator!=(const DateTime& rhs) const;
133
134 /*!
135 \brief Operator <
136
137 \param rhs The right-hand-side time period to be compared.
138
139 \return It returns true if the right-hand-side time period is greater than the lefth side one. Otherwise, it returns false.
140 */
141 bool operator<(const DateTime& rhs) const;
142
143 /*!
144 \brief Operator >
145
146 \param rhs The right-hand-side time period to be compared.
147
148 \return It returns true if the right-hand-side time period is less than the lefth side one. Otherwise, it returns false.
149 */
150 bool operator>(const DateTime& rhs) const;
151
152 /*!
153 \brief It returns a clone of this object.
154
155 \return A clone of this object.
156 */
158
159 /*!
160 \brief It returns the time period in a textual format (initialTimeInstant-finalTimeinstant)
161
162 \return The time period in a textual format (initialTimeInstant-finalTimeinstant)
163 */
164 std::string toString() const;
165
166 /*!
167 \brief It returns the subtype of the date and time type.
168
169 \return The subtype of the date and time type.
170 */
172
173 protected:
174
175 OrdinalInstant m_initialInstant; //!< The initial time instant information.
176 OrdinalInstant m_finalInstant; //!< The final time instant information.
177 };
178
179 } // end namespace dt
180} // end namespace te
181
182#endif // __TERRALIB_DATATYPE_INTERNAL_ORDINALPERIOD_H
183
An abstract class to represent a period of date and time.
A class to represent ordinal time instant.
This file contains several implementations for atomic data types (integers, floats,...
A base class for values that can be retrieved from the data access module.
Definition: AbstractData.h:56
An abstract class to represent an instant of date and time.
An abstract class to represent a period of date and time.
A class to represent ordinal time instant.
A class to represent ordinal time period.
Definition: OrdinalPeriod.h:56
void setFinalInstant(Int64 ft)
It sets the final time instant.
Int64 getFinalTime() const
It returns the final time instant.
Definition: OrdinalPeriod.h:82
DateTimeInstant * getInitialInstant() const
It gets the initial date time instant.
bool operator==(const DateTime &rhs) const
Operator ==.
DateTimeInstant * getFinalInstant() const
It gets the final date time instant.
void setInitialInstant(Int64 it)
It sets the inital time instant.
OrdinalInstant m_finalInstant
The final time instant information.
std::string toString() const
It returns the time period in a textual format (initialTimeInstant-finalTimeinstant)
bool operator>(const DateTime &rhs) const
Operator >
OrdinalInstant m_initialInstant
The initial time instant information.
OrdinalPeriod()
Empty constructor.
bool operator<(const DateTime &rhs) const
Operator <.
OrdinalPeriod(Int64 it, Int64 ft)
Constructor.
Int64 getInitialTime() const
It returns the inital time instant.
Definition: OrdinalPeriod.h:75
AbstractData * clone() const
It returns a clone of this object.
bool operator!=(const DateTime &rhs) const
Operator !=.
DateTimeType getDateTimeType() const
It returns the subtype of the date and time type.
DateTimeType
The subtype of date and time type, based on ISO 8621.
Definition: Enums.h:46
@ ORDINAL_TIME_PERIOD
Definition: Enums.h:56
TerraLib.
#define TEDATATYPEEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:61