Max 5 API Reference
A quickmap implements a pair of t_hashtab hash tables so that it is fast to look up a unique value for a unique key or vice-versa. More...
Data Structures | |
struct | t_quickmap |
The quickmap object. More... | |
Functions | |
BEGIN_USING_C_LINKAGE void * | quickmap_new (void) |
Create a new quickmap object. | |
void | quickmap_add (t_quickmap *x, void *p1, void *p2) |
Add a pair of keys mapped to each other to the quickmap. | |
void | quickmap_drop (t_quickmap *x, void *p1, void *p2) |
Drop a pair of keys mapped to each other in the quickmap. | |
long | quickmap_lookup_key1 (t_quickmap *x, void *p1, void **p2) |
Given a (first) key, lookup the value (the second key). | |
long | quickmap_lookup_key2 (t_quickmap *x, void *p1, void **p2) |
Given a (second) key, lookup the value (the first key). | |
void | quickmap_readonly (t_quickmap *x, long way) |
Set the readonly flag of the quickmap's hash tables. |
A quickmap implements a pair of t_hashtab hash tables so that it is fast to look up a unique value for a unique key or vice-versa.
This implies that both the keys and the values must be unique so that look-ups can be performed in both directions.
void quickmap_add | ( | t_quickmap * | x, | |
void * | p1, | |||
void * | p2 | |||
) |
Add a pair of keys mapped to each other to the quickmap.
Note that these are considered to be a t_symbol internally. This means that if you are mapping a t_symbol to a t_object, for example, the t_object will not automatically be freed when you free the quickmap (unlike what happens when you typically free a t_hashtab).
x | The quickmap instance. | |
p1 | The (first) key. | |
p2 | The value (or the second key). |
void quickmap_drop | ( | t_quickmap * | x, | |
void * | p1, | |||
void * | p2 | |||
) |
Drop a pair of keys mapped to each other in the quickmap.
x | The quickmap instance. | |
p1 | The first key. | |
p2 | The second key. |
long quickmap_lookup_key1 | ( | t_quickmap * | x, | |
void * | p1, | |||
void ** | p2 | |||
) |
Given a (first) key, lookup the value (the second key).
x | The quickmap instance. | |
p1 | The (first) key. | |
p2 | The address of a pointer which will hold the resulting key upon return. |
long quickmap_lookup_key2 | ( | t_quickmap * | x, | |
void * | p1, | |||
void ** | p2 | |||
) |
Given a (second) key, lookup the value (the first key).
x | The quickmap instance. | |
p1 | The (second) key. | |
p2 | The address of a pointer which will hold the resulting key upon return. |
BEGIN_USING_C_LINKAGE void* quickmap_new | ( | void | ) |
Create a new quickmap object.
void quickmap_readonly | ( | t_quickmap * | x, | |
long | way | |||
) |
Set the readonly flag of the quickmap's hash tables.
See hashtab_readonly() for more information about this.
x | The quickmap instance. | |
way | Set to true to make the quickmap readonly (disable thread protection) or false (the default) to enable thread protection. |