void *cp_splaytree_insert(cp_splaytree *tree, void *key, void *value);
void *cp_splaytree_get(cp_splaytree *tree, void *key);
void *cp_splaytree_delete(cp_splaytree *tree, void *key);
int cp_splaytree_contains(cp_splaytree *tree, void *key);
long cp_splaytree_count(cp_splaytree *tree);
cp_splaytree_get returns the mapping for the requested key and moves it to the root of the tree. In contrast to other collection lookup functions, this changes the internal structure and requires a write-lock, unless COLLECTION_MODE_NOSYNC is set. If COLLECTION_MODE_MULTIPLE_VALUES is set, the returned value is a cp_vector(3) object containing all values for the given key.
cp_splaytree_delete removes the current mapping for the given key and returns the value associated to it or NULL if there was no mapping for the given key. The return value is usable to indicate that a deletion has taken place. Note that the returned pointer may be invalid if COLLECTION_MODE_DEEP is set and the tree has a non-null value destructor function set. Unless COLLECTION_MODE_NOSYNC is set, the deletion function write-locks the tree.
cp_splaytree_contains returns non-zero if the tree contains a mapping for the given key or zero if not.
cp_splaytree_count returns the number of mappings currently stored in a tree.
Note that these functions may fail if locking fails. This means that for a synchronized table (ie COLLECTION_MODE_NOSYNC not set), cp_splaytree_get could return NULL although a mapping actually exists. Applications should check errno to determine whether no mapping was found (errno not set) or locking has failed (errno will be set to EBUSY, EINVAL or EDEADLK).
cp_splaytree_contains returns non-zero if the tree contains a mapping for the requested key or zero if no mapping was found or on locking errors - see above.
cp_splaytree_count returns the number of mappings currently stored.
This document was created by
using the manual pages.
Time: 10:00:50 GMT, May 30, 2006