DateTimeUtils.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/DateTimeUtils.h
22 
23  \brief Utilitary function for the date and time types of the data type module.
24 */
25 
26 #ifndef __TERRALIB_DATATYPE_INTERNAL_DATETIMEUTILS_H
27 #define __TERRALIB_DATATYPE_INTERNAL_DATETIMEUTILS_H
28 
29 // TerraLib
30 #include "Config.h"
31 
32 // STL
33 #include <vector>
34 
35 namespace te
36 {
37  namespace dt
38  {
39 // Forward declaration
40  class DateTime;
41  class DateTimeInstant;
42  class DateTimePeriod;
43 
44  /*!
45  \brief It returns the temporal extent of two date and time types.
46 
47  It returns a time period composed of the lowest and the biggest
48  datetime of two given date time types.
49 
50  \param t1 The first datetime.
51  \param t2 The second datetime.
52 
53  \return A datetime period that represents the temporal extent of the two given types.
54 
55  \note The caller will take the ownership of the output pointer.
56  \note The two given types must be of the same type.
57  */
58  TEDATATYPEEXPORT DateTimePeriod* GetTemporalExtent(const DateTime* t1, const DateTime* t2);
59 
60  /*!
61  \brief It returns the distance between two datetime types.
62 
63  For Date and DatePeriod, the returned distance value is in days,
64  for TimeInstant, TimePeriod, TimeInstantTZ, TimePeriodTZ, it is in seconds, and
65  for OrdinalIntant and OrdinalPeriod, it is in the same unit of the type.
66 
67  \param t1 The first datetime.
68  \param t2 The second datetime.
69 
70  \return The distance between the two given datetimes.
71 
72  \note The two given types must be of the same type.
73  */
75 
76  /*!
77  \brief It creates a time period based on two time instants.
78 
79  \param t1 The first instant.
80  \param t2 The second instant.
81 
82  \return A datetime period that represents composed of the two given instants.
83 
84  \note The caller will take the ownership of the output pointer.
85  \note The two given types must be of the same type.
86  */
87  TEDATATYPEEXPORT DateTimePeriod* GetTimePeriod(const DateTimeInstant* t1, const DateTimeInstant* t2);
88 
89  } // end namespace dt
90 } // end namespace te
91 
92 #endif // __TERRALIB_DATATYPE_INTERNAL_DATETIMEUTILS_H
93 
TEDATATYPEEXPORT long GetDistance(const te::dt::DateTime *t1, const te::dt::DateTime *t2)
It returns the distance between two datetime types.
#define TEDATATYPEEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:61
TEDATATYPEEXPORT DateTimePeriod * GetTimePeriod(const DateTimeInstant *t1, const DateTimeInstant *t2)
It creates a time period based on two time instants.
Configuration flags for the DataType module of TerraLib.
URI C++ Library.
TEDATATYPEEXPORT DateTimePeriod * GetTemporalExtent(const DateTime *t1, const DateTime *t2)
It returns the temporal extent of two date and time types.