rasdaman complete source
mitera.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_MITERA_
32 #define _D_MITERA_
33 
34 #include "raslib/minterval.hh"
35 
36 //@ManMemo: Module: {\bf raslib}
37 
38 /*@Doc:
39  r_MiterArea is used for iterating r_Mintervals through larger
40  r_Mintervals. It is given the domain to be iterated through and
41  an Minterval specifying the shape of area to be iterated with.
42 
43 
44  Going to the next area is done with nextArea() which returns an
45  r_Minterval. Test for the end is done with isDone(). The
46  iterator can be reset with reset(). Iteration starts at the
47  lowest border in all dimensions. Note that if the shape of
48  r_Minterval iterated does not completely fit into the
49  r_Minterval iterated through the results at the border may have
50  a different (smaller) shape.
51 */
52 
53 class r_MiterArea
54 {
55 public:
58  r_MiterArea( const r_Minterval* newIterDom,
59  const r_Minterval* newImgDom ) throw(r_Error);
65  ~r_MiterArea();
68  void reset();
70  r_Minterval nextArea();
72  bool isDone();
73 protected:
74  // structure storing information on iteration for each dimension
75  // (perhaps add dimension for reordering later)
76  typedef struct
77  {
78  int repeat; // total number of repeats
79  int curr; // current repeat
80  } incArrElem;
82  const r_Minterval* iterDom;
84  const r_Minterval* imgDom;
86  incArrElem* incArrIter;
88  bool done;
90  r_Minterval retVal;
91 };
92 
93 #endif