cp_hashlist

Section: libcprops - cp_hashlist (3)
Updated: OCTOBER 2005
Index Return to Main Contents
 

NAME

cp_hashlist_insert, cp_hashlist_insert_by_option, cp_hashlist_append, cp_hashlist_append_by_option - add a mapping to a hashlist  

SYNOPSIS

#include <cprops/hashlist.h>

void *cp_hashlist_insert(cp_hashlist *list, void *key, void *value);
void *cp_hashlist_insert_by_option(cp_hashlist *list,
                                    void *key,
                                    void *value,
                                    int mode);
void *cp_hashlist_append(cp_hashlist *list, void *key, void *value);
void *cp_hashlist_append_by_option(cp_hashlist *list,
                                    void *key,
                                    void *value,
                                    int mode);

 

DESCRIPTION

cp_hashlist_insert adds a mapping from key to value using the current mode on list. The new mapping is prepended to the list. The effect of various mode bits is as follows:
COLLECTION_MODE_DEEP - if a mapping for key already exists, the
destructor functions are called on the existing key and value and they are replaced with the new settings - unless COLLECTION_MODE_MULTIPLE_VALUES is set.
COLLECTION_MODE_MULTIPLE_VALUES - allows multiple mappings for a given
key.
COLLECTION_MODE_COPY - the copy functions specified on list creation
are used to store copies of the key and value.
COLLECTION_MODE_NOSYNC - no locking is performed on insertion.
COLLECTION_MODE_NORESIZE - a resize will not be triggered even if the
fill factor exceeds the maximum setting for the internal table. cp_hashlist_insert_by_option allows specifying a mode setting overriding the current list mode, with the exception that the COLLECTION_MODE_NOSYNC bit on the option parameter has no effect.

cp_hashlist_append and cp_hashlist_append_by_option are similar to cp_hashlist_insert and cp_hashlist_insert_by_option respectively, with the difference that the new mapping is appended to the list.

 

RETURN VALUE

insertion functions return a pointer to the actual inserted value, which may be different to the value parameter if COLLECTION_MODE_COPY is set, or NULL if the insertion failed.

 

ERRORS

EINVAL the COLLECTION_MODE_MULTIPLE_VALUES mode bit is not set and
a mapping for key already exists
ENOMEM an internal allocation failed.

 

SEE ALSO

cp_hashlist(3), cp_hashlist_get(3), cp_hashlist_set_mode(3), cp_hashlist_set_max_fill_factor(3)


 

Index

NAME
SYNOPSIS
DESCRIPTION
RETURN VALUE
ERRORS
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 18:37:21 GMT, December 27, 2005
SourceForge.net Logo