cp_rbtree_get_mode(3) - Linux man page
Name
cp_rbtree_get_mode, cp_rbtree_set_mode, cp_rbtree_unset_mode - red-blacktree collection mode
Synopsis
#include <cprops/rb.h>int cp_rbtree_get_mode(cp_rbtree *tree);
void cp_rbtree_set_mode(cp_rbtree *tree, int mode);
void cp_rbtree_unset_mode(cp_rbtree *tree, int mode);
Description
The collection mode is a superposition of bit values affecting the behavior of the tree. The values affecting cp_rbtree behavior are:COLLECTION_MODE_DEEP COLLECTION_MODE_COPY COLLECTION_MODE_NOSYNC COLLECTION_MODE_MULTIPLE_VALUESSetting COLLECTION_MODE_DEEP causes the tree to perform destructor calls on keys and items when mappings are removed. Note that a mapping may be removed before destruction time if inserting a new mapping for an existing key.
Setting COLLECTION_MODE_COPY causes the tree to insert copies of the given key and value when creating a new mapping.
Setting COLLECTION_MODE_NOSYNC disables locking on tree operations.
If COLLECTION_MODE_MULTIPLE_VALUES is set, inserting a mapping for an existing key adds the new value to the list for that key. The lookup function returns a cp_vector containing mappings. This may only be set at creation time with cp_rbtree_create_by_option(3) and may not be altered with cp_rbtree_set_mode or cp_rbtree_unset_mode.
The mode is initially assigned at creation time. Creating the tree with cp_rbtree_create_by_option(3) allows setting key and value constructor and destructor functions.
cp_rbtree_get_mode returns the current mode indicator.
cp_rbtree_set_mode makes a logical OR of the bits on the given mode parameter and the current mode setting and stores this as the new mode setting. No bits are unset. This function may fail if attempting to set COLLECTION_MODE_NOSYNC while the current thread owns the collection lock.
cp_rbtree_unset mode unsets the bits given by the mode parameter.
Return Value
cp_rbtree_get_mode returns the current mode settings.cp_rbtree_set_mode returns 0 on success, -1 if the tree is synchronized and locking failed or EINVAL if attempting to set COLLECTION_MODE_NOSYNC while the current thread owns the tree lock.
cp_rbtree_unset_mode returns 0 on success or -1 if the tree is synchronized and locking failed.