cp_hashlist_set_mode(3)
| cp_hashlist(3) | libcprops - cp_hashlist | cp_hashlist(3) |
NAME
cp_hashlist_set_mode, cp_hashlist_unset_mode - set/unset hashlist mode bits
SYNOPSIS
#include <cprops/hashlist.h>
int cp_hashlist_set_mode(cp_hashlist *list, int
mode);
int cp_hashlist_unset_mode(cp_hashlist *list, int
mode);
DESCRIPTION
cp_hashlist_set_mode sets the mode bit specified by mode by logically ORing them with the currently set mode bits on the specified list. cp_hashlist_unset_mode resets the bits set in the parameter to zero. The effect of mode bit settings is as follows:
- COLLECTION_MODE_COPY - on insertion, the applicable copy functions
- specified are used to store copies of the key and value.
- COLLECTION_MODE_DEEP - when removing or replacing a mapping, the
- destructor functions are called on the key and value constituting the mapping.
- COLLECTION_MODE_MULTIPLE_VALUES - allows multiple mappings for a given
- key on insertion. When retrieving values the results are given in a newly
allocated cp_list, even if it contains only one entry.
libcprops may be configured with multiple values options disabled. In this event setting this bit will have no effect.
- COLLECTION_MODE_NOSYNC - operations are performed with no locking.
- Synchronization features should not be used on tables created in this mode.
- COLLECTION_MODE_NORESIZE - the table is not extended on insertion nor
- compacted on removal regardless of maximal and minimal fill factor settings.
- COLLECTION_MODE_LIST_ORDER - when retrieving multiple values with the
- COLLECTION_MODE_MULTIPLE_VALUES bit set, values are returned in their order in the list rather than in insertion order. This operation is O(n) as opposed to O(m) where N is the total number of entries in the list and m is the number of matches for the requested key.
RETURN VALUE
cp_hashlist_set_mode returns 0 on success, -1 on locking
failure or EINVAL if attempting to set COLLECTION_MODE_NOSYNC while the
current thread owns the list lock.
cp_hashlist_unset_mode returns 0 on success or -1 on locking
failure.
SEE ALSO
cp_hashlist_get_mode(3), cp_hashlist_create(3), cp_hashlist_get(3)
| OCTOBER 2005 | libcprops.0.0.3 |
