rasdaman API
tiling.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 /
33 #ifndef _R_TILING_HH_
34 #define _R_TILING_HH_
35 
36 class r_Tiling;
37 class r_No_Tiling;
38 class r_Size_Tiling;
39 class r_Dimension_Tiling;
40 class r_Minterval;
41 
42 // Include statements
43 
44 #include <vector>
45 #include <iostream>
46 using std::cout;
47 
48 #include "raslib/rminit.hh"
49 #include "raslib/odmgtypes.hh"
50 #include "raslib/mddtypes.hh"
51 #include "raslib/error.hh"
52 
53 //@ManMemo: Module {\bf rasodmg}
54 
55 /*@Doc:
56 
57  The {\tt r_Tiling} class is used to specify in which way the tiling is done
58  by the system. The core method that does that is called {\tt decomposeMDD()}
59  and must be implemented by all derived classes. It takes an object that
60  hasn't yet been split and divides it into tiles. Each derived class
61  implements a diferent decomposition method.
62 */
63 
67 class r_Tiling
68 {
69 public:
70 
72  virtual ~r_Tiling();
73 
75  virtual void print_status(std::ostream& os) const = 0;
76 
78  virtual bool is_compatible(const r_Minterval& obj_domain, r_Bytes cellTypeSize) const = 0;
79 
81  virtual std::vector<r_Minterval>* compute_tiles(const r_Minterval& obj_domain, r_Bytes cell_size) const throw (r_Error) = 0;
91  virtual r_Tiling* clone() const = 0;
98  virtual r_Tiling_Scheme get_tiling_scheme() const = 0;
103  static const char* ASTERIX;
104  static const char* TCOLON;
105  static const char* TCOMMA;
106  static const char* LSQRBRA;
107  static const char* RSQRBRA;
108  static const long DefaultBase;
109 };
110 
114 class r_Size_Tiling : public r_Tiling
115 {
116 public:
119  r_Size_Tiling(const char* encoded) throw (r_Error);
120 
123 
125  virtual ~r_Size_Tiling();
126 
128  r_Bytes get_tile_size() const;
129 
130  virtual void print_status(std::ostream& os) const;
131 
133  virtual bool is_compatible(const r_Minterval& obj_domain, r_Bytes cellTypeSize) const;
134 
135  virtual std::vector<r_Minterval>* compute_tiles(const r_Minterval& obj_domain, r_Bytes cellTypeSize) const throw (r_Error);
136 
137  virtual r_Tiling* clone() const;
138 
139  virtual r_Tiling_Scheme get_tiling_scheme() const;
140 
141  static const char* description;
142 
143 protected:
144 
147 };
148 
149 
154 {
155 public:
158 
160  virtual ~r_Dimension_Tiling();
161 
163  r_Dimension get_dimension() const;
164 
165  virtual void print_status(std::ostream& os) const;
166 
167  virtual bool is_compatible(const r_Minterval& obj_domain, r_Bytes cellTypeSize) const;
169 
170  virtual std::vector<r_Minterval>* compute_tiles(const r_Minterval& obj_domain, r_Bytes cellTypeSize) const throw (r_Error) = 0;
171 
172  virtual r_Tiling* clone() const = 0;
173 
174 protected:
175 
178 };
179 
180 
184 class r_No_Tiling : public r_Tiling
185 {
186 public:
190  r_No_Tiling(const char* encoded) throw (r_Error);
192  r_No_Tiling();
193 
195  virtual ~r_No_Tiling();
196 
198  virtual void print_status(std::ostream& os) const;
199 
201  virtual bool is_compatible(const r_Minterval& obj_domain, r_Bytes cellTypeSize) const;
203 
205  virtual std::vector<r_Minterval>* compute_tiles(const r_Minterval& obj_domain, r_Bytes cellTypeSize) const throw (r_Error);
207 
208  virtual r_Tiling* clone() const;
209 
210  virtual r_Tiling_Scheme get_tiling_scheme() const;
211 
212  static const char* description;
213 };
214 
215 
216 /*@Doc:
217  Prints the status of a Tiling object to a stream
218 */
219 //extern std::ostream& operator<<(std::ostream& os, const r_Size_Tiling& t);
220 
221 /*@Doc:
222  Prints the status of a Tiling object to a stream
223 */
224 //extern std::ostream& operator<<(std::ostream& os, const r_No_Tiling& t);
225 
226 /*@Doc:
227  Prints the status of a Tiling object to a stream
228 */
229 extern std::ostream& operator<<(std::ostream& os, const r_Tiling& t);
230 
231 #include "rasodmg/tiling.hh"
232 #if (defined(__VISUALC__) && !defined(__EXECUTABLE__))
233 #define __EXECUTABLE__
234 #include "raslib/dlist.hh"
235 #undef __EXECUTABLE__
236 #else
237 #include "raslib/dlist.hh"
238 #endif
239 
240 #endif
std::ostream & operator<<(std::ostream &os, const r_Tiling &t)
static const char * description
Definition: tiling.hh:141
virtual std::vector< r_Minterval > * compute_tiles(const r_Minterval &obj_domain, r_Bytes cellTypeSize) const
Decompose an object in tiles.
virtual ~r_Size_Tiling()
does not do anything
static const char * ASTERIX
Definition: tiling.hh:103
virtual void print_status(std::ostream &os) const
Prints the current status of the object.
virtual std::vector< r_Minterval > * compute_tiles(const r_Minterval &obj_domain, r_Bytes cellTypeSize) const =0
returns true if the cellTypeSize is smaller or equal to the tile size and the dimension fits the obj_...
virtual ~r_Tiling()
does not do anything
virtual void print_status(std::ostream &os) const =0
Prints the current status of the object.
virtual bool is_compatible(const r_Minterval &obj_domain, r_Bytes cellTypeSize) const
returns true if the cellTypeSize is smaller or equal to the tile size and obj_domain has more than 0 ...
r_Bytes tile_size
Tile size.
Definition: tiling.hh:146
Definition: error.hh:88
Definition: tiling.hh:184
static const char * TCOLON
Definition: tiling.hh:104
Definition: tiling.hh:67
unsigned int r_Dimension
Definition: mddtypes.hh:118
static const char * RSQRBRA
Definition: tiling.hh:107
static const char * TCOMMA
Definition: tiling.hh:105
virtual r_Tiling * clone() const
returns obj_domain
static const char * LSQRBRA
Definition: tiling.hh:106
r_Size_Tiling(const char *encoded)
Constructor that reads everything from a string e.g."100".
virtual bool is_compatible(const r_Minterval &obj_domain, r_Bytes cellTypeSize) const
Check compatibility of object domain with this tiling.
virtual ~r_Dimension_Tiling()
does not do anything
virtual std::vector< r_Minterval > * compute_tiles(const r_Minterval &obj_domain, r_Bytes cellTypeSize) const
returns true
Definition: tiling.hh:114
virtual std::vector< r_Minterval > * compute_tiles(const r_Minterval &obj_domain, r_Bytes cell_size) const =0
Decompose an object in tiles.
static const char * description
Definition: tiling.hh:212
r_No_Tiling()
Constructor for this object.
static r_Bytes clientTileSize
Definition: rminit.hh:132
virtual bool is_compatible(const r_Minterval &obj_domain, r_Bytes cellTypeSize) const
returns true if the cellTypeSize is smaller or equal to the tile size and obj_domain has more than 0 ...
virtual r_Tiling * clone() const =0
Clones this object.
r_Tiling_Scheme
Definition: mddtypes.hh:393
r_Dimension_Tiling(r_Dimension dim, r_Bytes ts=RMInit::clientTileSize)
Constructor for this object (Takes dim (no of dimension) and tile size as parameter) ...
unsigned int r_Bytes
Definition: mddtypes.hh:56
virtual void print_status(std::ostream &os) const
Prints the current status of the object.
virtual r_Tiling_Scheme get_tiling_scheme() const =0
virtual void print_status(std::ostream &os) const
Prints the current status of the object.
virtual r_Tiling * clone() const
Clones this object.
r_Bytes get_tile_size() const
Gets the current tile size.
virtual ~r_No_Tiling()
does not do anything
virtual r_Tiling_Scheme get_tiling_scheme() const
static const long DefaultBase
Definition: tiling.hh:108
Definition: tiling.hh:153
virtual r_Tiling * clone() const =0
Clones this object.
virtual r_Tiling_Scheme get_tiling_scheme() const
virtual bool is_compatible(const r_Minterval &obj_domain, r_Bytes cellTypeSize) const =0
Check compatibility of object domain with this tiling.
r_Dimension dimension
dimension the mdd must have
Definition: tiling.hh:177
Definition: minterval.hh:249
r_Dimension get_dimension() const
Gets the current dimension.