Rabbit Tree
Radix bit tries for implementing associative arrays and sets in C.
|
Go to the source code of this file.
Functions | |
RBT_VALUE_T | RBT_DELETE (RBT_NODE_T *node, RBT_KEY_T key) |
int | RBT_HAS_KEY (RBT_NODE_T *node, RBT_KEY_T key) |
RBT_VALUE_T | RBT_INSERT (RBT_NODE_T *node, RBT_KEY_T key, RBT_VALUE_T value) |
RBT_VALUE_T | RBT_NODE_QUERY_WRAPPER (RBT_NODE_T *node, RBT_KEY_T key, rbt_query_action_t action, RBT_VALUE_T value) |
RBT_VALUE_T | RBT_RETRIEVE (RBT_NODE_T *node, RBT_KEY_T key) |
RBT_VALUE_T | RBT_SWAP (RBT_NODE_T *node, RBT_KEY_T key, RBT_VALUE_T value) |
RBT_WRAPPER_H_PREFIX_
The prefix for visible variable and function declarations in this header.
RBT_KEY_T
The type of the keys that will be used. The only requirement for a key is that a pointer can be extracted from it and used to read the underlying contiguous bits.
RBT_KEY_COUNT_BITS(key)
Return the number of bits in the key.
RBT_KEY_PTR(key)
Return a pointer to the underlying bytes.
RBT_KEY_FPRINT(fd, key, len)
Print a representation of the key to the given file descriptor. len
is the length of the key in bytes.
RBT_KEY_SIZE_FIXED
The size of the key, in bytes, if it is fixed or if a maximum key size can be anticipated.
RBT_VALUE_T RBT_DELETE | ( | RBT_NODE_T * | node, |
RBT_KEY_T | key | ||
) |
A convenient wrapper for RBT_NODE_QUERY_WRAPPER()
for deleting values.
[in] | node | The root node. |
[in] | key | The query key. |
RBT_NODE_QUERY()
for this action. int RBT_HAS_KEY | ( | RBT_NODE_T * | node, |
RBT_KEY_T | key | ||
) |
Check if a key is present in the tree.
RBT_VALUE_T RBT_INSERT | ( | RBT_NODE_T * | node, |
RBT_KEY_T | key, | ||
RBT_VALUE_T | value | ||
) |
A convenient wrapper for RBT_NODE_QUERY_WRAPPER()
for inserting values.
[in] | node | The root node. |
[in] | key | The query key. |
[in] | value | The value to insert. |
RBT_NODE_QUERY()
for this action. RBT_VALUE_T RBT_NODE_QUERY_WRAPPER | ( | RBT_NODE_T * | node, |
RBT_KEY_T | key, | ||
rbt_query_action_t | action, | ||
RBT_VALUE_T | value | ||
) |
A wrapper function around RBT_NODE_QUERY()
that automatically casts the key to the required pointer type.
[in] | node | The root node. |
[in] | key | The query key. |
[in] | action | The action to perform. |
[in] | value | The value with which to perform the action. |
RBT_NODE_QUERY()
for this action. RBT_VALUE_T RBT_RETRIEVE | ( | RBT_NODE_T * | node, |
RBT_KEY_T | key | ||
) |
A convenient wrapper for RBT_NODE_QUERY_WRAPPER()
for retrieving values.
[in] | node | The root node. |
[in] | key | The query key. |
RBT_NODE_QUERY()
for this action. RBT_VALUE_T RBT_SWAP | ( | RBT_NODE_T * | node, |
RBT_KEY_T | key, | ||
RBT_VALUE_T | value | ||
) |
A convenient wrapper for RBT_NODE_QUERY_WRAPPER()
for swapping values.
[in] | node | The root node. |
[in] | key | The query key. |
[in] | value | The value to insert. |
RBT_NODE_QUERY()
for this action.