Close some gaps in enum values
[openal-soft.git] / common / uintmap.h
blob47bd0d4250fa94956312bc5e89dcc4b26ab090e9
1 #ifndef AL_UINTMAP_H
2 #define AL_UINTMAP_H
4 #include "AL/al.h"
5 #include "rwlock.h"
7 #ifdef __cplusplus
8 extern "C" {
9 #endif
11 typedef struct UIntMap {
12 ALuint *keys;
13 /* Shares memory with keys. */
14 ALvoid **values;
16 ALsizei size;
17 ALsizei capacity;
18 ALsizei limit;
19 RWLock lock;
20 } UIntMap;
21 #define UINTMAP_STATIC_INITIALIZE_N(_n) { NULL, NULL, 0, 0, (_n), RWLOCK_STATIC_INITIALIZE }
22 #define UINTMAP_STATIC_INITIALIZE UINTMAP_STATIC_INITIALIZE_N(INT_MAX)
24 void InitUIntMap(UIntMap *map, ALsizei limit);
25 void ResetUIntMap(UIntMap *map);
26 void RelimitUIntMapNoLock(UIntMap *map, ALsizei limit);
27 ALenum InsertUIntMapEntry(UIntMap *map, ALuint key, ALvoid *value);
28 ALenum InsertUIntMapEntryNoLock(UIntMap *map, ALuint key, ALvoid *value);
29 ALvoid *RemoveUIntMapKey(UIntMap *map, ALuint key);
30 ALvoid *RemoveUIntMapKeyNoLock(UIntMap *map, ALuint key);
31 ALvoid *LookupUIntMapKey(UIntMap *map, ALuint key);
32 ALvoid *LookupUIntMapKeyNoLock(UIntMap *map, ALuint key);
34 inline void LockUIntMapRead(UIntMap *map)
35 { ReadLock(&map->lock); }
36 inline void UnlockUIntMapRead(UIntMap *map)
37 { ReadUnlock(&map->lock); }
38 inline void LockUIntMapWrite(UIntMap *map)
39 { WriteLock(&map->lock); }
40 inline void UnlockUIntMapWrite(UIntMap *map)
41 { WriteUnlock(&map->lock); }
43 #ifdef __cplusplus
45 #endif
47 #endif /* AL_UINTMAP_H */