00001 /****************************************************************************** 00002 * $Id: ogr_attrind.h,v 1.4 2003/12/03 15:11:05 warmerda Exp $ 00003 * 00004 * Project: OpenGIS Simple Features Reference Implementation 00005 * Purpose: Classes related to generic implementation of attribute indexing. 00006 * Author: Frank Warmerdam, warmerdam@pobox.com 00007 * 00008 ****************************************************************************** 00009 * Copyright (c) 2003, Frank Warmerdam <warmerdam@pobox.com> 00010 * 00011 * Permission is hereby granted, free of charge, to any person obtaining a 00012 * copy of this software and associated documentation files (the "Software"), 00013 * to deal in the Software without restriction, including without limitation 00014 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 00015 * and/or sell copies of the Software, and to permit persons to whom the 00016 * Software is furnished to do so, subject to the following conditions: 00017 * 00018 * The above copyright notice and this permission notice shall be included 00019 * in all copies or substantial portions of the Software. 00020 * 00021 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00022 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00023 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 00024 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00025 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 00026 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 00027 * DEALINGS IN THE SOFTWARE. 00028 ****************************************************************************** 00029 * 00030 * $Log: ogr_attrind.h,v $ 00031 * Revision 1.4 2003/12/03 15:11:05 warmerda 00032 * added iField to IndexAllFeature, and default to -1 00033 * 00034 * Revision 1.3 2003/03/21 02:58:00 warmerda 00035 * added drop index support 00036 * 00037 * Revision 1.2 2003/03/07 18:24:12 warmerda 00038 * expand tabs 00039 * 00040 * Revision 1.1 2003/03/04 14:16:10 warmerda 00041 * New 00042 * 00043 */ 00044 00045 #ifndef _OGR_ATTRIND_H_INCLUDED 00046 #define _OGR_ATTRIND_H_INCLUDED 00047 00048 #include "ogrsf_frmts.h" 00049 00050 /************************************************************************/ 00051 /* OGRAttrIndex */ 00052 /* */ 00053 /* Base class for accessing the indexing info about one field. */ 00054 /************************************************************************/ 00055 00056 class CPL_DLL OGRAttrIndex 00057 { 00058 protected: 00059 OGRAttrIndex(); 00060 00061 public: 00062 virtual ~OGRAttrIndex(); 00063 00064 virtual long GetFirstMatch( OGRField *psKey ) = 0; 00065 virtual long *GetAllMatches( OGRField *psKey ) = 0; 00066 00067 virtual OGRErr AddEntry( OGRField *psKey, long nFID ) = 0; 00068 virtual OGRErr RemoveEntry( OGRField *psKey, long nFID ) = 0; 00069 00070 virtual OGRErr Clear() = 0; 00071 }; 00072 00073 /************************************************************************/ 00074 /* OGRLayerAttrIndex */ 00075 /* */ 00076 /* Base class representing attribute indexes for all indexed */ 00077 /* fields in a layer. */ 00078 /************************************************************************/ 00079 00080 class CPL_DLL OGRLayerAttrIndex 00081 { 00082 protected: 00083 OGRLayer *poLayer; 00084 char *pszIndexPath; 00085 00086 OGRLayerAttrIndex(); 00087 00088 public: 00089 virtual ~OGRLayerAttrIndex(); 00090 00091 virtual OGRErr Initialize( const char *pszIndexPath, OGRLayer * ) = 0; 00092 00093 virtual OGRErr CreateIndex( int iField ) = 0; 00094 virtual OGRErr DropIndex( int iField ) = 0; 00095 virtual OGRErr IndexAllFeatures( int iField = -1 ) = 0; 00096 00097 virtual OGRErr AddToIndex( OGRFeature *poFeature, int iField = -1 ) = 0; 00098 virtual OGRErr RemoveFromIndex( OGRFeature *poFeature ) = 0; 00099 00100 virtual OGRAttrIndex *GetFieldIndex( int iField ) = 0; 00101 }; 00102 00103 OGRLayerAttrIndex CPL_DLL *OGRCreateDefaultLayerIndex(); 00104 00105 00106 #endif /* ndef _OGR_ATTRIND_H_INCLUDED */ 00107