Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
wine-mirror
GitHub Repository: wine-mirror/wine
Path: blob/master/libs/tiff/libtiff/tif_hash_set.h
4391 views
1
/**********************************************************************
2
* $Id$
3
*
4
* Name: tif_hash_set.h
5
* Project: TIFF - Common Portability Library
6
* Purpose: Hash set functions.
7
* Author: Even Rouault, <even dot rouault at spatialys.com>
8
*
9
**********************************************************************
10
* Copyright (c) 2008-2009, Even Rouault <even dot rouault at spatialys.com>
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 TIFF_HASH_SET_H_INCLUDED
32
#define TIFF_HASH_SET_H_INCLUDED
33
34
#include <stdbool.h>
35
36
/**
37
* \file tif_hash_set.h
38
*
39
* Hash set implementation.
40
*
41
* An hash set is a data structure that holds elements that are unique
42
* according to a comparison function. Operations on the hash set, such as
43
* insertion, removal or lookup, are supposed to be fast if an efficient
44
* "hash" function is provided.
45
*/
46
47
#ifdef __cplusplus
48
extern "C"
49
{
50
#endif
51
52
/* Types */
53
54
/** Opaque type for a hash set */
55
typedef struct _TIFFHashSet TIFFHashSet;
56
57
/** TIFFHashSetHashFunc */
58
typedef unsigned long (*TIFFHashSetHashFunc)(const void *elt);
59
60
/** TIFFHashSetEqualFunc */
61
typedef bool (*TIFFHashSetEqualFunc)(const void *elt1, const void *elt2);
62
63
/** TIFFHashSetFreeEltFunc */
64
typedef void (*TIFFHashSetFreeEltFunc)(void *elt);
65
66
/* Functions */
67
68
TIFFHashSet *TIFFHashSetNew(TIFFHashSetHashFunc fnHashFunc,
69
TIFFHashSetEqualFunc fnEqualFunc,
70
TIFFHashSetFreeEltFunc fnFreeEltFunc);
71
72
void TIFFHashSetDestroy(TIFFHashSet *set);
73
74
int TIFFHashSetSize(const TIFFHashSet *set);
75
76
#ifdef notused
77
void TIFFHashSetClear(TIFFHashSet *set);
78
79
/** TIFFHashSetIterEltFunc */
80
typedef int (*TIFFHashSetIterEltFunc)(void *elt, void *user_data);
81
82
void TIFFHashSetForeach(TIFFHashSet *set, TIFFHashSetIterEltFunc fnIterFunc,
83
void *user_data);
84
#endif
85
86
bool TIFFHashSetInsert(TIFFHashSet *set, void *elt);
87
88
void *TIFFHashSetLookup(TIFFHashSet *set, const void *elt);
89
90
bool TIFFHashSetRemove(TIFFHashSet *set, const void *elt);
91
92
#ifdef notused
93
bool TIFFHashSetRemoveDeferRehash(TIFFHashSet *set, const void *elt);
94
#endif
95
96
#ifdef __cplusplus
97
}
98
#endif
99
100
#endif /* TIFF_HASH_SET_H_INCLUDED */
101
102