rasdaman complete source
srcindexlogic.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 /
31 #ifndef _SRCINDEXLOGIC_HH_
32 #define _SRCINDEXLOGIC_HH_
33 
34 #include "reladminif/lists.h"
35 #include "raslib/minterval.hh"
36 #include "reladminif/oidif.hh"
37 
38 class r_Point;
39 class StorageLayout;
40 class SRCIndexLogic;
41 
48 /*@Doc:
49 
50 The regular computed index uses DBRCIndexDS and StorageLayout to store its persistent data.
51 The point is:
52  The tiles all have the same layout.
53  The domain of the mdd is fixed.
54 With those preliminaries it is possible to speed up the index considerably.
55 DBRCIndexDS stores the domain of the mdd object, the first OIdCounter and the OIdType of the entries.
56 The storage layout stores the tile configuration.
57 
58 An algorithm computes the oid of a tile using the complete domain and the tile configuration.
59 
60 The number of allocated oids has to be stored in the DBRCIndexDS because the DBRCIndexDS has to delete
61 all tiles belonging to it without information on the tile configuration (an hence cannot compute its
62 size).
63 
64 */
65 
67 {
68 public:
69 
70  static unsigned int computeNumberOfTiles(const StorageLayout& sl, const r_Minterval& mddDomain);
71  /*@Doc:
72  Compute the number of tiles that will have to be allocated by the index. This is based on the tile config from storagelayout and the domain covered by the mdd.
73  */
74 
75  static bool insertObject(IndexDS* theIx, const KeyObject& newObject, const StorageLayout& sl);
76  /*@Doc:
77  Inserts a new object in the index. Creates a new tile which has the oid that belongs to that domain. The original tile is deleted from database.
78  */
79 
80  static bool removeObject(IndexDS* theIx, const KeyObject& tileToRemove, const StorageLayout& sl);
81  /*@Doc:
82  Removes the tile from the object.
83  */
84 
85  static void intersect(const IndexDS* theIx, const r_Minterval& searchInter, KeyObjectVector& objs, const StorageLayout& sl);
86  /*@Doc:
87  Search the index for a search region.
88  Determines all the tiles in the index which intersect a given
89  search interval (given by {\tt searchInter}).
90  The memory space allocated by this function for the contents
91  of the keyobjects in the returned vector (only) must be released
92  afterwards by the caller.
93  */
94 
95  static void containPointQuery(const IndexDS* theIx, const r_Point& searchPoint, KeyObject& result, const StorageLayout& sl);
96  /*@Doc:
97  Passes a pointer to the searched item.
98  Memory is for the KeyObject is not to be released by the caller.
99  */
100 
101  static void getObjects(const IndexDS* ixDS, KeyObjectVector& objs, const StorageLayout& sl);
102  /*@Doc:
103  Returns all the tiles belonging to the object.
104  */
105 
106 protected:
107 
108  static r_Minterval computeNormalizedDomain(const r_Point& mddDomainExtent, const r_Point& tileConfigExtent);
109  /*@Doc:
110  compute the normalized matrix from the extent of the domain and the extent of the tile config.
111  */
112 
113  static r_Point computeNormalizedPoint(const r_Point& toNormalize, const r_Point& tileConfigExtent, const r_Point& mddDomainOrigin);
114  /*@Doc:
115  compute the normalized point from the point, the extent of the tile config and the origin of the mdd domain.
116  this point is then used to calculate the number of the tile in the normailzed matrix.
117  */
118 
119  static r_Minterval computeDomain(const r_Point& toConvert, const r_Point& tileConfigExtent, const r_Point& mddDomainOrigin);
120  /*@Doc:
121  compute the tile domain based on the point inside that domain, the tile config extent and the origin of the mdd.
122  */
123 
124  static OId computeOId(const r_Minterval& mddDomain, const r_Point& tileConfigExtent, OId::OIdCounter baseCounter, OId::OIdType type, const r_Point& tileOrigin);
125  /*@Doc:
126  compute the oid of an entry based on the domain of the mdd, the extent of the tile config, the starting oid adress, the type of oid and the origin of the tile domain.
127  */
128 
129  static r_Minterval computeTiledDomain(const r_Minterval& completeDomain, const r_Point& tileConfigExtent, const r_Minterval& widenMe);
130  /*@Doc:
131  compute the completely tiled domain, which is the intersection of the complete domain and the domain to be tiled (widenMe), based on the tile config.
132  Example: user requests tiles in domain [3:5]. the tile config is [1], the complete domain is [2:7]. the result will be [2:5] because [3:3] belongs to the tile [2:3].
133  */
134 
135 };
136 
137 #endif
static r_Minterval computeNormalizedDomain(const r_Point &mddDomainExtent, const r_Point &tileConfigExtent)
Definition: srcindexlogic.hh:66
static void intersect(const IndexDS *theIx, const r_Minterval &searchInter, KeyObjectVector &objs, const StorageLayout &sl)
static r_Point computeNormalizedPoint(const r_Point &toNormalize, const r_Point &tileConfigExtent, const r_Point &mddDomainOrigin)
Definition: point.hh:59
std::vector< KeyObject > KeyObjectVector
Definition: lists.h:79
Definition: indexds.hh:51
static r_Minterval computeTiledDomain(const r_Minterval &completeDomain, const r_Point &tileConfigExtent, const r_Minterval &widenMe)
Definition: keyobject.hh:43
Definition: oidif.hh:67
static bool removeObject(IndexDS *theIx, const KeyObject &tileToRemove, const StorageLayout &sl)
static void containPointQuery(const IndexDS *theIx, const r_Point &searchPoint, KeyObject &result, const StorageLayout &sl)
int OIdCounter
Definition: oidif.hh:96
OIdType
Definition: oidif.hh:70
static void getObjects(const IndexDS *ixDS, KeyObjectVector &objs, const StorageLayout &sl)
static OId computeOId(const r_Minterval &mddDomain, const r_Point &tileConfigExtent, OId::OIdCounter baseCounter, OId::OIdType type, const r_Point &tileOrigin)
static bool insertObject(IndexDS *theIx, const KeyObject &newObject, const StorageLayout &sl)
Definition: sstoragelayout.hh:65
static unsigned int computeNumberOfTiles(const StorageLayout &sl, const r_Minterval &mddDomain)
Definition: minterval.hh:249
static r_Minterval computeDomain(const r_Point &toConvert, const r_Point &tileConfigExtent, const r_Point &mddDomainOrigin)