GDAL
|
00001 /********************************************************************** 00002 * $Id: cpl_hash_set.h 16029 2009-01-01 19:32:39Z rouault $ 00003 * 00004 * Name: cpl_hash_set.h 00005 * Project: CPL - Common Portability Library 00006 * Purpose: Hash set functions. 00007 * Author: Even Rouault, <even dot rouault at mines dash paris dot org> 00008 * 00009 ********************************************************************** 00010 * Copyright (c) 2008, Even Rouault, <even dot rouault at mines dash paris dot org> 00011 * 00012 * Permission is hereby granted, free of charge, to any person obtaining a 00013 * copy of this software and associated documentation files (the "Software"), 00014 * to deal in the Software without restriction, including without limitation 00015 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 00016 * and/or sell copies of the Software, and to permit persons to whom the 00017 * Software is furnished to do so, subject to the following conditions: 00018 * 00019 * The above copyright notice and this permission notice shall be included 00020 * in all copies or substantial portions of the Software. 00021 * 00022 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00023 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00024 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 00025 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00026 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 00027 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 00028 * DEALINGS IN THE SOFTWARE. 00029 ****************************************************************************/ 00030 00031 #ifndef _CPL_HASH_SET_H_INCLUDED 00032 #define _CPL_HASH_SET_H_INCLUDED 00033 00034 #include "cpl_port.h" 00035 00047 CPL_C_START 00048 00049 /* Types */ 00050 00051 typedef struct _CPLHashSet CPLHashSet; 00052 00053 typedef unsigned long (*CPLHashSetHashFunc)(const void* elt); 00054 00055 typedef int (*CPLHashSetEqualFunc)(const void* elt1, const void* elt2); 00056 00057 typedef void (*CPLHashSetFreeEltFunc)(void* elt); 00058 00059 typedef int (*CPLHashSetIterEltFunc)(void* elt, void* user_data); 00060 00061 /* Functions */ 00062 00063 CPLHashSet CPL_DLL * CPLHashSetNew(CPLHashSetHashFunc fnHashFunc, 00064 CPLHashSetEqualFunc fnEqualFunc, 00065 CPLHashSetFreeEltFunc fnFreeEltFunc); 00066 00067 void CPL_DLL CPLHashSetDestroy(CPLHashSet* set); 00068 00069 int CPL_DLL CPLHashSetSize(const CPLHashSet* set); 00070 00071 void CPL_DLL CPLHashSetForeach(CPLHashSet* set, 00072 CPLHashSetIterEltFunc fnIterFunc, 00073 void* user_data); 00074 00075 int CPL_DLL CPLHashSetInsert(CPLHashSet* set, void* elt); 00076 00077 void CPL_DLL * CPLHashSetLookup(CPLHashSet* set, const void* elt); 00078 00079 int CPL_DLL CPLHashSetRemove(CPLHashSet* set, const void* elt); 00080 00081 unsigned long CPL_DLL CPLHashSetHashPointer(const void* elt); 00082 00083 int CPL_DLL CPLHashSetEqualPointer(const void* elt1, const void* elt2); 00084 00085 unsigned long CPL_DLL CPLHashSetHashStr(const void * pszStr); 00086 00087 int CPL_DLL CPLHashSetEqualStr(const void* pszStr1, const void* pszStr2); 00088 00089 CPL_C_END 00090 00091 #endif /* _CPL_HASH_SET_H_INCLUDED */ 00092