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 * SPDX-License-Identifier: MIT
12 ****************************************************************************/
13
14#ifndef OGR_ATTRIND_H_INCLUDED
15#define OGR_ATTRIND_H_INCLUDED
16
17#include "ogrsf_frmts.h"
18
20
21/************************************************************************/
22/* OGRAttrIndex */
23/* */
24/* Base class for accessing the indexing info about one field. */
25/************************************************************************/
26
27class CPL_DLL OGRAttrIndex
28{
29 protected:
30 OGRAttrIndex();
31
32 public:
33 virtual ~OGRAttrIndex();
34
35 virtual GIntBig GetFirstMatch(OGRField *psKey) = 0;
36 virtual GIntBig *GetAllMatches(OGRField *psKey) = 0;
37 virtual GIntBig *GetAllMatches(OGRField *psKey, GIntBig *panFIDList,
38 int *nFIDCount, int *nLength) = 0;
39
40 virtual OGRErr AddEntry(OGRField *psKey, GIntBig nFID) = 0;
41 virtual OGRErr RemoveEntry(OGRField *psKey, GIntBig nFID) = 0;
42
43 virtual OGRErr Clear() = 0;
44};
45
46/************************************************************************/
47/* OGRLayerAttrIndex */
48/* */
49/* Base class representing attribute indexes for all indexed */
50/* fields in a layer. */
51/************************************************************************/
52
53class CPL_DLL OGRLayerAttrIndex
54{
55 protected:
56 OGRLayer *poLayer;
57 char *pszIndexPath;
58
59 OGRLayerAttrIndex();
60 CPL_DISALLOW_COPY_ASSIGN(OGRLayerAttrIndex)
61
62 public:
63 virtual ~OGRLayerAttrIndex();
64
65 virtual OGRErr Initialize(const char *pszIndexPath, OGRLayer *) = 0;
66
67 virtual OGRErr CreateIndex(int iField) = 0;
68 virtual OGRErr DropIndex(int iField) = 0;
69 virtual OGRErr IndexAllFeatures(int iField = -1) = 0;
70
71 virtual OGRErr AddToIndex(OGRFeature *poFeature, int iField = -1) = 0;
72 virtual OGRErr RemoveFromIndex(OGRFeature *poFeature) = 0;
73
74 virtual OGRAttrIndex *GetFieldIndex(int iField) = 0;
75};
76
77OGRLayerAttrIndex CPL_DLL *OGRCreateDefaultLayerIndex();
78
80
81#endif /* ndef OGR_ATTRIND_H_INCLUDED */
A simple feature, including geometry and attributes.
Definition: ogr_feature.h:877
This class represents a layer of simple features, with access methods.
Definition: ogrsf_frmts.h:58
#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:1030
long long GIntBig
Large signed integer type (generally 64-bit integer type).
Definition: cpl_port.h:199
int OGRErr
Type for a OGR error.
Definition: ogr_core.h:371
Classes related to registration of format support, and opening datasets.
OGRFeature field attribute value union.
Definition: ogr_core.h:905