OpenStructure
extent_iterator.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // This file is part of the OpenStructure project <www.openstructure.org>
3 //
4 // Copyright (C) 2008-2020 by the OpenStructure authors
5 // Copyright (C) 2003-2010 by the IPLT authors
6 //
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License as published by the Free
9 // Software Foundation; either version 3.0 of the License, or (at your option)
10 // any later version.
11 // This library is distributed in the hope that it will be useful, but WITHOUT
12 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
14 // details.
15 //
16 // You should have received a copy of the GNU Lesser General Public License
17 // along with this library; if not, write to the Free Software Foundation, Inc.,
18 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 //------------------------------------------------------------------------------
20 
21 /*
22  iterate over a volume defined by an extent
23 
24  Author: Ansgar Philippsen
25 */
26 
27 #ifndef IMG_EXTENT_ITERATOR_H
28 #define IMG_EXTENT_ITERATOR_H
29 
30 #include "point.hh"
31 #include "data.hh"
32 
33 namespace ost { namespace img {
34 
35 class Extent;
36 
38 
53  public:
55  explicit ExtentIterator(const Extent& b, unsigned int domain=SPATIAL);
56 
59 
62 
65 
68 
71 
74 
76  void Inc();
77 
79  void Dec();
80 
83 
86 
88  Extent GetExtent() const;
89 
91  const Point &GetStart() const;
92 
94  const Point &GetEnd() const;
95 
97  bool AtEnd() const;
98 
100  bool AtStart() const;
101 
103  int operator[](int i) const;
104 
105  operator Point() const;
106 
107  private:
108  Point start_, end_, current_,startpos_;
109 };
110 
111 }} // namespace img
112 
113 #endif
Defines lower and upper valid indices.
Definition: extent.hh:60
ExtentIterator & ToEnd()
Reset to end.
ExtentIterator operator++(int)
Postfix increase operator.
void Inc()
Skip ahead to next point.
ExtentIterator & operator=(const ExtentIterator &p)
assignement op
Extent GetExtent() const
Retrieve original extent.
const Point & GetEnd() const
Retrieve end point.
ExtentIterator operator--(int)
Postfix decrease operator.
ExtentIterator(const Extent &b, unsigned int domain=SPATIAL)
Initialize with Extent.
bool AtEnd() const
Returns true if iterator has reached end.
const Point & GetStart() const
Retrieve start point.
ExtentIterator(const ExtentIterator &i)
copy ctor
ExtentIterator & operator--()
Prefix decrease operator.
ExtentIterator & ToStart()
Reset to start.
int operator[](int i) const
element access
void Dec()
Go back to previous point.
ExtentIterator & operator++()
Prefix increase operator.
bool AtStart() const
Returns true if iterator is at the start.
class encapsulating 1D to 3D point
Definition: point.hh:47
#define DLLEXPORT_OST_IMG_BASE
Definition: base.dox:1