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 te::st::TimeSeriesIterator::TimeSeriesIterator(TimeSeriesObservationSet::const_iterator& it) :
36  m_it(it)
37 {
38 }
39 
42 {
43  if(this == &rhs)
44  return *this;
45 
46  m_it = rhs.m_it;
47  return *this;
48 }
49 
51 {
52  return m_it == rhs.m_it;
53 }
54 
56 {
57  return m_it != rhs.m_it;
58 }
59 
61 {
62  ++m_it;
63  return *this;
64 }
65 
67 {
68  te::st::TimeSeriesIterator result = *this;
69  ++m_it;
70  return result;
71 }
72 
74 {
75  --m_it;
76  return *this;
77 }
78 
80 {
81  te::st::TimeSeriesIterator result = *this;
82  --m_it;
83  return result;
84 }
85 
87 {
88  return *m_it;
89 }
90 
92 {
93  return m_it->getTime();
94 }
95 
97 {
98  return m_it->getValue();
99 }
100 
102 {
103  return m_it->getDouble();
104 }
105 
107 {
108  return m_it->getInt();
109 }
110 
112 {
113  return m_it->getString();
114 }
115 
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.