dpx saving would fail if there was no float buffer, which is a problem
[plumiferos.git] / source / blender / blenlib / BLI_edgehash.h
blobd09fac6d64aa2f014c990f903a3e5b20f4c22b14
1 /**
2 * A general unordered 2-int pair hash table ADT
3 *
4 * $Id: BLI_edgehash.h 5183 2005-08-23 02:29:22Z zuster $
6 * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version. The Blender
12 * Foundation also sells licenses for use in proprietary software under
13 * the Blender License. See http://www.blender.org/BL/ for information
14 * about this.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software Foundation,
23 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
26 * All rights reserved.
28 * The Original Code is: none of this file.
30 * Contributor(s): Daniel Dunbar
32 * ***** END GPL/BL DUAL LICENSE BLOCK *****
35 #ifndef BLI_EDGEHASH_H
36 #define BLI_EDGEHASH_H
38 struct EdgeHash;
39 struct EdgeHashIterator;
40 typedef struct EdgeHash EdgeHash;
41 typedef struct EdgeHashIterator EdgeHashIterator;
43 typedef void (*EdgeHashFreeFP)(void *key);
45 EdgeHash* BLI_edgehash_new (void);
46 void BLI_edgehash_free (EdgeHash *eh, EdgeHashFreeFP valfreefp);
48 /* Insert edge (v0,v1) into hash with given value, does
49 * not check for duplicates.
51 void BLI_edgehash_insert (EdgeHash *eh, int v0, int v1, void *val);
53 /* Return value for given edge (v0,v1), or NULL if
54 * if key does not exist in hash. (If need exists
55 * to differentiate between key-value being NULL and
56 * lack of key then see BLI_edgehash_lookup_p().
58 void* BLI_edgehash_lookup (EdgeHash *eh, int v0, int v1);
60 /* Return pointer to value for given edge (v0,v1),
61 * or NULL if key does not exist in hash.
63 void** BLI_edgehash_lookup_p (EdgeHash *eh, int v0, int v1);
65 /* Return boolean true/false if edge (v0,v1) in hash. */
66 int BLI_edgehash_haskey (EdgeHash *eh, int v0, int v1);
68 /* Return number of keys in hash. */
69 int BLI_edgehash_size (EdgeHash *eh);
71 /* Remove all edges from hash. */
72 void BLI_edgehash_clear (EdgeHash *eh, EdgeHashFreeFP valfreefp);
74 /***/
76 /**
77 * Create a new EdgeHashIterator. The hash table must not be mutated
78 * while the iterator is in use, and the iterator will step exactly
79 * BLI_edgehash_size(gh) times before becoming done.
81 EdgeHashIterator* BLI_edgehashIterator_new (EdgeHash *eh);
83 /* Free an EdgeHashIterator. */
84 void BLI_edgehashIterator_free (EdgeHashIterator *ehi);
86 /* Retrieve the key from an iterator. */
87 void BLI_edgehashIterator_getKey (EdgeHashIterator *ehi, int *v0_r, int *v1_r);
89 /* Retrieve the value from an iterator. */
90 void* BLI_edgehashIterator_getValue (EdgeHashIterator *ehi);
92 /* Steps the iterator to the next index. */
93 void BLI_edgehashIterator_step (EdgeHashIterator *ehi);
95 /* Determine if an iterator is done. */
96 int BLI_edgehashIterator_isDone (EdgeHashIterator *ehi);
98 #endif