LibTIFF 4.7.2
TIFF library public API and implementation reference
Loading...
Searching...
No Matches
tif_hash_set.h
Go to the documentation of this file.
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
41#ifndef TIFF_HASH_SET_H_INCLUDED
42#define TIFF_HASH_SET_H_INCLUDED
43
44#include <stdbool.h>
45
46struct tiff;
47
48#ifdef __cplusplus
49extern "C"
50{
51#endif
52
53 /* Types */
54
63 typedef struct _TIFFHashSet TIFFHashSet;
64
78 typedef unsigned long (*TIFFHashSetHashFunc)(const void *elt);
79
93 typedef bool (*TIFFHashSetEqualFunc)(const void *elt1, const void *elt2);
94
111 typedef void (*TIFFHashSetFreeEltFunc)(struct tiff *tif, void *elt);
112
113 /* Functions */
114
142 TIFFHashSet *TIFFHashSetNew(struct tiff *tif,
143 TIFFHashSetHashFunc fnHashFunc,
144 TIFFHashSetEqualFunc fnEqualFunc,
145 TIFFHashSetFreeEltFunc fnFreeEltFunc);
146
160
172 int TIFFHashSetSize(const TIFFHashSet *set);
173
174#ifdef notused
188 void TIFFHashSetClear(TIFFHashSet *set);
189
203 typedef int (*TIFFHashSetIterEltFunc)(void *elt, void *user_data);
204
221 void TIFFHashSetForeach(TIFFHashSet *set, TIFFHashSetIterEltFunc fnIterFunc,
222 void *user_data);
223#endif
224
250 bool TIFFHashSetInsert(TIFFHashSet *set, void *elt);
251
268 void *TIFFHashSetLookup(TIFFHashSet *set, const void *elt);
269
288 bool TIFFHashSetRemove(TIFFHashSet *set, const void *elt);
289
290#ifdef notused
308 bool TIFFHashSetRemoveDeferRehash(TIFFHashSet *set, const void *elt);
309#endif
310
311#ifdef __cplusplus
312}
313#endif
314
315#endif /* TIFF_HASH_SET_H_INCLUDED */
bool(* TIFFHashSetEqualFunc)(const void *elt1, const void *elt2)
Test whether a stored element matches another element or key.
void * TIFFHashSetLookup(TIFFHashSet *set, const void *elt)
Find a borrowed stored element matching a key.
bool TIFFHashSetInsert(TIFFHashSet *set, void *elt)
Insert an element or replace an equal element.
bool TIFFHashSetRemove(TIFFHashSet *set, const void *elt)
Remove a matching element, disposing it if configured.
int TIFFHashSetSize(const TIFFHashSet *set)
Return the current live-element count.
void(* TIFFHashSetFreeEltFunc)(struct tiff *tif, void *elt)
Dispose of an element according to the set's ownership policy.
void TIFFHashSetDestroy(TIFFHashSet *set)
Release a hash set and dispose its live elements if configured.
unsigned long(* TIFFHashSetHashFunc)(const void *elt)
Compute an element hash without changing its key.
TIFFHashSet * TIFFHashSetNew(struct tiff *tif, TIFFHashSetHashFunc fnHashFunc, TIFFHashSetEqualFunc fnEqualFunc, TIFFHashSetFreeEltFunc fnFreeEltFunc)
Allocate an empty hash set with optional ownership callbacks.
Own bucket/node storage and record callback-defined element policy.
Hold private state for one open TIFF library instance.
Definition tiffiop.h:389