rasdaman complete source
mddobj.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 _MDDOBJ_HH_
34 #define _MDDOBJ_HH_
35 
36 #include <vector>
37 
38 #include "tilemgr/tile.hh"
39 #include "relcatalogif/mddbasetype.hh" // from catalogif base DBMS class
40 #include "raslib/minterval.hh"
41 #include "storagemgr/sstoragelayout.hh"
42 #include "relmddif/mddid.hh"
43 
44 class MDDObjIx;
45 
46 //@ManMemo: Module: {\bf cachetamgr}
47 /*@Doc:
48 
49 An MDDObj object (Multidimensional Discrete Data Object) is a multidimensional array of cells of a fixed base type.
50 Each MDDObj object keeps information about its cell base type, definition domain, the storage layout and the index.
51 Actual data is stored in tiles which are linked to the MDDObj via the index.
52 
53 When the object is first created, a spatial {\bf definition domain} for the object is given, which specifies the extents of the object array. This is expressed through an interval which may have open bounds along some (or all) directions.
54 An open bound along a direction specifies that the object may grow arbitrarily along this direction.
55 
56 At each point in time, an MDDObj has a fixed {\bf current domain} which specifies the actual extent of the object at the moment.
57 The current domain is an interval with fixed bounds corresponding to the coverage of all the tiles already inserted in the MDDObj.
58 The current domain should be a subinterval of the definition domain, so that tiles inserted in the object should always be completely contained in the definition domain of the object. This is not checked here!
59 
60 Objects of this class provide the needed functionality of MDDObjs to the RasDaMan server, namely, access to the tiles (which are the actual units of execution, processing and management internally at the server).
61 
62 Even though tiles are the units of execution in RasDaMan, once a tile is inserted in an MDDObj, it is no longer an independent entity. It should only be deleted from its storage domain through the MDD object it belongs to. Each MDDObj is responsible for managing its own tiles, including deallocation of memory occupied by the tiles.
63 The memory management is delegated to the index. Only when the MDDObjIx is deleted the tiles that were accessed during the transaction will be removed from memory.
64 
65 */
66 class MDDObj
67 {
68 public:
69  //@Man: Constructors
71 
72  MDDObj(const MDDBaseType* mddType, const r_Minterval& domain);
78  MDDObj(const MDDBaseType* mddType, const r_Minterval& domain, const OId& newOId, const StorageLayout& ms) throw (r_Error);
87  MDDObj(const DBMDDObjId& dbmddobj) throw (r_Error);
93  MDDObj(const OId& givenOId) throw (r_Error);
99  MDDObj(const MDDBaseType* mddType, const r_Minterval& domain, const StorageLayout& ms);
107 
108  //@Man: Object Identification:
110  int getOId(OId* pOId) const;
115  int getEOId(EOId* pEOId) const;
120 
121  //@Man: Printing the status of the object.
123  void printStatus(unsigned int level = 0, std::ostream& stream = std::cout) const;
126 
127  //@Man: Insertion of new tiles in the MDD object:
129 
136  void insertTile(Tile* newTile);
138 
140 
141  //@Man: Removal of tiles from the MDD object:
143 
145  void removeTile(Tile*& tileToRemove);
151 
152  //@Man: Retrieval of tiles from the MDD object:
154 
158  std::vector< Tile* >* intersect(const r_Minterval& searchInter) const;
165  std::vector< Tile* >* getTiles() const;
172  const char* pointQuery(const r_Point& searchPoint) const;
178  char* pointQuery(const r_Point& searchPoint);
184 
185 
186  //@Man: Cell and domain properties of the MDD Object:
188 
190  const MDDBaseType* getMDDBaseType() const;
191 
194 
197 
199  const char* getCellTypeName() const;
200 
202  const BaseType* getCellType() const;
203 
205  r_Dimension getDimension() const;
207 
208 
209  //@Man: Miscellaneous Methods
211 // void setDoNotUseThisMethodItIsABugFix(bool yes);
213 
215 // bool isDoNotUseThisMethodItIsABugFix() const;
216 
218  bool isPersistent() const;
219 
221  DBMDDObjId getDBMDDObjId() const;
223 
224  //@Man: Destructor
226  ~MDDObj();
229 
231  void releaseTiles();
232 
235 
236 protected:
237 
239  const r_Minterval& checkStorage(const r_Minterval& domain) throw (r_Error);
240 
243 
246 
249 
250 // bool doNotUseThisBugFix;
256 };
257 
258 #endif
const char * pointQuery(const r_Point &searchPoint) const
Gets the cell with coordinates { searchPoint} in the MDD.
Definition: eoid.hh:52
MDDObjIx * myMDDIndex
The index class that is used to access tile, before deleting thems.
Definition: mddobj.hh:245
Definition: mddobjix.hh:98
Definition: point.hh:59
Definition: error.hh:88
~MDDObj()
Destructor - frees dynamic memory.
unsigned int r_Dimension
Definition: mddtypes.hh:118
DBMDDObjId getDBMDDObjId() const
Returns a pointer to the actual object in the base DBMS.
const r_Minterval & checkStorage(const r_Minterval &domain)
does some consistency checks for regular tiling with rc index
const BaseType * getCellType() const
Get base type.
Definition: mddbasetype.hh:57
Definition: oidif.hh:67
r_Minterval getDefinitionDomain() const
Returns the domain of the object as it was given in the definition.
r_Dimension getDimension() const
Returns the dimensionality of the object.
MDDObj(const MDDBaseType *mddType, const r_Minterval &domain)
StorageLayout * getStorageLayout() const
Return the storage layout of this object.
void printStatus(unsigned int level=0, std::ostream &stream=std::cout) const
Prints current status of the object.
std::vector< Tile * > * intersect(const r_Minterval &searchInter) const
Finds all tiles of the object which intersect searchInter.
void removeTile(Tile *&tileToRemove)
Definition: tile.hh:80
const char * getCellTypeName() const
Get cell type name.
Definition: relcatalogif/basetype.hh:66
bool isPersistent() const
This method is used to get around a bug in the qlparser.
int getOId(OId *pOId) const
StorageLayout * myStorageLayout
The storage class which is reponsible for the tiling.
Definition: mddobj.hh:248
const MDDBaseType * getMDDBaseType() const
Returns the MDDBaseType of the object.
Definition: mddobj.hh:66
r_Minterval getCurrentDomain() const
Returns the current domain for the object.
void releaseTiles()
release all tiles from the index
Definition: sstoragelayout.hh:65
void insertTile(Tile *newTile)
Inserts new tile into the object.
std::vector< Tile * > * getTiles() const
Returns all the tiles belonging to the object.
int getEOId(EOId *pEOId) const
Definition: minterval.hh:249
DBMDDObjId myDBMDDObj
The data class that holds all information.
Definition: mddobj.hh:242