Loading...
Searching...
No Matches
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
35namespace te
36{
37 namespace dt
38 {
39// Forward declaration
40 class Date;
41 class DateTime;
42 class DateTimeInstant;
43 class DateTimePeriod;
44 class TimeInstant;
45
46 /*!
47 \brief It returns the temporal extent of two date and time types.
48
49 It returns a time period composed of the lowest and the biggest
50 datetime of two given date time types.
51
52 \param t1 The first datetime.
53 \param t2 The second datetime.
54
55 \return A datetime period that represents the temporal extent of the two given types.
56
57 \note The caller will take the ownership of the output pointer.
58 \note The two given types must be of the same type.
59 */
61
62 /*!
63 \brief It returns the distance between two datetime types.
64
65 For Date and DatePeriod, the returned distance value is in days,
66 for TimeInstant, TimePeriod, TimeInstantTZ, TimePeriodTZ, it is in seconds, and
67 for OrdinalIntant and OrdinalPeriod, it is in the same unit of the type.
68
69 \param t1 The first datetime.
70 \param t2 The second datetime.
71
72 \return The distance between the two given datetimes.
73
74 \note The two given types must be of the same type.
75 */
77
78 /*!
79 \brief It creates a time period based on two time instants.
80
81 \param t1 The first instant.
82 \param t2 The second instant.
83
84 \return A datetime period that represents composed of the two given instants.
85
86 \note The caller will take the ownership of the output pointer.
87 \note The two given types must be of the same type.
88 */
90
91 /*!
92 \brief Helper function to create a date from its string representation
93
94 \param dateAsString A date string representation
95
96 \return A new date created from the given string reprentation.
97 */
98 TEDATATYPEEXPORT te::dt::Date* CreateDateFromString(const std::string& dateAsString);
99
100 /*!
101 \brief Helper function to create a date time from its string representation
102
103 \param dateTimeAsString A date time string representation
104
105 \return A new date created from the given string reprentation.
106 */
107 TEDATATYPEEXPORT te::dt::TimeInstant* CreateDateTimeFromString(const std::string& dataTimeAsString);
108
109 } // end namespace dt
110} // end namespace te
111
112#endif // __TERRALIB_DATATYPE_INTERNAL_DATETIMEUTILS_H
113
An abstract class to represent an instant of date and time.
An abstract class to represent a period of date and time.
A base class for date data types.
Definition: Date.h:66
A class to represent time instant.
Definition: TimeInstant.h:56
TEDATATYPEEXPORT te::dt::Date * CreateDateFromString(const std::string &dateAsString)
Helper function to create a date from its string representation.
TEDATATYPEEXPORT DateTimePeriod * GetTimePeriod(const DateTimeInstant *t1, const DateTimeInstant *t2)
It creates a time period based on two time instants.
TEDATATYPEEXPORT long GetDistance(const te::dt::DateTime *t1, const te::dt::DateTime *t2)
It returns the distance between two datetime types.
TEDATATYPEEXPORT te::dt::TimeInstant * CreateDateTimeFromString(const std::string &dataTimeAsString)
Helper function to create a date time from its string representation.
TEDATATYPEEXPORT DateTimePeriod * GetTemporalExtent(const DateTime *t1, const DateTime *t2)
It returns the temporal extent of two date and time types.
TerraLib.
#define TEDATATYPEEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:61
Proxy configuration file for TerraView (see terraview_config.h).