GDAL

ogr_attrind.h
1 /******************************************************************************
2 * $Id$
3 *
4 * Project: OpenGIS Simple Features Reference Implementation
5 * Purpose: Classes related to generic implementation of attribute indexing.
6 * Author: Frank Warmerdam, warmerdam@pobox.com
7 *
8 ******************************************************************************
9 * Copyright (c) 2003, Frank Warmerdam <warmerdam@pobox.com>
10 *
11 * Permission is hereby granted, free of charge, to any person obtaining a
12 * copy of this software and associated documentation files (the "Software"),
13 * to deal in the Software without restriction, including without limitation
14 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
15 * and/or sell copies of the Software, and to permit persons to whom the
16 * Software is furnished to do so, subject to the following conditions:
17 *
18 * The above copyright notice and this permission notice shall be included
19 * in all copies or substantial portions of the Software.
20 *
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
22 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
24 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27 * DEALINGS IN THE SOFTWARE.
28 ****************************************************************************/
29
30 #ifndef OGR_ATTRIND_H_INCLUDED
31 #define OGR_ATTRIND_H_INCLUDED
32
33 #include "ogrsf_frmts.h"
34
36
37 /************************************************************************/
38 /* OGRAttrIndex */
39 /* */
40 /* Base class for accessing the indexing info about one field. */
41 /************************************************************************/
42
43 class CPL_DLL OGRAttrIndex
44 {
45 protected:
46 OGRAttrIndex();
47
48 public:
49 virtual ~OGRAttrIndex();
50
51 virtual GIntBig GetFirstMatch( OGRField *psKey ) = 0;
52 virtual GIntBig *GetAllMatches( OGRField *psKey ) = 0;
53 virtual GIntBig *GetAllMatches( OGRField *psKey, GIntBig* panFIDList, int* nFIDCount, int* nLength ) = 0;
54
55 virtual OGRErr AddEntry( OGRField *psKey, GIntBig nFID ) = 0;
56 virtual OGRErr RemoveEntry( OGRField *psKey, GIntBig nFID ) = 0;
57
58 virtual OGRErr Clear() = 0;
59 };
60
61 /************************************************************************/
62 /* OGRLayerAttrIndex */
63 /* */
64 /* Base class representing attribute indexes for all indexed */
65 /* fields in a layer. */
66 /************************************************************************/
67
68 class CPL_DLL OGRLayerAttrIndex
69 {
70 protected:
71 OGRLayer *poLayer;
72 char *pszIndexPath;
73
74 OGRLayerAttrIndex();
75 CPL_DISALLOW_COPY_ASSIGN(OGRLayerAttrIndex)
76
77 public:
78 virtual ~OGRLayerAttrIndex();
79
80 virtual OGRErr Initialize( const char *pszIndexPath, OGRLayer * ) = 0;
81
82 virtual OGRErr CreateIndex( int iField ) = 0;
83 virtual OGRErr DropIndex( int iField ) = 0;
84 virtual OGRErr IndexAllFeatures( int iField = -1 ) = 0;
85
86 virtual OGRErr AddToIndex( OGRFeature *poFeature, int iField = -1 ) = 0;
87 virtual OGRErr RemoveFromIndex( OGRFeature *poFeature ) = 0;
88
89 virtual OGRAttrIndex *GetFieldIndex( int iField ) = 0;
90 };
91
92 OGRLayerAttrIndex CPL_DLL *OGRCreateDefaultLayerIndex();
93
95
96 #endif /* ndef OGR_ATTRIND_H_INCLUDED */
97
OGRFeature
A simple feature, including geometry and attributes.
Definition: ogr_feature.h:374
OGRLayer
This class represents a layer of simple features, with access methods.
Definition: ogrsf_frmts.h:71
CPL_DISALLOW_COPY_ASSIGN
#define CPL_DISALLOW_COPY_ASSIGN(ClassName)
Helper to remove the copy and assignment constructors so that the compiler will not generate the defa...
Definition: cpl_port.h:1007
GIntBig
long long GIntBig
Large signed integer type (generally 64-bit integer type).
Definition: cpl_port.h:248
OGRErr
int OGRErr
Type for a OGR error.
Definition: ogr_core.h:318
ogrsf_frmts.h
Classes related to registration of format support, and opening datasets.
OGRField
OGRFeature field attribute value union.
Definition: ogr_core.h:738