rasdaman complete source
sstoragelayout.hh
Go to the documentation of this file.
1 #ifndef _STORAGELAYOUT_HH_
2 #define _STORAGELAYOUT_HH_
3 
4 #include <vector>
5 
6 #include "raslib/minterval.hh"
9 #include "rasodmg/stattiling.hh"
10 #include "rasodmg/dirdecompose.hh"
12 
13 
14 /*
15 * This file is part of rasdaman community.
16 *
17 * Rasdaman community is free software: you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License as published by
19 * the Free Software Foundation, either version 3 of the License, or
20 * (at your option) any later version.
21 *
22 * Rasdaman community is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
26 *
27 * You should have received a copy of the GNU General Public License
28 * along with rasdaman community. If not, see <http://www.gnu.org/licenses/>.
29 *
30 * Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
31 rasdaman GmbH.
32 *
33 * For more information please see <http://www.rasdaman.org>
34 * or contact Peter Baumann via <baumann@rasdaman.com>.
35 */
36 /****************************************************************************
37  *
38  *
39  * INCLUDE: storagelayout.hh
40  *
41  * MODULE: storagemgr
42  * CLASS: StorageLayout
43  *
44  * CHANGE HISTORY (append further entries):
45  * when who what
46  * -----------------------------------------------------------------------
47  * 13-Nov-00 hoefner creation of preliminary version
48  * 07-Jan-09 Shams add tiling attributes
49  * COMMENTS:
50  *
51  ****************************************************************************/
52 
53 //@ManMemo: Module: {\bf indexmgr}
54 /*@Doc:
55  The {\bf StorageLayout} class is used to set the storage layout for persistent
56  MDD objects.
57 */
66 {
67 public:
68 
69  //@Man: Default values
71 
74  static const r_Bytes DBSPageSize;
75  /*@Doc:
76  Database system page size. not used at the moment.
77  */
78 
79  static r_Bytes DefaultMinimalTileSize;
80  /*@Doc:
81  For inlinetiles. this is the minimum size for a blobtile to be stored as a single blob.
82  if you use inlinetile index and a tile is smaller than this value the inlinetile will be stored inside the indexstructure.
83  this value should be smaller than a database system page size.
84  */
85 
86  static r_Bytes DefaultPCTMax;
87  /*@Doc:
88  for inlinetiles. the maximum size of inlined inlinetiles. if they grow larger than this value they are outlined and stored as a single blob.
89  */
90 
91  static r_Bytes DefaultTileSize;
92  /*@Doc:
93  for serverside retiling based on tile size. this is very bad for production systems but will allow for easier testing.
94  when an incomming tile from the client is larger than this number and tile size tiling is enabled the server will split the tile into smaller tiles so that each resulting tile has a smaller size than the incomming tile.
95  */
96 
97  static unsigned int DefaultIndexSize;
98  /*@Doc:
99  this is usually computed by the index structures. for testing purposes and bugfixing it will allow the user to override the computed number of childs per hierarchical index node.
100  */
101 
102  static r_Index_Type DefaultIndexType;
103  /*@Doc:
104  the default index to be used.
105  */
106 
107  static r_Tiling_Scheme DefaultTilingScheme;
108  /*@Doc:
109  the default tiling to be used.
110  */
112  static r_Minterval DefaultTileConfiguration;
113  /*@Doc:
114  the default tiling configuration to be used.
115  */
117  static r_Data_Format DefaultDataFormat;
118  /*@Doc:
119  the default data format for tiles.
120  */
122 
123  //@Man: Creation
125 
126  StorageLayout();
127  /*@Doc:
128  Construct object with the default values.
129  */
130 
131  StorageLayout(r_Index_Type ixtype);
132  /*@Doc:
133  this is needed for transdir
134  */
135 
136  StorageLayout(const DBStorageLayoutId& myStorage);
137  /*@Doc:
138  Construct object with specific modes.
139  */
140 
141  // StorageLayout(const char* storageLayoutName);
142  /*@Doc:
143  Construct object from an existing named one.
144  */
146 
147  //@Man: Get operations
149 
150  r_Index_Type getIndexType() const;
151  /*@Doc:
152  return the index type to be used.
153  this may be the default value if it was not defined previously.
154  */
155 
156  r_Tiling_Scheme getTilingScheme() const;
157  /*@Doc:
158  return the tiling scheme to be used.
159  this may be the default value if it was not defined previously.
160  */
161 
162  r_Bytes getTileSize() const;
163  /*@Doc:
164  return the tile size to be used for size based retiling (really bad!).
165  this may be the default value if it was not defined previously.
166  */
167 
168  r_Bytes getMinimalTileSize() const;
169  /*@Doc:
170  Get minimum optimal tile size.
171  */
172 
173  r_Minterval getTileConfiguration() const;
174  /*@Doc:
175  return the tile domain which defines origin and extent to be used.
176  this may be the default value if it was not defined previously.
177  */
178 
180 
181  //@Man: Set operations
183 
184  void setIndexType(r_Index_Type it);
185  /*@Doc:
186  override previous values or default values for this option.
187  */
188 
189  void setTilingScheme(r_Tiling_Scheme ts);
190  /*@Doc:
191  override previous values or default values for this option.
192  */
193 
194  void setTileSize(r_Bytes ts);
195  /*@Doc:
196  override previous values or default values for this option.
197  */
198 
199  void setTileConfiguration(const r_Minterval& tc);
200  /*@Doc:
201  override previous values or default values for this option.
202  */
203 
204  void setDataFormat(r_Data_Format df);
205  /*@Doc:
206  override previous values or default values for this option.
207  */
208 
210 
211  //@Man: Operations
213 
214  std::vector< r_Minterval > getLayout(const r_Minterval& tileDomain);
215  /*@Doc:
216  Partition a multidimensional array according to the storage layout.
217  */
218 
219  r_Data_Format getDataFormat(const r_Point& where) const;
220  /*@Doc:
221  this is supplied to offer later implementations to specify the dataformat depending on the region of space.
222  */
223 
225 
226 
227  //@Man: Destruction
229  ~StorageLayout();
231 
233  /*@Doc:
234  return the object which actually stores the option values.
235  */
236 
237  // Functions added by Andrei Aiordachioaie, to match function definitions. (17-08-2009)
238  void setBBoxes(const vector<r_Minterval>& input);
239  void setSubTiling();
240  void resetSubTiling();
241  void setInterestThreshold(double i);
242  void setBorderThreshold(unsigned int b);
243  void setCellSize(int size);
244  void setDirDecomp(vector<r_Dir_Decompose>*);
245 
246 
247 protected:
248  std::vector< r_Minterval > calcRegLayout(const r_Minterval& layout) const;
249  /*@Doc:
250  calculate the domains which intersect the layout parameter. as point of origin the domain specified in myLayout is used.
251  */
252 
253  //@Man: Actual Parameters:
255 
257  /*@Doc: actual features */
258 
260  //@Man: Persistent Representation of a StorageLayout object.
262 
264  std::vector< r_Minterval >
265  calcInterestLayout(const r_Minterval& tileDomain);
266 
267  //@Man: Actual Parameters:
269  std::vector< r_Minterval >
270  calcAlignedLayout(const r_Minterval&);
271 
272  std::vector< r_Minterval >
273  calcDirectionalLayout(const r_Minterval&);
274 
275  std::vector< r_Minterval >
276  calcStatisticLayout(const r_Minterval&);
277 
279 
280 };
281 #endif
static r_Tiling_Scheme DefaultTilingScheme
Definition: sstoragelayout.hh:107
std::vector< r_Minterval > getLayout(const r_Minterval &tileDomain)
static r_Bytes DefaultPCTMax
Definition: sstoragelayout.hh:86
void setDataFormat(r_Data_Format df)
r_Data_Format getDataFormat(const r_Point &where) const
static const r_Bytes DBSPageSize
Definition: sstoragelayout.hh:74
std::vector< r_Minterval > calcDirectionalLayout(const r_Minterval &)
static r_Minterval DefaultTileConfiguration
Definition: sstoragelayout.hh:112
r_Index_Type getIndexType() const
void setDirDecomp(vector< r_Dir_Decompose > *)
static r_Index_Type DefaultIndexType
Definition: sstoragelayout.hh:102
DBStorageLayoutId getDBStorageLayout() const
std::vector< r_Minterval > calcRegLayout(const r_Minterval &layout) const
void resetSubTiling()
void setCellSize(int size)
StgMddConfig * extraFeatures
Definition: sstoragelayout.hh:256
static r_Data_Format DefaultDataFormat
Definition: sstoragelayout.hh:117
void setBorderThreshold(unsigned int b)
std::vector< r_Minterval > calcAlignedLayout(const r_Minterval &)
DBStorageLayoutId myLayout
Definition: sstoragelayout.hh:259
static unsigned int DefaultIndexSize
Definition: sstoragelayout.hh:97
void setBBoxes(const vector< r_Minterval > &input)
void setSubTiling()
static r_Bytes DefaultMinimalTileSize
Definition: sstoragelayout.hh:79
r_Tiling_Scheme getTilingScheme() const
std::vector< r_Minterval > calcStatisticLayout(const r_Minterval &)
void setTileConfiguration(const r_Minterval &tc)
void setInterestThreshold(double i)
void setTilingScheme(r_Tiling_Scheme ts)
void setIndexType(r_Index_Type it)
r_Bytes getMinimalTileSize() const
void setTileSize(r_Bytes ts)
Definition: stgmddconfig.hh:48
Definition: sstoragelayout.hh:65
static r_Bytes DefaultTileSize
Definition: sstoragelayout.hh:91
r_Minterval getTileConfiguration() const
r_Bytes getTileSize() const
std::vector< r_Minterval > calcInterestLayout(const r_Minterval &tileDomain)
All parameters are stored there.