Loading...
Searching...
No Matches
TimeInstantTZ.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/TimeInstantTZ.h
22
23 \brief A class to represent time instant with time zone.
24*/
25
26#ifndef __TERRALIB_DATATYPE_INTERNAL_TIMEINSTANTTZ_H
27#define __TERRALIB_DATATYPE_INTERNAL_TIMEINSTANTTZ_H
28
29// TerraLib
30#include "DateTimeInstant.h"
31
32// Boost
33#include <boost/date_time/local_time/local_time.hpp>
34
35namespace te
36{
37 namespace dt
38 {
39
40 class Date;
41 class TimeDuration;
42
43 /*!
44 \class TimeInstantTZ
45
46 \brief A class to represent time instant with time zone.
47
48 A time instant is a point on the continuous time axis. A time instant
49 with time zone is composed of a date that uses the Gregorian calendar and
50 of a time with an associated time zone. Internally, it uses the datetime boost
51 library to represent time instant with time zone, by using the data type
52 boost::local_time::local_date_time.
53
54 \sa DateTime, Date, DatePeriod, DateDuration, TimeInstant, TimePeriod, TimeDuration, TimePeriodTZ
55 */
57 {
58 public:
59
60 /*!
61 \brief Constructor.
62
63 \param t A time instant with time zone.
64 */
65 TimeInstantTZ(const boost::local_time::local_date_time& t);
66
67 /*!
68 \brief It returns the boost time instant with time zone type.
69
70 \return The boost time instant with time zone type.
71 */
72 const boost::local_time::local_date_time& getTimeInstantTZ() const { return m_timeInstantTZ; }
73
74 /*!
75 \brief It returns the boost time instant with time zone type.
76
77 \return The boost time instant with time zone type.
78 */
79 boost::local_time::local_date_time& getTimeInstantTZ() { return m_timeInstantTZ; }
80
81 /*!
82 \brief It returns the date associated to time instant.
83
84 \return The date
85 */
86 Date getDate() const;
87
88 /*!
89 \brief It returns the time duration associated to time instant.
90
91 \return The time duration
92 */
94
95 /*!
96 \brief Operator ==
97
98 \param rhs The time instant to be compared.
99
100 \return It returns true if the two time instants are equal. Otherwise, it returns false.
101 */
102 bool operator==(const DateTime& rhs) const;
103
104 /*!
105 \brief Operator !=
106
107 \param rhs The time instant to be compared.
108
109 \return It returns true if the two time instants are not equal. Otherwise, it returns false.
110 */
111 bool operator!=(const DateTime& rhs) const;
112
113 /*!
114 \brief Operator <
115
116 \param rhs The right-hand-side time instant to be compared.
117
118 \return It returns true if the right-hand-side time instant is greater than the lefth side one. Otherwise, it returns false.
119 */
120 bool operator<(const DateTime& rhs) const;
121
122 /*!
123 \brief Operator >
124
125 \param rhs The right-hand-side time instant to be compared.
126
127 \return It returns true if the right-hand-side time instant is less than the lefth side one. Otherwise, it returns false.
128 */
129 bool operator>(const DateTime& rhs) const;
130
131 /*!
132 \brief Operator -
133
134 \param rhs The right-hand-side time instant.
135
136 \return It returns the number of seconds between the two time instants.
137 */
138 long operator-(const TimeInstantTZ& rhs) const;
139
140 /*!
141 \brief It returns a clone of this object.
142
143 \return A clone of this object.
144 */
146
147 /*!
148 \brief It returns the time instant with time zone in the ISO textual format (YYYYMMDDThhmmss?hhmm).
149
150 \return The time instant with time zone in the ISO textual format (YYYYMMDDThhmmss?hhmm).
151 */
152 std::string toString() const;
153
154 /*!
155 \brief It returns the subtype of the date and time type.
156
157 \return The subtype of the date and time type.
158 */
160
161 /*! \brief Constructor. */
162 virtual ~TimeInstantTZ();
163
164 protected:
165
166 boost::local_time::local_date_time m_timeInstantTZ; //!< Time instant with time zone information.
167 };
168
169 } // end namespace dt
170} // end namespace te
171
172#endif // __TERRALIB_DATATYPE_INTERNAL_TIMEINSTANTTZ_H
173
An abstract class to represent an instant of date and time.
A base class for values that can be retrieved from the data access module.
An abstract class to represent an instant of date and time.
A base class for date data types.
Definition Date.h:66
A class to represent time duration with nano-second/micro-second resolution.
A class to represent time instant with time zone.
bool operator<(const DateTime &rhs) const
Operator <.
Date getDate() const
It returns the date associated to time instant.
TimeDuration getTime() const
It returns the time duration associated to time instant.
AbstractData * clone() const
It returns a clone of this object.
bool operator==(const DateTime &rhs) const
Operator ==.
bool operator>(const DateTime &rhs) const
Operator >
long operator-(const TimeInstantTZ &rhs) const
Operator -.
std::string toString() const
It returns the time instant with time zone in the ISO textual format (YYYYMMDDThhmmss?...
DateTimeType getDateTimeType() const
It returns the subtype of the date and time type.
boost::local_time::local_date_time & getTimeInstantTZ()
It returns the boost time instant with time zone type.
virtual ~TimeInstantTZ()
Constructor.
boost::local_time::local_date_time m_timeInstantTZ
Time instant with time zone information.
const boost::local_time::local_date_time & getTimeInstantTZ() const
It returns the boost time instant with time zone type.
TimeInstantTZ(const boost::local_time::local_date_time &t)
Constructor.
bool operator!=(const DateTime &rhs) const
Operator !=.
DateTimeType
The subtype of date and time type, based on ISO 8621.
Definition Enums.h:46
@ TIME_INSTANT_TZ
Definition Enums.h:53
TerraLib.
#define TEDATATYPEEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition Config.h:61