GDAL

- Main Page
- Related Pages
- Classes
- Files

- File List
- File Members

cpl_hash_set.h
Go to the documentation of this file.
1 /**********************************************************************
2 * $Id: cpl_hash_set.h 33666 2016-03-07 05:21:07Z goatbar $
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
51 typedef struct _CPLHashSet CPLHashSet;
52
53 typedef unsigned long (*CPLHashSetHashFunc)(const void* elt);
54
55 typedef int (*CPLHashSetEqualFunc)(const void* elt1, const void* elt2);
56
57 typedef void (*CPLHashSetFreeEltFunc)(void* elt);
58
59 typedef int (*CPLHashSetIterEltFunc)(void* elt, void* user_data);
60
61 /* Functions */
62
63 CPLHashSet CPL_DLL * CPLHashSetNew(CPLHashSetHashFunc fnHashFunc,
64 CPLHashSetEqualFunc fnEqualFunc,
65 CPLHashSetFreeEltFunc fnFreeEltFunc);
66
67 void CPL_DLL CPLHashSetDestroy(CPLHashSet* set);
68
69 void CPL_DLL CPLHashSetClear(CPLHashSet* set);
70
71 int CPL_DLL CPLHashSetSize(const CPLHashSet* set);
72
73 void CPL_DLL CPLHashSetForeach(CPLHashSet* set,
74 CPLHashSetIterEltFunc fnIterFunc,
75 void* user_data);
76
77 int CPL_DLL CPLHashSetInsert(CPLHashSet* set, void* elt);
78
79 void CPL_DLL * CPLHashSetLookup(CPLHashSet* set, const void* elt);
80
81 int CPL_DLL CPLHashSetRemove(CPLHashSet* set, const void* elt);
82 int CPL_DLL CPLHashSetRemoveDeferRehash(CPLHashSet* set, const void* elt);
83
84 unsigned long CPL_DLL CPLHashSetHashPointer(const void* elt);
85
86 int CPL_DLL CPLHashSetEqualPointer(const void* elt1, const void* elt2);
87
88 unsigned long CPL_DLL CPLHashSetHashStr(const void * pszStr);
89
90 int CPL_DLL CPLHashSetEqualStr(const void* pszStr1, const void* pszStr2);
91
92 CPL_C_END
93
94 #endif /* CPL_HASH_SET_H_INCLUDED */
CPLHashSetRemove
int CPLHashSetRemove(CPLHashSet *set, const void *elt)
Removes an element from a hash set.
Definition: cpl_hash_set.cpp:464
CPLHashSetEqualPointer
int CPLHashSetEqualPointer(const void *elt1, const void *elt2)
Equality function for arbitrary pointers.
Definition: cpl_hash_set.cpp:521
cpl_port.h
Core portability definitions for CPL.
CPLHashSetEqualStr
int CPLHashSetEqualStr(const void *pszStr1, const void *pszStr2)
Equality function for strings.
Definition: cpl_hash_set.cpp:566
CPLHashSetHashPointer
unsigned long CPLHashSetHashPointer(const void *elt)
Hash function for an arbitrary pointer.
Definition: cpl_hash_set.cpp:503
CPLHashSetDestroy
void CPLHashSetDestroy(CPLHashSet *set)
Destroys an allocated hash set.
Definition: cpl_hash_set.cpp:200
CPLHashSetLookup
void * CPLHashSetLookup(CPLHashSet *set, const void *elt)
Returns the element found in the hash set corresponding to the element to look up The element must no...
Definition: cpl_hash_set.cpp:394
CPLHashSetForeach
void CPLHashSetForeach(CPLHashSet *set, CPLHashSetIterEltFunc fnIterFunc, void *user_data)
Walk through the hash set and runs the provided function on all the elements.
Definition: cpl_hash_set.cpp:255
CPLHashSetRemoveDeferRehash
int CPLHashSetRemoveDeferRehash(CPLHashSet *set, const void *elt)
Removes an element from a hash set.
Definition: cpl_hash_set.cpp:486
CPLHashSetNew
CPLHashSet * CPLHashSetNew(CPLHashSetHashFunc fnHashFunc, CPLHashSetEqualFunc fnEqualFunc, CPLHashSetFreeEltFunc fnFreeEltFunc)
Creates a new hash set.
Definition: cpl_hash_set.cpp:83
CPLHashSetSize
int CPLHashSetSize(const CPLHashSet *set)
Returns the number of elements inserted in the hash set.
Definition: cpl_hash_set.cpp:119
CPLHashSetHashStr
unsigned long CPLHashSetHashStr(const void *pszStr)
Hash function for a zero-terminated string.
Definition: cpl_hash_set.cpp:538
CPLHashSetInsert
int CPLHashSetInsert(CPLHashSet *set, void *elt)
Inserts an element into a hash set.
Definition: cpl_hash_set.cpp:345
CPLHashSetClear
void CPLHashSetClear(CPLHashSet *set)
Clear all elements from a hash set.
Definition: cpl_hash_set.cpp:222

Generated for GDAL by 1.8.8.