rasdaman base DBMS
blobtile.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 */
23 // -*-C++-*- (for Emacs)
24 
25 /*************************************************************
26  *
27  *
28  * PURPOSE:
29  * The Blobtile class is used to store the tiles in the database.
30  *
31  *
32  * COMMENTS:
33  *
34  ************************************************************/
35 
36 #ifndef _BLOBTILE_HH_
37 #define _BLOBTILE_HH_
38 
39 class OId;
40 class r_Error;
41 
42 #include "dbtile.hh"
43 #include "raslib/mddtypes.hh"
44 
45 //@ManMemo: Module: {\bf relblobif}.
46 
47 /*@Doc:
48 
49 BLOBTile is the persistent class for storing the contents of MDD tiles
50 in the database. Each instance represents the contents of a tile of a MDD Object
51 from the database. BLOBTiles are just arrays of unsigned characters.
52 In main memory they are encapsulated in the class \Ref{PersTile}.
53 
54 At the moment a BLOBTile is loaded into main memory, when it is
55 accessed the first time. This usually happens, when the RasDaMan DBMS
56 accesses the contents of a \Ref{PersTile}.
57 
58 {\bf Interdependencies}
59 
60 BLOBTile is an interface class with the base DBMS. It is, therefore,
61 highly dependent on the base DBMS used.
62 */
71 class BLOBTile : public DBTile
72 {
73 public:
74  //@Man: constructors
76  BLOBTile(r_Data_Format dataformat = r_Array);
77  /*@Doc:
78  constructs a new empty BLOBTile and gets an id for it.
79  */
80 
81  BLOBTile(const OId& BlobId) throw (r_Error);
82  /*@Doc:
83  constructs a BlobTile out of the database
84  */
85 
86  BLOBTile(r_Bytes newSize, char c = 0, r_Data_Format dataformat = r_Array);
87  /*@Doc:
88  constructs a new BLOBTile of size newSize filled with c.
89  */
90 
91  BLOBTile(r_Bytes newSize, r_Bytes patSize, const char* pat, r_Data_Format dataformat = r_Array);
92  /*@Doc:
93  Constructs a new BLOB Tile of size newSize filled with the repeated
94  char array pat of size patSize. If after filling some chars are
95  left, they are filled with 0
96  */
97  /*@ManMemo: constructs a new BLOB Tile with the char array newCells
98  with newSize elements as contents. */
99 
100  BLOBTile(r_Bytes newSize, const char* newCells, r_Data_Format dataformat = r_Array);
101  /*@Doc:
102  constructs a new BLOBTile of size newSize filled with the contents of newCells.
103  */
104 
105  BLOBTile(r_Bytes newSize, const char* newCells, r_Data_Format dataformat, const OId& myOId);
106  /*@Doc:
107  constructs a new BLOBTile of size newSize filled with the contents of newCells.
108  the oid will be assigned to this blob. used by regular computed index.
109  */
110 
111  BLOBTile(const OId& BlobId, r_Bytes newSize, r_Data_Format newFmt);
112  /*@Doc:
113  constructs a new BLOBTile of size newSize filled with zeros.
114  the tile will think it is not modified and also not in the db but persistent.
115  this is used by the rc index.
116  */
117 
119 
120  virtual ~BLOBTile();
121  /*@Doc:
122  validates the object. deletes it cells.
123  */
124 
125  static void kill(const OId& target, unsigned int range = 0);
126  /*@Doc:
127  delete a blobtile without loading it first into memory.
128  is used by the indexes.
129  delete the blobtile and range consecutive tiles.
130  */
131 
132  static r_Bytes BLOBBufferLength;
133  /*@Doc:
134  info on the length of the BLOBBuffer
135  */
136 
137 protected:
138 
139  virtual void updateInDb() throw (r_Error);
140  /*@Doc:
141  update the contents of a Tile in the db
142  */
143 
144  virtual void insertInDb() throw (r_Error);
145  /*@Doc:
146  inserts the Blob into the db.
147  */
148 
149  virtual void readFromDb() throw (r_Error);
150  /*@Doc:
151  read blob from db into blobtile
152  */
153 
154  virtual void deleteFromDb() throw (r_Error);
155  /*@Doc:
156  deletes a blob from TILES, sets size to 0 and flags to -1
157  */
158 
159 private:
160  static char* BLOBBuffer;
161  /*@Doc:
162  for writing into the DB. currently not needed by oracle.
163  */
164 
165 };
166 
167 #endif
virtual void updateInDb()
virtual ~BLOBTile()
BLOBTile(r_Data_Format dataformat=r_Array)
virtual void deleteFromDb()
Definition: dbtile.hh:54
Definition: oidif.hh:67
static r_Bytes BLOBBufferLength
Definition: blobtile.hh:132
Definition: blobtile.hh:71
virtual void insertInDb()
static void kill(const OId &target, unsigned int range=0)
virtual void readFromDb()
OId myOId
Definition: dbobject.hh:267