|
offbrand
A collection of generic, reference counted datastructures in C for C
|
obmap Public Interface More...
#include "offbrand.h"Go to the source code of this file.
Typedefs | |
| typedef struct obmap_struct | obmap |
Functions | |
| obmap * | obmap_new (void) |
| Constructor, creates a new, empty, obmap instance with a small initial capacity. More... | |
| obmap * | obmap_new_with_capacity (uint32_t capacity) |
| Constructor, creates a new, empty obmap instance with capacity given. More... | |
| obmap * | obmap_copy (const obmap *to_copy) |
| Copy constructor, creates a new obmap with the exact same contents of another obmap. More... | |
| void | obmap_insert (obmap *m, obj *key, obj *value) |
| Add a key-value pair to an obmap. More... | |
| obj * | obmap_lookup (const obmap *m, const obj *key) |
| Lookup the value stored at key in an obmap. More... | |
| void | obmap_remove (obmap *m, obj *key) |
| Removes a key-value pair from an obmap. More... | |
| void | obmap_rehash (obmap *m) |
| Rehashes all elements contained in an obmap. More... | |
| void | obmap_clear (obmap *m) |
| Clears an obmap of all key-value pairs, essentially restoring it to the initial empty state that existed after creation. More... | |
obmap Public Interface
| typedef struct obmap_struct obmap |
Class type declaration
| void obmap_clear | ( | obmap * | m) |
Clears an obmap of all key-value pairs, essentially restoring it to the initial empty state that existed after creation.
| m | Pointer to an instance of obmap |
Copy constructor, creates a new obmap with the exact same contents of another obmap.
| to_copy | Pointer to an instance of obmap to copy |
Add a key-value pair to an obmap.
| m | Pointer to an instance of obmap |
| key | Pointer to any Offbrand compatible class to use as a lookup key |
| value | Pointer to any Offbrand compatible class |
If the key is already contained within the m then the old value stored at that key is replaced with the new value
Lookup the value stored at key in an obmap.
| m | Pointer to an instance of obmap |
| key | Pointer to any Offbrand compatible class to use as a lookup key |
| NULL | Key not found in obmap instance or key bound to NULL value |
| non-NULL | Value found at key in obmap |
| obmap* obmap_new | ( | void | ) |
Constructor, creates a new, empty, obmap instance with a small initial capacity.
| obmap* obmap_new_with_capacity | ( | uint32_t | capacity) |
Constructor, creates a new, empty obmap instance with capacity given.
| capacity | Capacity required for obmap instance |
| void obmap_rehash | ( | obmap * | m) |
Rehashes all elements contained in an obmap.
| m | Pointer to an instance of obmap |
This method is useful for ensuring that mutable keys will still lead to valid lookups of the associated values even after key(s) have been altered
Removes a key-value pair from an obmap.
| m | Pointer to an instance of obmap |
| key | Pointer to any Offbrand compatible class to use as a lookup key |
If no key exists then the funciton will silently do nothing
1.8.4