ogr_attrind.h

00001 /******************************************************************************
00002  * $Id: ogr_attrind.h 20101 2010-07-18 15:20:35Z tamas $
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 #ifndef _OGR_ATTRIND_H_INCLUDED
00031 #define _OGR_ATTRIND_H_INCLUDED
00032 
00033 #include "ogrsf_frmts.h"
00034 
00035 /************************************************************************/
00036 /*                             OGRAttrIndex                             */
00037 /*                                                                      */
00038 /*      Base class for accessing the indexing info about one field.     */
00039 /************************************************************************/
00040 
00041 class CPL_DLL OGRAttrIndex
00042 {
00043 protected:
00044                 OGRAttrIndex();
00045 
00046 public:
00047     virtual     ~OGRAttrIndex();
00048 
00049     virtual long   GetFirstMatch( OGRField *psKey ) = 0;
00050     virtual long  *GetAllMatches( OGRField *psKey ) = 0;
00051     virtual long  *GetAllMatches( OGRField *psKey, long* panFIDList, int* nFIDCount, int* nLength ) = 0;
00052     
00053     virtual OGRErr AddEntry( OGRField *psKey, long nFID ) = 0;
00054     virtual OGRErr RemoveEntry( OGRField *psKey, long nFID ) = 0;
00055 
00056     virtual OGRErr Clear() = 0;
00057 };
00058 
00059 /************************************************************************/
00060 /*                          OGRLayerAttrIndex                           */
00061 /*                                                                      */
00062 /*      Base class representing attribute indexes for all indexed       */
00063 /*      fields in a layer.                                              */
00064 /************************************************************************/
00065 
00066 class CPL_DLL OGRLayerAttrIndex
00067 {
00068 protected:
00069     OGRLayer    *poLayer;
00070     char        *pszIndexPath;
00071 
00072                 OGRLayerAttrIndex();
00073 
00074 public:
00075     virtual     ~OGRLayerAttrIndex();
00076 
00077     virtual OGRErr Initialize( const char *pszIndexPath, OGRLayer * ) = 0;
00078 
00079     virtual OGRErr CreateIndex( int iField ) = 0;
00080     virtual OGRErr DropIndex( int iField ) = 0;
00081     virtual OGRErr IndexAllFeatures( int iField = -1 ) = 0;
00082 
00083     virtual OGRErr AddToIndex( OGRFeature *poFeature, int iField = -1 ) = 0;
00084     virtual OGRErr RemoveFromIndex( OGRFeature *poFeature ) = 0;
00085 
00086     virtual OGRAttrIndex *GetFieldIndex( int iField ) = 0;
00087 };
00088 
00089 OGRLayerAttrIndex CPL_DLL *OGRCreateDefaultLayerIndex();
00090 
00091 
00092 #endif /* ndef _OGR_ATTRIND_H_INCLUDED */
00093 

Generated for GDAL by doxygen 1.7.1.