GDAL
cpl_hash_set.h
Go to the documentation of this file.
1/**********************************************************************
2 *
3 * Name: cpl_hash_set.h
4 * Project: CPL - Common Portability Library
5 * 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 * SPDX-License-Identifier: MIT
12 ****************************************************************************/
13
14#ifndef CPL_HASH_SET_H_INCLUDED
15#define CPL_HASH_SET_H_INCLUDED
16
17#include "cpl_port.h"
18
29
31
32/* Types */
33
35typedef struct _CPLHashSet CPLHashSet;
36
38typedef unsigned long (*CPLHashSetHashFunc)(const void *elt);
39
41typedef int (*CPLHashSetEqualFunc)(const void *elt1, const void *elt2);
42
44typedef void (*CPLHashSetFreeEltFunc)(void *elt);
45
47typedef int (*CPLHashSetIterEltFunc)(void *elt, void *user_data);
48
49/* Functions */
50
51CPLHashSet CPL_DLL *CPLHashSetNew(CPLHashSetHashFunc fnHashFunc,
52 CPLHashSetEqualFunc fnEqualFunc,
53 CPLHashSetFreeEltFunc fnFreeEltFunc);
54
55void CPL_DLL CPLHashSetDestroy(CPLHashSet *set);
56
57void CPL_DLL CPLHashSetClear(CPLHashSet *set);
58
59int CPL_DLL CPLHashSetSize(const CPLHashSet *set);
60
61void CPL_DLL CPLHashSetForeach(CPLHashSet *set,
62 CPLHashSetIterEltFunc fnIterFunc,
63 void *user_data);
64
65int CPL_DLL CPLHashSetInsert(CPLHashSet *set, void *elt);
66
67void CPL_DLL *CPLHashSetLookup(CPLHashSet *set, const void *elt);
68
69int CPL_DLL CPLHashSetRemove(CPLHashSet *set, const void *elt);
70int CPL_DLL CPLHashSetRemoveDeferRehash(CPLHashSet *set, const void *elt);
71
72unsigned long CPL_DLL CPLHashSetHashPointer(const void *elt);
73
74int CPL_DLL CPLHashSetEqualPointer(const void *elt1, const void *elt2);
75
76unsigned long CPL_DLL CPLHashSetHashStr(const void *pszStr);
77
78int CPL_DLL CPLHashSetEqualStr(const void *pszStr1, const void *pszStr2);
79
81
82#endif /* CPL_HASH_SET_H_INCLUDED */
unsigned long(*) CPLHashSetHashFunc(const void *elt)
CPLHashSetHashFunc.
Definition cpl_hash_set.h:38
struct _CPLHashSet CPLHashSet
Opaque type for a hash set.
Definition cpl_hash_set.h:35
int(*) CPLHashSetEqualFunc(const void *elt1, const void *elt2)
CPLHashSetEqualFunc.
Definition cpl_hash_set.h:41
void(*) CPLHashSetFreeEltFunc(void *elt)
CPLHashSetFreeEltFunc.
Definition cpl_hash_set.h:44
int(*) CPLHashSetIterEltFunc(void *elt, void *user_data)
CPLHashSetIterEltFunc.
Definition cpl_hash_set.h:47
Core portability definitions for CPL.
#define CPL_C_END
Macro to end a block of C symbols.
Definition cpl_port.h:279
#define CPL_C_START
Macro to start a block of C symbols.
Definition cpl_port.h:275