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;
87  const char* firstCell;
91  bool done;
93  char* currCell;
95  int lowCount;
96 };
97 
98 #include "miter.icc"
99 
100 #endif
const char * firstCell
offset of first cell in tile.
Definition: miter.hh:87
incArrElem * incArrIter
array with increments
Definition: miter.hh:89
bool done
flag set if iteration is finished.
Definition: miter.hh:91
~r_Miter()
destructor.
void reset()
resets iterator to first cell.
Definition: miter.hh:74
const r_Minterval * areaTile
area of tile.
Definition: miter.hh:83
const r_Minterval * areaIter
area to be iterated through
Definition: miter.hh:81
char * nextCell()
returns current cell and sets iterator to next cell.
unsigned int r_Bytes
Definition: mddtypes.hh:56
r_Miter(const r_Minterval *newAreaIter, const r_Minterval *newAreaTile, r_Bytes newCellSize, const char *newFirstCell)
constructor.
char * currCell
current cell for iteration;
Definition: miter.hh:93
int curr
Definition: miter.hh:78
int lowCount
counter for position in lowest dimension.
Definition: miter.hh:95
int inc
Definition: miter.hh:77
int repeat
Definition: miter.hh:76
r_Bytes cellSize
size of base type.
Definition: miter.hh:85
Definition: miter.hh:51
Definition: minterval.hh:249
bool isDone()
returns TRUE if iteration is finished.