rasdaman complete source
miter.hh
Go to the documentation of this file.
1 /*
2 * This file is part of rasdaman community.
3 *
4 * Rasdaman community is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * Rasdaman community is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with rasdaman community. If not, see <http://www.gnu.org/licenses/>.
16 *
17 * Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
18 rasdaman GmbH.
19 *
20 * For more information please see <http://www.rasdaman.org>
21 * or contact Peter Baumann via <baumann@rasdaman.com>.
22 /
31 #ifndef _D_MITER_
32 #define _D_MITER_
33 
34 class r_Minterval;
35 
36 //@ManMemo: Module: {\bf raslib}
37 
38 /*@Doc:
39  r_Miter is used for iterating through parts of
40  multidimensional intervals. It is given the domain of
41  the object to be iterated through, the size of the base
42  base type, the address of the first cell in the Tile and
43  an Minterval specifying the area to be iterated through.
44 
45  Going to the next cell is done with nextCell() which
46  returns the adress of the next cell. Test for the end
47  is done with isDone(). The iterator can be reset with
48  reset().
49 */
50 
51 class r_Miter
52 {
53 public:
55  inline r_Miter( const r_Minterval* newAreaIter,
56  const r_Minterval* newAreaTile, r_Bytes newCellSize,
57  const char* newFirstCell );
63  inline ~r_Miter();
66  inline void reset();
68  inline char* nextCell();
70  inline bool isDone();
71 protected:
72  // structure storing information on iteration for each dimension
73  // (perhaps add dimension for reordering later)
74  typedef struct
75  {
76  int repeat; // total number of repeats
77  int inc; // increment per repeat
78  int curr; // current repeat
79  } incArrElem;
81  const r_Minterval* areaIter;
83  const r_Minterval* areaTile;
85  r_Bytes cellSize;
87  const char* firstCell;
89  incArrElem* incArrIter;
91  bool done;
93  char* currCell;
95  int lowCount;
96 };
97 
98 #include "miter.icc"
99 
100 #endif