cp_avltree

Section: libcprops - cp_avltree (3)
Updated: MAY 2006
Index Return to Main Contents
 

NAME

cp_avltree_get_mode, cp_avltree_set_mode, cp_avltree_unset_mode - AVL tree collection mode

 

SYNOPSIS

#include <cprops/avl.h>

int cp_avltree_get_mode(cp_avltree *tree);
void cp_avltree_set_mode(cp_avltree *tree, int mode);
void cp_avltree_unset_mode(cp_avltree *tree, int mode);

 

DESCRIPTION

The collection mode is a superposition of bit values affecting the behavior of the tree. The values affecting cp_avltree behavior are:

  COLLECTION_MODE_DEEP
  COLLECTION_MODE_COPY
  COLLECTION_MODE_NOSYNC
  COLLECTION_MODE_MULTIPLE_VALUES

Setting 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_avltree_create_by_option(3) and may not be altered with cp_avltree_set_mode or cp_avltree_unset_mode.

The mode is initially assigned at creation time. Creating the tree with cp_avltree_create_by_option(3) allows setting key and value constructor and destructor functions.

cp_avltree_get_mode returns the current mode indicator.

cp_avltree_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_avltree_unset mode unsets the bits given by the mode parameter.

 

RETURN VALUE

cp_avltree_get_mode returns the current mode settings.
cp_avltree_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_avltree_unset_mode returns 0 on success or -1 if the tree is synchronized and locking failed.

 

SEE ALSO

cp_avltree_create(3), cp_avltree_lock(3)


 

Index

NAME
SYNOPSIS
DESCRIPTION
RETURN VALUE
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 10:00:49 GMT, May 30, 2006
SourceForge.net Logo