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...
|
| BEGIN_USING_C_LINKAGE void * | quickmap_new (void) |
| | Create a new quickmap object. More...
|
| |
| void | quickmap_add (t_quickmap *x, void *p1, void *p2) |
| | Add a pair of keys mapped to each other to the quickmap. More...
|
| |
| void | quickmap_drop (t_quickmap *x, void *p1, void *p2) |
| | Drop a pair of keys mapped to each other in the quickmap. More...
|
| |
| long | quickmap_lookup_key1 (t_quickmap *x, void *p1, void **p2) |
| | Given a (first) key, lookup the value (the second key). More...
|
| |
| long | quickmap_lookup_key2 (t_quickmap *x, void *p1, void **p2) |
| | Given a (second) key, lookup the value (the first key). More...
|
| |
| void | quickmap_readonly (t_quickmap *x, long way) |
| | Set the readonly flag of the quickmap's hash tables. More...
|
| |
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.
◆ quickmap_add()
| 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).
- Parameters
-
| x | The quickmap instance. |
| p1 | The (first) key. |
| p2 | The value (or the second key). |
- Returns
- A Max error code.
◆ quickmap_drop()
| void quickmap_drop |
( |
t_quickmap * |
x, |
|
|
void * |
p1, |
|
|
void * |
p2 |
|
) |
| |
Drop a pair of keys mapped to each other in the quickmap.
- Parameters
-
| x | The quickmap instance. |
| p1 | The first key. |
| p2 | The second key. |
- Returns
- A Max error code.
◆ quickmap_lookup_key1()
| long quickmap_lookup_key1 |
( |
t_quickmap * |
x, |
|
|
void * |
p1, |
|
|
void ** |
p2 |
|
) |
| |
Given a (first) key, lookup the value (the second key).
- Parameters
-
| x | The quickmap instance. |
| p1 | The (first) key. |
| p2 | The address of a pointer which will hold the resulting key upon return. |
- Returns
- A Max error code.
◆ quickmap_lookup_key2()
| long quickmap_lookup_key2 |
( |
t_quickmap * |
x, |
|
|
void * |
p1, |
|
|
void ** |
p2 |
|
) |
| |
Given a (second) key, lookup the value (the first key).
- Parameters
-
| x | The quickmap instance. |
| p1 | The (second) key. |
| p2 | The address of a pointer which will hold the resulting key upon return. |
- Returns
- A Max error code.
◆ quickmap_new()
Create a new quickmap object.
- Returns
- Pointer to the new quickmap object.
◆ quickmap_readonly()
| 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.
- Parameters
-
| x | The quickmap instance. |
| way | Set to true to make the quickmap readonly (disable thread protection) or false (the default) to enable thread protection. |