/**********************************************************************1* $Id$2*3* Name: tif_hash_set.h4* Project: TIFF - Common Portability Library5* Purpose: Hash set functions.6* Author: Even Rouault, <even dot rouault at spatialys.com>7*8**********************************************************************9* Copyright (c) 2008-2009, Even Rouault <even dot rouault at spatialys.com>10*11* Permission is hereby granted, free of charge, to any person obtaining a12* copy of this software and associated documentation files (the "Software"),13* to deal in the Software without restriction, including without limitation14* the rights to use, copy, modify, merge, publish, distribute, sublicense,15* and/or sell copies of the Software, and to permit persons to whom the16* Software is furnished to do so, subject to the following conditions:17*18* The above copyright notice and this permission notice shall be included19* in all copies or substantial portions of the Software.20*21* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR22* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,23* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL24* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER25* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING26* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER27* DEALINGS IN THE SOFTWARE.28****************************************************************************/2930#ifndef TIFF_HASH_SET_H_INCLUDED31#define TIFF_HASH_SET_H_INCLUDED3233#include <stdbool.h>3435/**36* \file tif_hash_set.h37*38* Hash set implementation.39*40* An hash set is a data structure that holds elements that are unique41* according to a comparison function. Operations on the hash set, such as42* insertion, removal or lookup, are supposed to be fast if an efficient43* "hash" function is provided.44*/4546#ifdef __cplusplus47extern "C"48{49#endif5051/* Types */5253/** Opaque type for a hash set */54typedef struct _TIFFHashSet TIFFHashSet;5556/** TIFFHashSetHashFunc */57typedef unsigned long (*TIFFHashSetHashFunc)(const void *elt);5859/** TIFFHashSetEqualFunc */60typedef bool (*TIFFHashSetEqualFunc)(const void *elt1, const void *elt2);6162/** TIFFHashSetFreeEltFunc */63typedef void (*TIFFHashSetFreeEltFunc)(void *elt);6465/* Functions */6667TIFFHashSet *TIFFHashSetNew(TIFFHashSetHashFunc fnHashFunc,68TIFFHashSetEqualFunc fnEqualFunc,69TIFFHashSetFreeEltFunc fnFreeEltFunc);7071void TIFFHashSetDestroy(TIFFHashSet *set);7273int TIFFHashSetSize(const TIFFHashSet *set);7475#ifdef notused76void TIFFHashSetClear(TIFFHashSet *set);7778/** TIFFHashSetIterEltFunc */79typedef int (*TIFFHashSetIterEltFunc)(void *elt, void *user_data);8081void TIFFHashSetForeach(TIFFHashSet *set, TIFFHashSetIterEltFunc fnIterFunc,82void *user_data);83#endif8485bool TIFFHashSetInsert(TIFFHashSet *set, void *elt);8687void *TIFFHashSetLookup(TIFFHashSet *set, const void *elt);8889bool TIFFHashSetRemove(TIFFHashSet *set, const void *elt);9091#ifdef notused92bool TIFFHashSetRemoveDeferRehash(TIFFHashSet *set, const void *elt);93#endif9495#ifdef __cplusplus96}97#endif9899#endif /* TIFF_HASH_SET_H_INCLUDED */100101102