All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TimeSeriesIterator.cpp
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 TimeSeriesIterator.cpp
22 
23  \brief This file contains a time series iterator.
24 */
25 
26 // TerraLib
27 #include "../../../datatype/DateTime.h"
28 #include "../../../datatype/AbstractData.h"
29 
30 //ST
31 #include "TimeSeriesIterator.h"
32 
34 {
35 }
36 
37 te::st::TimeSeriesIterator::TimeSeriesIterator(TimeSeriesObservationSet::const_iterator& it) :
38  m_it(it)
39 {
40 }
41 
44 {
45  if(this == &rhs)
46  return *this;
47 
48  m_it = rhs.m_it;
49  return *this;
50 }
51 
53 {
54  return m_it == rhs.m_it;
55 }
56 
58 {
59  return m_it != rhs.m_it;
60 }
61 
63 {
64  ++m_it;
65  return *this;
66 }
67 
69 {
70  te::st::TimeSeriesIterator result = *this;
71  ++m_it;
72  return result;
73 }
74 
76 {
77  --m_it;
78  return *this;
79 }
80 
82 {
83  te::st::TimeSeriesIterator result = *this;
84  --m_it;
85  return result;
86 }
87 
89 {
90  return *m_it;
91 }
92 
94 {
95  return m_it->getTime();
96 }
97 
99 {
100  return m_it->getValue();
101 }
102 
104 {
105  return m_it->getDouble();
106 }
107 
109 {
110  return m_it->getInt();
111 }
112 
114 {
115  return m_it->getString();
116 }
117 
119 {
120 }
121 
122 
123 
124 
125 
126 
127 
128 
129 
double getDouble() const
It returns the attribute value as a double pointed by the internal cursor.
bool operator==(const TimeSeriesIterator &rhs)
Operator ==.
TimeSeriesIterator()
Empty constructor.
std::string getString() const
It returns the attribute value as a string pointed by the internal cursor.
A class to traverse the observations of a TimeSeries.
virtual ~TimeSeriesIterator()
Virtual destructor.
TimeSeriesObservationSet::const_iterator m_it
The internal cursor.
te::dt::DateTime * getTime() const
It returns the datetime pointed by the internal cursor.
const TimeSeriesIterator & operator=(const TimeSeriesIterator &rhs)
Assignment operator.
A class to represent an observation (time and value) of a time series.
int getInt() const
It returns the attribute value as an integer pointed by the internal cursor.
TimeSeriesIterator & operator++()
Prefix operator ++.
A base class for values that can be retrieved from the data access module.
Definition: AbstractData.h:57
TimeSeriesIterator & operator--()
Prefix operator –.
TimeSeriesObservation operator*() const
Prefix operator *.
bool operator!=(const TimeSeriesIterator &rhs)
Operator !=.
te::dt::AbstractData * getValue() const
It returns the attribute value pointed by the internal cursor.
This file contains a time series iterator.