All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OrdinalInstant.h
Go to the documentation of this file.
1 /* Copyright (C) 2008-2013 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/OrdinalInstant.h
22 
23  \brief A class to represent ordinal time instant.
24 */
25 
26 #ifndef __TERRALIB_DATATYPE_INTERNAL_ORDINALINSTANT_H
27 #define __TERRALIB_DATATYPE_INTERNAL_ORDINALINSTANT_H
28 
29 // TerraLib
30 #include "DateTimeInstant.h"
31 #include "SimpleData.h"
32 
33 namespace te
34 {
35  namespace dt
36  {
37  /*!
38  \class OrdinalInstant
39 
40  \brief A class to represent ordinal time instant.
41 
42  An ordinal number to represent a time instant. Examples:
43  the first/second/etc epidemiological week, the first/second/etc
44  day of the week, etc.
45 
46  \sa DateTimeInstant
47  */
49  {
50  public:
51 
52  /*! \brief Empty constructor. */
54 
55  /*!
56  \brief Constructor.
57 
58  \param t The time instant represented by an integer type.
59  */
61 
62  /*!
63  \brief It returns the time instant.
64 
65  \return The time instant.
66  */
67  Int64 getTimeInstant() const { return m_timeInstant; }
68 
69  /*!
70  \brief It sets the time instant.
71 
72  \param t The time instant.
73  */
74  void setTimeInstant(Int64 t) { m_timeInstant = t; }
75 
76  /*!
77  \brief Operator ==
78 
79  \param rhs The time instant to be compared.
80 
81  \return It returns true if the two time instants are equal. Otherwise, it returns false.
82  */
83  bool operator==(const DateTime& rhs) const;
84 
85  /*!
86  \brief Operator !=
87 
88  \param rhs The time instant to be compared.
89 
90  \return It returns true if the two time instants are not equal. Otherwise, it returns false.
91  */
92  bool operator!=(const DateTime& rhs) const;
93 
94  /*!
95  \brief Operator <
96 
97  \param rhs The right-hand-side time instant to be compared.
98 
99  \return It returns true if the right-hand-side time instant is greater than the lefth side one. Otherwise, it returns false.
100  */
101  bool operator<(const DateTime& rhs) const;
102 
103  /*!
104  \brief Operator >
105 
106  \param rhs The right-hand-side time instant to be compared.
107 
108  \return It returns true if the right-hand-side time instant is less than the lefth side one. Otherwise, it returns false.
109  */
110  bool operator>(const DateTime& rhs) const;
111 
112  /*!
113  \brief It returns a clone of this object.
114 
115  \return A clone of this object.
116  */
117  AbstractData* clone() const;
118 
119  /*!
120  \brief It returns the time instant in a textual format.
121 
122  \return The time instant in a textual format.
123  */
124  std::string toString() const;
125 
126  /*!
127  \brief It returns the subtype of the date and time type.
128 
129  \return The subtype of the date and time type.
130  */
132 
133  protected:
134 
135  Int64 m_timeInstant; //!< The internal time instant information.
136  };
137 
138  } // end namespace dt
139 } // end namespace te
140 
141 #endif // __TERRALIB_DATATYPE_INTERNAL_ORDINALINSTANT_H
142 
An abstract class to represent an instant of date and time.
te::da::Expression * operator<(const te::da::Expression &e1, const te::da::Expression &e2)
Definition: Expression.cpp:73
This file contains several implementations for atomic data types (integers, floats, strings and others).
Int64 m_timeInstant
The internal time instant information.
#define TEDATATYPEEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:99
DateTimeType getDateTimeType() const
It returns the subtype of the date and time type.
te::da::Expression * operator==(const te::da::Expression &e1, const te::da::Expression &e2)
Definition: Expression.cpp:38
void setTimeInstant(Int64 t)
It sets the time instant.
te::da::Expression * operator!=(const te::da::Expression &e1, const te::da::Expression &e2)
Definition: Expression.cpp:43
A class to represent ordinal time instant.
Int64 getTimeInstant() const
It returns the time instant.
DateTimeType
The subtype of date and time type.
Definition: Enums.h:38
A base class for values that can be retrieved from the data access module.
Definition: AbstractData.h:57
An abstract class to represent an instant of date and time.
te::da::Expression * operator>(const te::da::Expression &e1, const te::da::Expression &e2)
Definition: Expression.cpp:63