CoverageSeriesIterator.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 CoverageSeriesIterator.h
22 
23  \brief This file contains an iterator that is able to traverse all observations
24  of a coverage series.
25 */
26 
27 #ifndef __TERRALIB_ST_INTERNAL_COVERAGESERIESITERATOR_H
28 #define __TERRALIB_ST_INTERNAL_COVERAGESERIESITERATOR_H
29 
30 // ST
31 #include "../../Config.h"
33 
34 // STL
35 #include <map>
36 
37 // Boost
38 #include <boost/shared_ptr.hpp>
39 
40 // Forward declarations
41 namespace te { namespace dt { class DateTime; } }
42 
43 namespace te
44 {
45  namespace st
46  {
47  //Forward declaration
48  class Coverage;
49 
50  /*!
51  \class CoverageSeriesIterator
52 
53  \brief A class to traverse the observations of a CoverageSeries.
54 
55  This class provides a mechanism to traverse the observations of
56  a CoverageSeries (time and coverage) ordered by time.
57 
58  An example of use:
59 
60  CoverageSeriesIterator it = cvs.begin();
61  while(it!=cvs.end())
62  {
63  DateTime* t = it.getTime();
64  Coverage* c = it.getCoverage();
65  ++it;
66  }
67 
68  \sa CoverageSeries
69  */
71  {
72  public:
73 
74  /*! \brief Empty constructor. */
76 
77  /*!
78  \brief Constructor.
79 
80  \param it A iterator that points to the point coverage observations
81  */
82  CoverageSeriesIterator(const CoverageSeriesObservationSet::const_iterator& it);
83 
84  /*! \brief Assignment operator. */
85  const CoverageSeriesIterator& operator=(const CoverageSeriesIterator& rhs);
86 
87  /*! \brief Operator == */
88  bool operator==(const CoverageSeriesIterator& rhs);
89 
90  /*! \brief Operator != */
91  bool operator!=(const CoverageSeriesIterator& rhs);
92 
93  /*!
94  \brief Prefix operator ++
95 
96  After using this operator, the internal cursor points
97  to the next coverage series observation.
98 
99  The semantics of prefix is this: Increment the value and then fetch it.
100  */
101  CoverageSeriesIterator& operator++();
102 
103  /*!
104  \brief Postfix operator ++
105 
106  After using this operator, the internal cursor points
107  to the next coverage series observation.
108 
109  The semantics of postfix is: Fetch the value and then increment the original.
110  */
111  CoverageSeriesIterator operator++(int aux);
112 
113  /*!
114  \brief Prefix operator --
115 
116  After using this operator, the internal cursor points
117  to the preceding coverage series observation.
118 
119  The semantics of prefix is this: Increment the value and then fetch it.
120  */
121  CoverageSeriesIterator& operator--();
122 
123  /*!
124  \brief Postfix operator --
125 
126  After using this operator, the internal cursor points
127  to the preceding coverage series observation.
128 
129  The semantics of postfix is: Fetch the value and then increment the original.
130  */
131  CoverageSeriesIterator operator--(int aux);
132 
133  /*!
134  \brief Prefix operator *
135 
136  It returns the observation (a pair of shared pointers to DateTime and Coverage)
137  pointed by the internal cursor.
138  */
139  CoverageSeriesObservation operator*() const;
140 
141  /*!
142  \brief It returns the time pointed by the internal cursor.
143 
144  \return A pointer to the time pointed by the internal cursor.
145 
146  \note The caller will NOT take the ownership of the returned pointer.
147  */
148  te::dt::DateTime* getTime() const;
149 
150  /*!
151  \brief It returns the coverage pointed by the internal cursor.
152 
153  \return A pointer to the coverage pointed by the internal cursor.
154 
155  \note The caller will NOT take the ownership of the returned pointer.
156  */
157  te::st::Coverage* getCoverage() const;
158 
159  /*! \brief Virtual destructor. */
160  virtual ~CoverageSeriesIterator();
161 
162  private:
163 
164  CoverageSeriesObservationSet::const_iterator m_it; //!< The internal cursor
165  };
166  } // end namespace st
167 } // end namespace te
168 
169 #endif // __TERRALIB_ST_INTERNAL_COVERAGESERIESITERATOR_H
170 
171 
#define TESTEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:88
This file contains a class to represent a CoverageSeries observation.
std::pair< te::dt::DateTimeShrPtr, CoverageShrPtr > CoverageSeriesObservation
TEDATAACCESSEXPORT te::da::Expression * operator==(const te::da::Expression &e1, const te::da::Expression &e2)
TEDATAACCESSEXPORT te::da::Expression * operator!=(const te::da::Expression &e1, const te::da::Expression &e2)
A class to traverse the observations of a CoverageSeries.
URI C++ Library.
CoverageSeriesObservationSet::const_iterator m_it
The internal cursor.
An abstract class to represent a coverage.
Definition: Coverage.h:63