This provides a map interface to a Patricia trie, hashtable or skiplist.
- Ordering
- The hashtable is NOT ordered, but ptrie and skiplist are.
- Iterating
- Below is a simple example of how to iterate over a map.
const char *p;
void *data;
printf("%s > %s\n", p, (char*) data);
}
Deletion of items within the iterator is supported. But note do not free the item memory in the iterator. If you need to free the data items then register for a notifier and free the memory there. This is required as the items are reference counted.
- Notifications
- These allow you to get callbacks when values are inserted/removed or replaced.
- Note
- hashtable only supports deletion and replacement notificatins. There is also a special global callback for freeing deleted and replaced values (QB_MAP_NOTIFY_FREE).
- See Also
- qb_map_notify_add() qb_map_notify_del_2()
- Prefix matching
- The ptrie supports prefixes in the iterator:
printf("%s > %s\n", p, (char*)data);
}
The ptrie also supports prefixes in notifications: (remember to pass QB_MAP_NOTIFY_RECURSIVE into the notify_add.
- See Also
- qbmap.h