SDTS_AL
cpl_hash_set.h
Go to the documentation of this file.
1 /**********************************************************************
2  * $Id: cpl_hash_set.h 34931 2016-08-05 17:13:05Z rouault $
3  *
4  * Name: cpl_hash_set.h
5  * Project: CPL - Common Portability Library
6  * Purpose: Hash set functions.
7  * Author: Even Rouault, <even dot rouault at mines dash paris dot org>
8  *
9  **********************************************************************
10  * Copyright (c) 2008-2009, Even Rouault <even dot rouault at mines-paris dot org>
11  *
12  * Permission is hereby granted, free of charge, to any person obtaining a
13  * copy of this software and associated documentation files (the "Software"),
14  * to deal in the Software without restriction, including without limitation
15  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
16  * and/or sell copies of the Software, and to permit persons to whom the
17  * Software is furnished to do so, subject to the following conditions:
18  *
19  * The above copyright notice and this permission notice shall be included
20  * in all copies or substantial portions of the Software.
21  *
22  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
25  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
27  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
28  * DEALINGS IN THE SOFTWARE.
29  ****************************************************************************/
30 
31 #ifndef CPL_HASH_SET_H_INCLUDED
32 #define CPL_HASH_SET_H_INCLUDED
33 
34 #include "cpl_port.h"
35 
47 CPL_C_START
48 
49 /* Types */
50 
52 typedef struct _CPLHashSet CPLHashSet;
53 
55 typedef unsigned long (*CPLHashSetHashFunc)(const void* elt);
56 
58 typedef int (*CPLHashSetEqualFunc)(const void* elt1, const void* elt2);
59 
61 typedef void (*CPLHashSetFreeEltFunc)(void* elt);
62 
64 typedef int (*CPLHashSetIterEltFunc)(void* elt, void* user_data);
65 
66 /* Functions */
67 
68 CPLHashSet CPL_DLL * CPLHashSetNew(CPLHashSetHashFunc fnHashFunc,
69  CPLHashSetEqualFunc fnEqualFunc,
70  CPLHashSetFreeEltFunc fnFreeEltFunc);
71 
72 void CPL_DLL CPLHashSetDestroy(CPLHashSet* set);
73 
74 void CPL_DLL CPLHashSetClear(CPLHashSet* set);
75 
76 int CPL_DLL CPLHashSetSize(const CPLHashSet* set);
77 
78 void CPL_DLL CPLHashSetForeach(CPLHashSet* set,
79  CPLHashSetIterEltFunc fnIterFunc,
80  void* user_data);
81 
82 int CPL_DLL CPLHashSetInsert(CPLHashSet* set, void* elt);
83 
84 void CPL_DLL * CPLHashSetLookup(CPLHashSet* set, const void* elt);
85 
86 int CPL_DLL CPLHashSetRemove(CPLHashSet* set, const void* elt);
87 int CPL_DLL CPLHashSetRemoveDeferRehash(CPLHashSet* set, const void* elt);
88 
89 unsigned long CPL_DLL CPLHashSetHashPointer(const void* elt);
90 
91 int CPL_DLL CPLHashSetEqualPointer(const void* elt1, const void* elt2);
92 
93 unsigned long CPL_DLL CPLHashSetHashStr(const void * pszStr);
94 
95 int CPL_DLL CPLHashSetEqualStr(const void* pszStr1, const void* pszStr2);
96 
97 CPL_C_END
98 
99 #endif /* CPL_HASH_SET_H_INCLUDED */
int CPL_DLL CPLHashSetSize(const CPLHashSet *set)
Definition: cpl_hash_set.cpp:126
unsigned long CPL_DLL CPLHashSetHashStr(const void *pszStr)
Definition: cpl_hash_set.cpp:550
void CPL_DLL CPLHashSetClear(CPLHashSet *set)
Definition: cpl_hash_set.cpp:229
int CPL_DLL CPLHashSetEqualStr(const void *pszStr1, const void *pszStr2)
Definition: cpl_hash_set.cpp:578
CPLHashSet CPL_DLL * CPLHashSetNew(CPLHashSetHashFunc fnHashFunc, CPLHashSetEqualFunc fnEqualFunc, CPLHashSetFreeEltFunc fnFreeEltFunc)
Definition: cpl_hash_set.cpp:91
Definition: cpl_hash_set.cpp:40
void CPL_DLL CPLHashSetForeach(CPLHashSet *set, CPLHashSetIterEltFunc fnIterFunc, void *user_data)
Definition: cpl_hash_set.cpp:262
int CPL_DLL CPLHashSetRemoveDeferRehash(CPLHashSet *set, const void *elt)
Definition: cpl_hash_set.cpp:497
void CPL_DLL CPLHashSetDestroy(CPLHashSet *set)
Definition: cpl_hash_set.cpp:207
void CPL_DLL * CPLHashSetLookup(CPLHashSet *set, const void *elt)
Definition: cpl_hash_set.cpp:405
int CPL_DLL CPLHashSetEqualPointer(const void *elt1, const void *elt2)
Definition: cpl_hash_set.cpp:533
unsigned long(* CPLHashSetHashFunc)(const void *elt)
Definition: cpl_hash_set.h:55
int CPL_DLL CPLHashSetInsert(CPLHashSet *set, void *elt)
Definition: cpl_hash_set.cpp:355
unsigned long CPL_DLL CPLHashSetHashPointer(const void *elt)
Definition: cpl_hash_set.cpp:514
void(* CPLHashSetFreeEltFunc)(void *elt)
Definition: cpl_hash_set.h:61
typedefCPL_C_START struct _CPLHashSet CPLHashSet
Definition: cpl_hash_set.h:52
int CPL_DLL CPLHashSetRemove(CPLHashSet *set, const void *elt)
Definition: cpl_hash_set.cpp:475
int(* CPLHashSetIterEltFunc)(void *elt, void *user_data)
Definition: cpl_hash_set.h:64
int(* CPLHashSetEqualFunc)(const void *elt1, const void *elt2)
Definition: cpl_hash_set.h:58