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 
35 namespace te
36 {
37  namespace dt
38  {
39  /*!
40  \class TimeInstantTZ
41 
42  \brief A class to represent time instant with time zone.
43 
44  A time instant is a point on the continuous time axis. A time instant
45  with time zone is composed of a date that uses the Gregorian calendar and
46  of a time with an associated time zone. Internally, it uses the datetime boost
47  library to represent time instant with time zone, by using the data type
48  boost::local_time::local_date_time.
49 
50  \sa DateTime, Date, DatePeriod, DateDuration, TimeInstant, TimePeriod, TimeDuration, TimePeriodTZ
51  */
53  {
54  public:
55 
56  /*!
57  \brief Constructor.
58 
59  \param t A time instant with time zone.
60  */
61  TimeInstantTZ(const boost::local_time::local_date_time& t);
62 
63  /*!
64  \brief It returns the boost time instant with time zone type.
65 
66  \return The boost time instant with time zone type.
67  */
68  const boost::local_time::local_date_time& getTimeInstantTZ() const { return m_timeInstantTZ; }
69 
70  /*!
71  \brief It returns the boost time instant with time zone type.
72 
73  \return The boost time instant with time zone type.
74  */
75  boost::local_time::local_date_time& getTimeInstantTZ() { return m_timeInstantTZ; }
76 
77  /*!
78  \brief Operator ==
79 
80  \param rhs The time instant to be compared.
81 
82  \return It returns true if the two time instants are equal. Otherwise, it returns false.
83  */
84  bool operator==(const DateTime& rhs) const;
85 
86  /*!
87  \brief Operator !=
88 
89  \param rhs The time instant to be compared.
90 
91  \return It returns true if the two time instants are not equal. Otherwise, it returns false.
92  */
93  bool operator!=(const DateTime& rhs) const;
94 
95  /*!
96  \brief Operator <
97 
98  \param rhs The right-hand-side time instant to be compared.
99 
100  \return It returns true if the right-hand-side time instant is greater than the lefth side one. Otherwise, it returns false.
101  */
102  bool operator<(const DateTime& rhs) const;
103 
104  /*!
105  \brief Operator >
106 
107  \param rhs The right-hand-side time instant to be compared.
108 
109  \return It returns true if the right-hand-side time instant is less than the lefth side one. 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.
117 
118  \return It returns the number of seconds between the two time instants.
119  */
120  long operator-(const TimeInstantTZ& rhs) const;
121 
122  /*!
123  \brief It returns a clone of this object.
124 
125  \return A clone of this object.
126  */
127  AbstractData* clone() const;
128 
129  /*!
130  \brief It returns the time instant with time zone in the ISO textual format (YYYYMMDDThhmmss?hhmm).
131 
132  \return The time instant with time zone in the ISO textual format (YYYYMMDDThhmmss?hhmm).
133  */
134  std::string toString() const;
135 
136  /*!
137  \brief It returns the subtype of the date and time type.
138 
139  \return The subtype of the date and time type.
140  */
142 
143  /*! \brief Constructor. */
144  virtual ~TimeInstantTZ();
145 
146  protected:
147 
148  boost::local_time::local_date_time m_timeInstantTZ; //!< Time instant with time zone information.
149  };
150 
151  } // end namespace dt
152 } // end namespace te
153 
154 #endif // __TERRALIB_DATATYPE_INTERNAL_TIMEINSTANTTZ_H
155 
TEDATAACCESSEXPORT te::da::Expression * operator<(const te::da::Expression &e1, const te::da::Expression &e2)
TEDATAACCESSEXPORT te::da::Expression * operator==(const te::da::Expression &e1, const te::da::Expression &e2)
TEDATAACCESSEXPORT te::da::Expression * operator!=(const te::da::Expression &e1, const te::da::Expression &e2)
#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.
TEDATAACCESSEXPORT te::da::Expression * operator>(const te::da::Expression &e1, const te::da::Expression &e2)
const boost::local_time::local_date_time & getTimeInstantTZ() const
It returns the boost time instant with time zone type.
Definition: TimeInstantTZ.h:68
A base class for values that can be retrieved from the data access module.
Definition: AbstractData.h:57
boost::local_time::local_date_time m_timeInstantTZ
Time instant with time zone information.
boost::local_time::local_date_time & getTimeInstantTZ()
It returns the boost time instant with time zone type.
Definition: TimeInstantTZ.h:75
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:45
A class to represent time instant with time zone.
Definition: TimeInstantTZ.h:52
An abstract class to represent an instant of date and time.
An abstract class to represent an instant of date and time.