rasdaman complete source
miterf.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_MITERF_
32 #define _D_MITERF_
33 
34 class r_Minterval;
35 
36 
37 #include "raslib/mddtypes.hh"
38 
39 class r_FixedPointNumber
40 {
41 public:
42  inline r_FixedPointNumber();
43  inline r_FixedPointNumber(const double&);
44 
45  inline r_FixedPointNumber& operator=(const r_FixedPointNumber&);
46  inline r_FixedPointNumber& operator=(const double&);
47 
48  // returns intPart_new - intPart_old -- used for tests
49  inline r_Range stepForward(const r_FixedPointNumber&);
50 
51  // returns carry of fracPart
52  inline bool stepForwardFlag(const r_FixedPointNumber&);
53 
54  inline r_Range getIntPart();
55 
56 private:
57  inline void init(const double&);
58 
59  r_Range intPart;
60  r_Range fracPart;
61 
62  static const int FIXPREC;
63  static const r_Range carryPos;
64  static const r_Range fracMask;
65  static const double fixOne;
66 
67  friend std::ostream& operator<<(std::ostream&,r_FixedPointNumber&);
68 };
69 
70 
71 
72 //@ManMemo: Module: {\bf raslib}
73 
74 /*@Doc:
75  r_MiterFloat is used for iterating through parts of
76  multidimensional intervals with arbitrary stepping size using
77  nearest neighbours. It is given the tile, the source domain
78  and the destination domain
79  Apart from that behaviour is exactly as in r_Miter.
80 
81 */
82 
84 {
85 public:
87  inline r_MiterFloat(Tile *sourceTile, r_Minterval& sourceDomain, r_Minterval& destDomain);
88 
90  inline ~r_MiterFloat();
91 
93  inline void reset();
94 
96  inline char* nextCell();
97 
99  inline bool isDone();
100 
101 protected:
102  struct iter_desc
103  {
107 
110 
113  char *cell;
114  };
115 
117  char *currentCell;
118  const char *firstCell;
119 
121 
122  bool done;
123 };
124 
125 
126 #include "miterf.icc"
127 
128 #endif
r_Range maxSteps
Definition: miterf.hh:109
iter_desc * iterDesc
Definition: miterf.hh:120
char * cell
Definition: miterf.hh:113
r_Range dimStep
Definition: miterf.hh:111
r_FixedPointNumber min
Definition: miterf.hh:104
r_MiterFloat(Tile *sourceTile, r_Minterval &sourceDomain, r_Minterval &destDomain)
Constructor getting the source tile, the source domain and the destination domain.
int r_Range
Definition: mddtypes.hh:100
void reset()
iterator reset
unsigned int r_Dimension
Definition: mddtypes.hh:118
r_FixedPointNumber pos
Definition: miterf.hh:105
bool done
Definition: miterf.hh:122
Definition: miterf.hh:83
r_Range scaleStep
Definition: miterf.hh:112
Definition: miterf.hh:102
r_FixedPointNumber step
Definition: miterf.hh:106
char * currentCell
Definition: miterf.hh:117
Definition: tile.hh:80
char * nextCell()
get the next cell
bool isDone()
true if done
r_Range countSteps
Definition: miterf.hh:108
Definition: miterf.hh:39
~r_MiterFloat()
destructor
const char * firstCell
Definition: miterf.hh:118
Definition: minterval.hh:249
r_Dimension dim
Definition: miterf.hh:116