GDAL
ogr_attrind.h
1/******************************************************************************
2 *
3 * Project: OpenGIS Simple Features Reference Implementation
4 * Purpose: Classes related to generic implementation of attribute indexing.
5 * Author: Frank Warmerdam, warmerdam@pobox.com
6 *
7 ******************************************************************************
8 * Copyright (c) 2003, Frank Warmerdam <warmerdam@pobox.com>
9 *
10 * SPDX-License-Identifier: MIT
11 ****************************************************************************/
12
13#ifndef OGR_ATTRIND_H_INCLUDED
14#define OGR_ATTRIND_H_INCLUDED
15
16#include "ogrsf_frmts.h"
17
19
20/************************************************************************/
21/* OGRAttrIndex */
22/* */
23/* Base class for accessing the indexing info about one field. */
24/************************************************************************/
25
26class CPL_DLL OGRAttrIndex
27{
28 protected:
29 OGRAttrIndex();
30
31 public:
32 virtual ~OGRAttrIndex();
33
34 virtual GIntBig GetFirstMatch(OGRField *psKey) = 0;
35 virtual GIntBig *GetAllMatches(OGRField *psKey) = 0;
36 virtual GIntBig *GetAllMatches(OGRField *psKey, GIntBig *panFIDList,
37 int *nFIDCount, int *nLength) = 0;
38
39 virtual OGRErr AddEntry(OGRField *psKey, GIntBig nFID) = 0;
40 virtual OGRErr RemoveEntry(OGRField *psKey, GIntBig nFID) = 0;
41
42 virtual OGRErr Clear() = 0;
43};
44
45/************************************************************************/
46/* OGRLayerAttrIndex */
47/* */
48/* Base class representing attribute indexes for all indexed */
49/* fields in a layer. */
50/************************************************************************/
51
52class CPL_DLL OGRLayerAttrIndex
53{
54 protected:
55 OGRLayer *poLayer;
56 char *pszIndexPath;
57
58 OGRLayerAttrIndex();
59 CPL_DISALLOW_COPY_ASSIGN(OGRLayerAttrIndex)
60
61 public:
62 virtual ~OGRLayerAttrIndex();
63
64 virtual OGRErr Initialize(const char *pszIndexPath, OGRLayer *) = 0;
65
66 virtual OGRErr CreateIndex(int iField) = 0;
67 virtual OGRErr DropIndex(int iField) = 0;
68 virtual OGRErr IndexAllFeatures(int iField = -1) = 0;
69
70 virtual OGRErr AddToIndex(OGRFeature *poFeature, int iField = -1) = 0;
71 virtual OGRErr RemoveFromIndex(OGRFeature *poFeature) = 0;
72
73 virtual OGRAttrIndex *GetFieldIndex(int iField) = 0;
74};
75
76OGRLayerAttrIndex CPL_DLL *OGRCreateDefaultLayerIndex();
77
79
80#endif /* ndef OGR_ATTRIND_H_INCLUDED */
#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:936
long long GIntBig
Large signed integer type (generally 64-bit integer type).
Definition cpl_port.h:205
int OGRErr
Type for a OGR error.
Definition ogr_core.h:370
Classes related to registration of format support, and opening datasets.