Loading...
Searching...
No Matches
TimePeriodTZ.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/TimePeriodTZ.h
22
23 \brief A class to represent time period with time zone.
24*/
25
26#ifndef __TERRALIB_DATATYPE_INTERNAL_TIMEPERIODTZ_H
27#define __TERRALIB_DATATYPE_INTERNAL_TIMEPERIODTZ_H
28
29// TerraLib
30#include "DateTimePeriod.h"
31
32// Boost
33#include <boost/date_time/local_time/local_time.hpp>
34
35namespace te
36{
37 namespace dt
38 {
39 class TimeInstantTZ;
40
41 /*!
42 \class TimePeriodTZ
43
44 \brief A class to represent time period with time zone.
45
46 A time period is a part of the continous time axis limited by two
47 time instants with time zone. Each time instant with time zone is composed
48 of a date that uses the Gregorian calendar and of a time with an associated time zone.
49 Internally, it uses the datetime boost library to represent time
50 period with time zone, by using the data type boost::local_time::local_time_period.
51
52 \sa DateTime, Date, DatePeriod, DateDuration, TimeInstant, TimeInstantTZ, TimePeriod, TimeDuration
53 */
55 {
56 public:
57
58 /*!
59 \brief Constructor.
60
61 \param initialTime A initial time instant.
62 \param finalTime A final time instant.
63 */
64 TimePeriodTZ(const TimeInstantTZ& initialTime, const TimeInstantTZ& finalTime);
65
66 /*!
67 \brief Constructor.
68
69 \param t A time period with time zone.
70 */
71 TimePeriodTZ(const boost::local_time::local_time_period& t);
72
73 /*!
74 \brief It returns the boost time period with time zone type.
75
76 \return The boost time period with time zone type.
77 */
78 const boost::local_time::local_time_period& getTimePeriodTZ() const { return m_timePeriodTZ; }
79
80 /*!
81 \brief It returns the boost time period with time zone type.
82
83 \return The boost time period with time zone type.
84 */
85 boost::local_time::local_time_period& getTimePeriodTZ() { return m_timePeriodTZ; }
86
87 /*!
88 \brief It gets the initial time instant.
89
90 \return The initial time instant
91 */
93
94 /*!
95 \brief It gets the final time instant.
96
97 \return The final time instant
98 */
100
101 /*!
102 \brief It gets the initial date time instant.
103
104 \return The initial time instant
105
106 \note The caller will take the ownership of the returned pointer.
107 */
109
110 /*!
111 \brief It gets the final date time instant.
112
113 \return The final time instant
114
115 \note The caller will take the ownership of the returned pointer.
116 */
118
119 /*!
120 \brief Operator ==
121
122 \param rhs The time period to be compared.
123
124 \return It returns true if the two time period are equal. Otherwise, it returns false.
125 */
126 bool operator==(const DateTime& rhs) const;
127
128 /*!
129 \brief Operator !=
130
131 \param rhs The time period to be compared.
132
133 \return It returns true if the two time periods are not equal. Otherwise, it returns false.
134 */
135 bool operator!=(const DateTime& rhs) const;
136
137 /*!
138 \brief Operator <
139
140 \param rhs The right-hand-side time period to be compared.
141
142 \return It returns true if the right-hand-side time period is greater than the lefth side one. Otherwise, it returns false.
143 */
144 bool operator<(const DateTime& rhs) const;
145
146 /*!
147 \brief Operator >
148
149 \param rhs The right-hand-side time period to be compared.
150
151 \return It returns true if the right-hand-side time period is less than the lefth side one. Otherwise, it returns false.
152 */
153 bool operator>(const DateTime& rhs) const;
154
155 /*!
156 \brief It returns a clone of this object.
157
158 \return A clone of this object.
159 */
161
162 /*!
163 \brief It returns the time period with time zone in the ISO textual format (YYYYMMDDThhmmss±hhmm/YYYYMMDDThhmmss±hhmm).
164
165 \return The time period with time zone in the ISO textual format (YYYYMMDDThhmmss±hhmm/YYYYMMDDThhmmss±hhmm).
166 */
167 std::string toString() const;
168
169 /*!
170 \brief It returns the subtype of the date and time type.
171
172 \return The subtype of the date and time type.
173 */
175
176 /*!
177 \brief Destructor.
178 */
179 virtual ~TimePeriodTZ();
180
181 protected:
182
183 boost::local_time::local_time_period m_timePeriodTZ; //!< Time period with time zone information.
184 };
185
186 } // end namespace dt
187} // end namespace te
188
189#endif // __TERRALIB_DATATYPE_INTERNAL_TIMEPERIODTZ_H
190
An abstract class to represent a period of date and time.
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 time instant with time zone.
Definition: TimeInstantTZ.h:57
A class to represent time period with time zone.
Definition: TimePeriodTZ.h:55
TimePeriodTZ(const TimeInstantTZ &initialTime, const TimeInstantTZ &finalTime)
Constructor.
bool operator!=(const DateTime &rhs) const
Operator !=.
std::string toString() const
It returns the time period with time zone in the ISO textual format (YYYYMMDDThhmmss±hhmm/YYYYMMDDThh...
AbstractData * clone() const
It returns a clone of this object.
TimePeriodTZ(const boost::local_time::local_time_period &t)
Constructor.
bool operator<(const DateTime &rhs) const
Operator <.
virtual ~TimePeriodTZ()
Destructor.
TimeInstantTZ getFinalTimeInstant() const
It gets the final time instant.
boost::local_time::local_time_period & getTimePeriodTZ()
It returns the boost time period with time zone type.
Definition: TimePeriodTZ.h:85
const boost::local_time::local_time_period & getTimePeriodTZ() const
It returns the boost time period with time zone type.
Definition: TimePeriodTZ.h:78
bool operator==(const DateTime &rhs) const
Operator ==.
bool operator>(const DateTime &rhs) const
Operator >
TimeInstantTZ getInitialTimeInstant() const
It gets the initial time instant.
boost::local_time::local_time_period m_timePeriodTZ
Time period with time zone information.
Definition: TimePeriodTZ.h:183
DateTimeInstant * getInitialInstant() const
It gets the initial date time instant.
DateTimeInstant * getFinalInstant() const
It gets the final date time instant.
DateTimeType getDateTimeType() const
It returns the subtype of the date and time type.
Definition: TimePeriodTZ.h:174
DateTimeType
The subtype of date and time type, based on ISO 8621.
Definition: Enums.h:46
@ TIME_PERIOD_TZ
Definition: Enums.h:54
TerraLib.
#define TEDATATYPEEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:61