rasdaman base DBMS
dbrcindexds.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 /*************************************************************
24  *
25  *
26  * PURPOSE:
27  * RC index RDBMS adaptor include file.
28  *
29  *
30  * COMMENTS:
31  *
32  ************************************************************/
33 
34 #ifndef _DBRCINDEXDS_HH_
35 #define _DBRCINDEXDS_HH_
36 
37 #include "reladminif/dbobject.hh"
38 #include "indexmgr/indexds.hh"
40 
41 //@ManMemo: Module: {\bf relindexif}
42 /*@Doc:
43 Can't have DBRCIndex and DBHierIndex under a common father class because the compiler has problems resolving the DBRef<> functions correctly.
44 
45 Persistent class for storing data on regular computed indexes.
46 
47 Beware of the cache when droping the IndexDS classes!
48 
49 See indexmgr/indexds.hh for documentation.
50 
51 Data to store:
52 RAS_RCINDEXDYN
53  OId NUMBER(15,0),
54  Count NUMBER(3,0),
55  DynData VARCHAR(3990)
56 NB: under Oracle 9i, Dyndata is defined as:
57  DynData BLOB NOT NULL
58 This should be done for the other systems too,
59 as VARCHAR usually is subject to charset translation
60 which we don't want on our binary data.
61 
62 DynData holds: r_Dimension, OId::OIdType, OId::OIdCounter, InlineMinterval, InlineMinterval
63 As:
64  r_Dimension dimension 4
65  OId::OIdType myBaseOIdType 2
66  OId::OIdCounter myBaseCounter 4
67  unsigned int mySize 4
68  InlineMinterval myDomain 10 * dim
69 
70 */
79 class DBRCIndexDS : public IndexDS
80 {
81 public:
82  DBRCIndexDS(const r_Minterval& definedDomain, unsigned int numberTiles, OId::OIdType theEntryType = OId::BLOBOID);
83  /*@Doc:
84  Create a new index which handles the domain definedDomain, with tiles of domain
85  tileConfig. As soon as you create this index it will check if the tileConfig fits
86  the definedDomain (the tileConfig must completely cover the definedDomain) and then
87  allocate as many oids as are neccessary to fill the definedDomain.
88  */
89 
90  virtual r_Minterval getCoveredDomain() const;
92 
93  virtual r_Minterval getAssignedDomain() const;
95 
96  virtual r_Minterval getObjectDomain(unsigned int pos) const;
98 
99  virtual r_Dimension getDimension() const;
100 
101  virtual void setAssignedDomain(const r_Minterval& domain);
103 
104  virtual unsigned int getSize() const;
106 
107  virtual r_Bytes getTotalStorageSize() const;
108 
109  virtual bool isValid() const;
111 
112  virtual bool isUnderFull() const;
114 
115  virtual bool isOverFull() const;
117 
118  virtual bool isSameAs(const IndexDS* pix) const;
119 
120  virtual bool removeObject(unsigned int pos);
122 
123  virtual bool removeObject(const KeyObject& theKey);
125 
126  virtual void insertObject(const KeyObject& theKey, unsigned int pos);
128 
129  virtual void setObject(const KeyObject& theKey, unsigned int pos);
131 
132  virtual void setObjectDomain(const r_Minterval& dom, unsigned int pos);
134 
135  virtual const KeyObject& getObject(unsigned int pos) const;
137 
138  virtual void getObjects(KeyObjectVector& objs) const;
140 
141  virtual unsigned int getOptimalSize() const;
143 
144  virtual void freeDS();
145 
146  virtual OId::OIdPrimitive getIdentifier() const;
147 
148  static r_Bytes BytesPerTupel;
149  /*@Doc:
150  tuning parameter. used to calculate the optimal size of
151  an index. this is also the number of bytes written to the
152  database.
153  */
154 
155  virtual void printStatus(unsigned int level = 0, std::ostream& stream = std::cout) const;
156 
157  virtual ~DBRCIndexDS();
158 
159  virtual void destroy();
160 
161  virtual IndexDS* getNewInstance() const;
163 
164  virtual OId::OIdType getBaseOIdType() const;
165 
166  virtual OId::OIdCounter getBaseCounter() const;
167 
168 protected:
169  friend class ObjectBroker;
170  /*@Doc:
171  ObjectBroker needs to access OId constructor
172  */
173 
174  DBRCIndexDS(const OId& id);
175  /*@Doc:
176  */
177 
178  virtual void readFromDb() throw (r_Error);
179  /*@Doc:
180  */
181 
182  virtual void updateInDb() throw (r_Error);
183  /*@Doc:
184  */
185 
186  virtual void deleteFromDb() throw (r_Error);
187  /*@Doc:
188  */
189 
190  virtual void insertInDb() throw (r_Error);
191  /*@Doc:
192  */
193 
194  OId::OIdCounter myBaseCounter;
195  /*@Doc:
196  The first oid that will be used to store entries.
197  */
198 
199  OId::OIdType myBaseOIdType;
200  /*@Doc:
201  The type of objects to store in this index (most of the time this will be OId::BLOBOID).
202  */
203 
204  OId::OIdCounter mySize;
205 
207  /*@Doc:
208  Defined domain of this index.
209  */
210 
212  /*@Doc:
213  is needed to support update of index in database
214  keeps the number of rows currently taken up in the db by
215  this instance
216  */
217 };
218 #endif
OIdType
Definition: oidif.hh:70
OId::OIdCounter myBaseCounter
Definition: dbrcindexds.hh:194
virtual void setAssignedDomain(const r_Minterval &domain)
Definition: dbrcindexds.hh:79
std::vector< KeyObject > KeyObjectVector
Definition: lists.h:79
virtual r_Dimension getDimension() const
throw r_Error_FeatureNotSupported
virtual bool isSameAs(const IndexDS *pix) const
returns false
virtual unsigned int getSize() const
throw r_Error_FeatureNotSupported
Definition: inlineminterval.hh:44
virtual void readFromDb()
virtual r_Bytes getTotalStorageSize() const
this will return the maximum number of tiles that can be stored in the definedDomain.
OId::OIdCounter mySize
Definition: dbrcindexds.hh:204
virtual void destroy()
virtual unsigned int getOptimalSize() const
throw r_Error_FeatureNotSupported
virtual void deleteFromDb()
Definition: objectbroker.hh:71
Definition: oidif.hh:67
virtual void printStatus(unsigned int level=0, std::ostream &stream=std::cout) const
virtual void getObjects(KeyObjectVector &objs) const
throw r_Error_FeatureNotSupported
virtual bool isValid() const
virtual void setObjectDomain(const r_Minterval &dom, unsigned int pos)
throw r_Error_FeatureNotSupported
DBRCIndexDS(const r_Minterval &definedDomain, unsigned int numberTiles, OId::OIdType theEntryType=OId::BLOBOID)
Definition: oidif.hh:79
virtual bool isUnderFull() const
returns true
short currentDbRows
Definition: dbrcindexds.hh:211
static r_Bytes BytesPerTupel
Definition: dbrcindexds.hh:148
int OIdCounter
Definition: oidif.hh:96
virtual r_Minterval getCoveredDomain() const
virtual OId::OIdType getBaseOIdType() const
throw r_Error_FeatureNotSupported
double OIdPrimitive
Definition: oidif.hh:102
virtual void freeDS()
returns the maximum number of entries that can be stored in this index
InlineMinterval myDomain
Definition: dbrcindexds.hh:206
virtual bool removeObject(unsigned int pos)
virtual r_Minterval getObjectDomain(unsigned int pos) const
return defined domain
OId::OIdType myBaseOIdType
Definition: dbrcindexds.hh:199
virtual void updateInDb()
virtual OId::OIdCounter getBaseCounter() const
virtual void insertObject(const KeyObject &theKey, unsigned int pos)
throw r_Error_FeatureNotSupported
virtual ~DBRCIndexDS()
virtual const KeyObject & getObject(unsigned int pos) const
throw r_Error_FeatureNotSupported
virtual void setObject(const KeyObject &theKey, unsigned int pos)
throw r_Error_FeatureNotSupported
virtual OId::OIdPrimitive getIdentifier() const
virtual IndexDS * getNewInstance() const
virtual bool isOverFull() const
returns false
virtual r_Minterval getAssignedDomain() const
return defined domain
virtual void insertInDb()