All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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  : m_timeInstantTZ(t)
63  {
64  }
65 
66  /*!
67  \brief It returns the boost time instant with time zone type.
68 
69  \return The boost time instant with time zone type.
70  */
71  const boost::local_time::local_date_time& getTimeInstantTZ() const { return m_timeInstantTZ; }
72 
73  /*!
74  \brief It returns the boost time instant with time zone type.
75 
76  \return The boost time instant with time zone type.
77  */
78  boost::local_time::local_date_time& getTimeInstantTZ() { return m_timeInstantTZ; }
79 
80  /*!
81  \brief Operator ==
82 
83  \param rhs The time instant to be compared.
84 
85  \return It returns true if the two time instants are equal. Otherwise, it returns false.
86  */
87  bool operator==(const DateTime& rhs) const;
88 
89  /*!
90  \brief Operator !=
91 
92  \param rhs The time instant to be compared.
93 
94  \return It returns true if the two time instants are not equal. Otherwise, it returns false.
95  */
96  bool operator!=(const DateTime& rhs) const;
97 
98  /*!
99  \brief Operator <
100 
101  \param rhs The right-hand-side time instant to be compared.
102 
103  \return It returns true if the right-hand-side time instant is greater than the lefth side one. Otherwise, it returns false.
104  */
105  bool operator<(const DateTime& rhs) const;
106 
107  /*!
108  \brief Operator >
109 
110  \param rhs The right-hand-side time instant to be compared.
111 
112  \return It returns true if the right-hand-side time instant is less than the lefth side one. Otherwise, it returns false.
113  */
114  bool operator>(const DateTime& rhs) const;
115 
116  /*!
117  \brief Operator -
118 
119  \param rhs The right-hand-side time instant.
120 
121  \return It returns the number of seconds between the two time instants.
122  */
123  long operator-(const TimeInstantTZ& rhs) const;
124 
125  /*!
126  \brief It returns a clone of this object.
127 
128  \return A clone of this object.
129  */
130  AbstractData* clone() const;
131 
132  /*!
133  \brief It returns the time instant with time zone in the ISO textual format (YYYYMMDDThhmmss±hhmm).
134 
135  \return The time instant with time zone in the ISO textual format (YYYYMMDDThhmmss±hhmm).
136  */
137  std::string toString() const;
138 
139  /*!
140  \brief It returns the subtype of the date and time type.
141 
142  \return The subtype of the date and time type.
143  */
145 
146  /*! \brief Constructor. */
147  virtual ~TimeInstantTZ();
148 
149  protected:
150 
151  boost::local_time::local_date_time m_timeInstantTZ; //!< Time instant with time zone information.
152  };
153 
154  } // end namespace dt
155 } // end namespace te
156 
157 #endif // __TERRALIB_DATATYPE_INTERNAL_TIMEINSTANTTZ_H
158 
te::da::Expression * operator==(const te::da::Expression &e1, const te::da::Expression &e2)
Definition: Expression.cpp:38
te::da::Expression * operator>(const te::da::Expression &e1, const te::da::Expression &e2)
Definition: Expression.cpp:63
#define TEDATATYPEEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:64
te::da::Expression * operator<(const te::da::Expression &e1, const te::da::Expression &e2)
Definition: Expression.cpp:73
te::da::Expression * operator!=(const te::da::Expression &e1, const te::da::Expression &e2)
Definition: Expression.cpp:43
const boost::local_time::local_date_time & getTimeInstantTZ() const
It returns the boost time instant with time zone type.
Definition: TimeInstantTZ.h:71
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:78
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.
TimeInstantTZ(const boost::local_time::local_date_time &t)
Constructor.
Definition: TimeInstantTZ.h:61