gwion-util
utilities for the Gwion project
Loading...
Searching...
No Matches
map.h
Go to the documentation of this file.
1
4#ifndef __MAP
5#define __MAP
6
7typedef struct Map_ {
9} * Map;
10
11#define VKEY(v, i) (v)->ptr[OFFSET + (i)*2]
12#define VVAL(v, i) (v)->ptr[OFFSET + (i)*2 + 1]
13
14ANEW extern Map new_map(MemPool);
15extern void map_init(const Map);
16extern ANN vtype map_get(const Map, const vtype);
17extern ANN m_int map_index(const Map, const vtype);
18
19ANN static inline vtype map_at(const Map map, const vtype index) {
20 return VVAL(map, index);
21}
22extern ANN void map_set(const Map, const vtype, const vtype);
23extern ANN void map_remove(const Map, const vtype);
24extern ANN void map_commit(const __restrict__ Map, __restrict__ const Map);
25extern ANN void map_clear(const Map);
26extern ANN void free_map(MemPool p, const Map);
27extern ANN void map_release(const Map);
28ANN static inline vtype map_size(const Map map) { return VLEN(map); }
29#endif
#define VLEN(v)
Definition container.h:10
uintptr_t vtype
Definition container.h:14
#define ANN
Definition defs.h:19
#define ANEW
Definition defs.h:22
intptr_t m_int
Definition gwcommon.h:10
static ANN vtype map_size(const Map map)
Definition map.h:28
ANN void map_set(const Map, const vtype, const vtype)
Definition map.c:32
void map_init(const Map)
Definition map.c:9
#define VVAL(v, i)
Definition map.h:12
ANN m_int map_index(const Map, const vtype)
Definition map.c:26
ANEW Map new_map(MemPool)
Definition map.c:14
ANN void free_map(MemPool p, const Map)
Definition map.c:63
ANN void map_commit(const __restrict__ Map, __restrict__ const Map)
ANN vtype map_get(const Map, const vtype)
Definition map.c:20
ANN void map_clear(const Map)
Definition map.c:3
ANN void map_release(const Map)
Definition map.c:61
ANN void map_remove(const Map, const vtype)
Definition map.c:44
struct Map_ * Map
static ANN vtype map_at(const Map map, const vtype index)
Definition map.h:19
Definition map.h:7
vtype * ptr
Definition map.h:8