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,
54  int *nFIDCount, int *nLength) = 0;
55 
56  virtual OGRErr AddEntry(OGRField *psKey, GIntBig nFID) = 0;
57  virtual OGRErr RemoveEntry(OGRField *psKey, GIntBig nFID) = 0;
58 
59  virtual OGRErr Clear() = 0;
60 };
61 
62 /************************************************************************/
63 /* OGRLayerAttrIndex */
64 /* */
65 /* Base class representing attribute indexes for all indexed */
66 /* fields in a layer. */
67 /************************************************************************/
68 
69 class CPL_DLL OGRLayerAttrIndex
70 {
71  protected:
72  OGRLayer *poLayer;
73  char *pszIndexPath;
74 
75  OGRLayerAttrIndex();
76  CPL_DISALLOW_COPY_ASSIGN(OGRLayerAttrIndex)
77 
78  public:
79  virtual ~OGRLayerAttrIndex();
80 
81  virtual OGRErr Initialize(const char *pszIndexPath, OGRLayer *) = 0;
82 
83  virtual OGRErr CreateIndex(int iField) = 0;
84  virtual OGRErr DropIndex(int iField) = 0;
85  virtual OGRErr IndexAllFeatures(int iField = -1) = 0;
86 
87  virtual OGRErr AddToIndex(OGRFeature *poFeature, int iField = -1) = 0;
88  virtual OGRErr RemoveFromIndex(OGRFeature *poFeature) = 0;
89 
90  virtual OGRAttrIndex *GetFieldIndex(int iField) = 0;
91 };
92 
93 OGRLayerAttrIndex CPL_DLL *OGRCreateDefaultLayerIndex();
94 
96 
97 #endif /* ndef OGR_ATTRIND_H_INCLUDED */
A simple feature, including geometry and attributes.
Definition: ogr_feature.h:893
This class represents a layer of simple features, with access methods.
Definition: ogrsf_frmts.h:74
#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:1042
long long GIntBig
Large signed integer type (generally 64-bit integer type).
Definition: cpl_port.h:215
int OGRErr
Type for a OGR error.
Definition: ogr_core.h:387
Classes related to registration of format support, and opening datasets.
OGRFeature field attribute value union.
Definition: ogr_core.h:910