rasdaman complete source
indexds.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 _INDEXDS_HH_
34 #define _INDEXDS_HH_
35 
36 #include "reladminif/dbobject.hh"
37 #include "reladminif/lists.h"
38 #include "reladminif/oidif.hh"
39 
51 class IndexDS : public DBObject
52 {
53 public:
54  IndexDS():DBObject() {}
55 
56  IndexDS(const OId& id):DBObject(id) {}
57 
58  virtual r_Minterval getCoveredDomain() const = 0;
59  /*@Doc:
60  returns the domain which is covered by the entries of this index.
61  when some one has time:
62  this should not be persistent
63  this is not the same as assigned domain
64  this should be updated automatically when removing and adding entries, and is
65  */
66 
67  virtual r_Minterval getAssignedDomain() const = 0;
68  /*@Doc:
69  returns the domain this index is responsible for (assigned domain).
70  when some one has time:
71  this is persistent and should be
72  this should not be the same as covered domain, but is
73  this should not be updated when removing entries, but is because of above
74  */
75 
76  virtual r_Minterval getObjectDomain(unsigned int pos) const = 0;
77  /*@Doc:
78  Returns the (assigned) domain for the object in position {\ttpos}.
79  The object domain is always a assigned domain, because we do not read the domain from the entries (blobtiles do not store one).
80  At some point this of course makes storing the assigned domain obsolete (because it is stored at the parent, in case of the root it is the covered domain which can be computed from the entries)
81  */
82 
83  virtual r_Dimension getDimension() const = 0;
84  /*@Doc:
85  Returns the dimensionality of this index.
86  */
87 
88  virtual unsigned int getSize() const = 0;
89  /*@Doc:
90  Only the number of elements in this index node is returned.
91  */
92 
93  virtual bool isValid() const = 0;
94  /*@Doc:
95  true when domains of entries of nodes are completely covered
96  by the assigned domains of the nodes and assigned domains of
97  leafs intersect with each of their entries domains. The assigned domains may not intersect.
98  false otherwise.
99  */
100 
101  virtual bool isUnderFull() const = 0;
102  /*@Doc:
103  Returns true when the index does not have the minimal number of entries (it is a candidate for merging).
104  Otherwise false.
105  */
106 
107  virtual bool isOverFull() const = 0;
108  /*@Doc:
109  Same as above but vice versa.
110  */
111 
112  virtual bool isSameAs(const IndexDS* pix) const = 0;
113  /*@Doc:
114  Compares two index data structures:
115  When both are persistent, their oids are compared.
116  When both are transient there memory address is compared.
117  Else they are not equal.
118  */
119 
120  virtual bool removeObject(unsigned int pos) = 0;
121  /*@Doc:
122  Removes an object from this index. It returns true if the object was successfully removed.
123  */
124 
125  virtual bool removeObject(const KeyObject& theKey) = 0;
126  /*@Doc:
127  Removes an object from this index. It returns true if the object was successfully removed.
128  */
129 
130  virtual void insertObject(const KeyObject& theKey, unsigned int pos) = 0;
131  /*@Doc:
132  Inserts the object in theKey at the sppecified position.
133  Position 0 means at the front.
134  */
135 
136  virtual void setAssignedDomain(const r_Minterval& domain) = 0;
137  /*@Doc:
138  Sets the assigned domain.
139  */
140 
141  virtual void setObject(const KeyObject& theKey, unsigned int pos) = 0;
142  /*@Doc:
143  Sets the entry and domain at position pos.
144  */
145 
146  virtual void setObjectDomain(const r_Minterval& dom, unsigned int pos) = 0;
147  /*@Doc:
148  Sets the assigned domain of the object at position pos to dom.
149  */
150 
151  virtual const KeyObject& getObject(unsigned int pos) const = 0;
152  /*@Doc:
153  The requested object will be placed in result.
154  */
155 
156  virtual void getObjects(KeyObjectVector& objs) const = 0;
157  /*@Doc:
158  Push all entries into the vector
159  */
160 
161  virtual unsigned int getOptimalSize() const = 0;
162  /*@Doc:
163  Computes the optimal number of entries for this index.
164  Should be moved to a place where StorageLayout is accessible.
165  */
166 
167  virtual void freeDS() = 0;
168  /*@Doc:
169  Marks the persistent database index data structure for
170  deletion all entries contained in it will be deleted
171  from the database along with it.
172  */
173 
174  virtual OId::OIdPrimitive getIdentifier() const = 0;
175 
176  virtual IndexDS* getNewInstance() const = 0;
177 };
178 
179 #endif
std::vector< KeyObject > KeyObjectVector
Definition: lists.h:79
Definition: keyobject.hh:43
double OIdPrimitive
Definition: oidif.hh:102