OrdinalInstant.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/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, etc.
45 
46  To understand the meaning of the ordinal numbers, a user has to use
47  extra information, such as the temporal resolution and the starting time
48  in the DateTimeProperty.
49 
50  \sa DateTimeInstant
51  */
53  {
54  public:
55 
56  /*! \brief Empty constructor. */
58 
59  /*!
60  \brief Constructor.
61 
62  \param t The time instant represented by an integer type.
63  */
65 
66  /*!
67  \brief It returns the time instant.
68 
69  \return The time instant.
70  */
71  Int64 getTimeInstant() const { return m_timeInstant; }
72 
73  /*!
74  \brief It sets the time instant.
75 
76  \param t The time instant.
77  */
78  void setTimeInstant(Int64 t) { m_timeInstant = t; }
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 It returns a clone of this object.
118 
119  \return A clone of this object.
120  */
121  AbstractData* clone() const;
122 
123  /*!
124  \brief It returns the time instant in a textual format.
125 
126  \return The time instant in a textual format.
127  */
128  std::string toString() const;
129 
130  /*!
131  \brief It returns the subtype of the date and time type.
132 
133  \return The subtype of the date and time type.
134  */
136 
137  protected:
138 
139  Int64 m_timeInstant; //!< The internal time instant information.
140  };
141 
142  } // end namespace dt
143 } // end namespace te
144 
145 #endif // __TERRALIB_DATATYPE_INTERNAL_ORDINALINSTANT_H
146 
An abstract class to represent an instant of date and time.
This file contains several implementations for atomic data types (integers, floats,...
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.
A class to represent ordinal time instant.
DateTimeType getDateTimeType() const
It returns the subtype of the date and time type.
Int64 m_timeInstant
The internal time instant information.
OrdinalInstant(Int64 t)
Constructor.
void setTimeInstant(Int64 t)
It sets the time instant.
Int64 getTimeInstant() const
It returns the time instant.
bool operator<(const DateTime &rhs) const
Operator <.
OrdinalInstant()
Empty constructor.
AbstractData * clone() const
It returns a clone of this object.
std::string toString() const
It returns the time instant in a textual format.
bool operator!=(const DateTime &rhs) const
Operator !=.
bool operator>(const DateTime &rhs) const
Operator >
bool operator==(const DateTime &rhs) const
Operator ==.
DateTimeType
The subtype of date and time type, based on ISO 8621.
Definition: Enums.h:46
@ ORDINAL_TIME_INSTANT
Definition: Enums.h:55
TerraLib.
#define TEDATATYPEEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:61