Data Structures

sst/elements/genericProc/programs/libcprops/hashlist.h File Reference

a mapping traversable by iterator - who could want more. More...

#include "common.h"
#include "config.h"
#include "collection.h"
#include "hashtable.h"

Go to the source code of this file.

Data Structures

struct  _cp_hashlist_entry
struct  _cp_hashlist
 Main object that holds the endpoints of the hash-list and the hash-table. More...
struct  _cp_hashlist_iterator
 iterator for hashlists More...



#define cp_hashlist_create(size_hint, hash_fn, compare_fn)
 default constructor
#define cp_hashlist_rdlock(list)   cp_hashlist_lock((list), COLLECTION_LOCK_READ)
 Set a read lock on the object.
#define cp_hashlist_wrlock(list)   cp_hashlist_lock((list), COLLECTION_LOCK_WRITE)
 Set a write lock on the object.
__BEGIN_DECLS typedef
CPROPS_DLL struct
_cp_hashlist_entry 
cp_hashlist_entry
typedef CPROPS_DLL struct
_cp_hashlist 
cp_hashlist
 Main object that holds the endpoints of the hash-list and the hash-table.
typedef CPROPS_DLL struct
_cp_hashlist_iterator 
cp_hashlist_iterator
 iterator for hashlists
CPROPS_DLL void * cp_hashlist_remove_by_option (cp_hashlist *list, void *key, int mode)
 Removes the entry with matching key and destroys it with locking mode.
CPROPS_DLL void * cp_hashlist_remove_head_by_option (cp_hashlist *list, int mode)
 Removes the first entry and destroys it.
CPROPS_DLL void * cp_hashlist_remove_tail_by_option (cp_hashlist *list, int mode)
 Removes the last entry and destroys it.
CPROPS_DLL cp_hashlistcp_hashlist_create_by_mode (int mode, unsigned long size_hint, cp_hashfunction hash_fn, cp_compare_fn compare_fn)
 constructor with parameters.
CPROPS_DLL cp_hashlistcp_hashlist_create_by_option (int mode, unsigned long size_hint, cp_hashfunction hash_fn, cp_compare_fn compare_fn, cp_copy_fn copy_key, cp_destructor_fn free_key, cp_copy_fn copy_value, cp_destructor_fn free_value)
 Constructor for copy mode.
CPROPS_DLL void cp_hashlist_destroy (cp_hashlist *)
 Destroy the list with the mode stored in the list.
CPROPS_DLL void cp_hashlist_destroy_deep (cp_hashlist *)
 Destroy the list with the mode stored in the list plus COLLECTION_MODE_DEEP.
CPROPS_DLL void cp_hashlist_destroy_by_option (cp_hashlist *list, int mode)
 Destroy the object with the specified mode (override default).
CPROPS_DLL void cp_hashlist_destroy_custom (cp_hashlist *list, cp_destructor_fn dk, cp_destructor_fn dv)
 This function does exactly what you would think it does.
CPROPS_DLL int cp_hashlist_callback (cp_hashlist *list, int(*cb)(void *key, void *value, void *id), void *id)
 iterates over the list and calls the callback function on each item.
CPROPS_DLL int cp_hashlist_get_mode (cp_hashlist *list)
 find out what mode your cp_hashlist is running in
CPROPS_DLL int cp_hashlist_set_mode (cp_hashlist *list, int mode)
 set the mode on your cp_hashlist
CPROPS_DLL int cp_hashlist_unset_mode (cp_hashlist *list, int mode)
 unset mode bits on list
CPROPS_DLL int cp_hashlist_set_min_size (cp_hashlist *list, unsigned long min_size)
 the internal table will not be resized to less than min_size
CPROPS_DLL int cp_hashlist_set_max_fill_factor (cp_hashlist *list, int fill_factor)
 a resize is triggered when the table contains more items than table_size * fill_factor / 100
CPROPS_DLL int cp_hashlist_set_min_fill_factor (cp_hashlist *list, int fill_factor)
 a resize is triggered when the table contains less items than table_size * fill_factor / 100 if table_size > min_size
CPROPS_DLL cp_hashlist_iteratorcp_hashlist_create_iterator (cp_hashlist *list, int lock_mode)
 Create a new iterator and initialize it at the beginning.
CPROPS_DLL int cp_hashlist_iterator_head (cp_hashlist_iterator *iterator)
 initialize the iterator at the beginning
CPROPS_DLL int cp_hashlist_iterator_init (cp_hashlist_iterator *iterator, cp_hashlist *list, int type)
CPROPS_DLL int cp_hashlist_iterator_init_tail (cp_hashlist_iterator *iterator, cp_hashlist *l, int lock_mode)
 Initialize the Iterator at the end.
CPROPS_DLL int cp_hashlist_iterator_tail (cp_hashlist_iterator *iterator)
 set iterator at list tail
CPROPS_DLL int cp_hashlist_iterator_to_key (cp_hashlist_iterator *iterator, void *key)
 set iterator position at first occurence of given key
CPROPS_DLL int cp_hashlist_iterator_destroy (cp_hashlist_iterator *iterator)
 iterator destructor
CPROPS_DLL int cp_hashlist_iterator_release (cp_hashlist_iterator *iterator)
 Unlock the list of the Iterator.
CPROPS_DLL cp_hashlist_entry * cp_hashlist_iterator_next (cp_hashlist_iterator *iterator)
 Go to the next entry in the list and return the content.
CPROPS_DLL void * cp_hashlist_iterator_next_key (cp_hashlist_iterator *iterator)
 Go to the next entry in the list and return the key.
CPROPS_DLL void * cp_hashlist_iterator_next_value (cp_hashlist_iterator *iterator)
 Go to the next entry in the list and return the content.
CPROPS_DLL cp_hashlist_entry * cp_hashlist_iterator_prev (cp_hashlist_iterator *iterator)
 Go to the previous entry in the list and return the content.
CPROPS_DLL void * cp_hashlist_iterator_prev_key (cp_hashlist_iterator *iterator)
 Go to the previous entry in the list and return the key.
CPROPS_DLL void * cp_hashlist_iterator_prev_value (cp_hashlist_iterator *iterator)
 Go to the previous entry in the list and return the content.
CPROPS_DLL cp_hashlist_entry * cp_hashlist_iterator_curr (cp_hashlist_iterator *iterator)
 return the entry at the current iterator position
CPROPS_DLL void * cp_hashlist_iterator_curr_key (cp_hashlist_iterator *iterator)
 return the key at the current iterator position
CPROPS_DLL void * cp_hashlist_iterator_curr_value (cp_hashlist_iterator *iterator)
 return the value at the current iterator position
CPROPS_DLL cp_hashlist_entry * cp_hashlist_iterator_insert (cp_hashlist_iterator *iterator, void *key, void *value)
 add a mapping before the current iterator position
CPROPS_DLL cp_hashlist_entry * cp_hashlist_iterator_append (cp_hashlist_iterator *iterator, void *key, void *value)
 add a mapping after the current iterator position
CPROPS_DLL void * cp_hashlist_iterator_remove (cp_hashlist_iterator *iterator)
 remove the mapping at the current iterator position
CPROPS_DLL unsigned long cp_hashlist_item_count (cp_hashlist *)
 Get the number of elements in the collection.
CPROPS_DLL void * cp_hashlist_entry_get_key (cp_hashlist_entry *entry)
 Get the key of the entry.
CPROPS_DLL void * cp_hashlist_entry_get_value (cp_hashlist_entry *entry)
 Get the value of the entry.
CPROPS_DLL void * cp_hashlist_insert (cp_hashlist *list, void *key, void *value)
 Insert a new element (key, value) at the beginning of the list.
CPROPS_DLL void * cp_hashlist_insert_by_option (cp_hashlist *list, void *key, void *item, int mode)
 Insert a new element (key, value) at the beginning of the list with mode.
CPROPS_DLL void * cp_hashlist_append (cp_hashlist *list, void *key, void *value)
 Append a new element (key, value) at the end of the list.
CPROPS_DLL void * cp_hashlist_append_by_option (cp_hashlist *, void *key, void *value, int mode)
 Append a new element (key, value) at the end of the list with mode.
CPROPS_DLL void * cp_hashlist_get (cp_hashlist *, void *key)
 Returns the first element with matching key.
CPROPS_DLL int cp_hashlist_contains (cp_hashlist *list, void *key)
 returns non-zero if list contains key
CPROPS_DLL void * cp_hashlist_get_head (cp_hashlist *)
 Returns the first element of the list.
CPROPS_DLL void * cp_hashlist_get_tail (cp_hashlist *)
 Returns the last element of the list.
CPROPS_DLL void * cp_hashlist_remove (cp_hashlist *list, void *key)
 Removes the entry with matching key and destroys it (internal locking mode).
CPROPS_DLL void * cp_hashlist_remove_deep (cp_hashlist *list, void *key)
CPROPS_DLL void * cp_hashlist_remove_head (cp_hashlist *list)
 Removes the first entry and destroys it.
CPROPS_DLL void * cp_hashlist_remove_tail (cp_hashlist *list)
 Removes the last entry and destroys it.
CPROPS_DLL int cp_hashlist_is_empty (cp_hashlist *list)
 Test if object is empty.
CPROPS_DLL int cp_hashlist_lock (cp_hashlist *list, int type)
 Locks the collection with the specified mode.
CPROPS_DLL int cp_hashlist_unlock (cp_hashlist *list)
 Unlock the object.

Detailed Description

a mapping traversable by iterator - who could want more.

access elements sequentially or by key.


Define Documentation

#define cp_hashlist_create (   size_hint,
  hash_fn,
  compare_fn 
)
Value:
cp_hashlist_create_by_option(0, (size_hint), \
                                                                         (hash_fn), (compare_fn), \
                                                                         NULL, NULL, NULL, NULL)

default constructor

Referenced by cp_httpclient_ctl_create().


Typedef Documentation

typedef CPROPS_DLL struct _cp_hashlist cp_hashlist

Main object that holds the endpoints of the hash-list and the hash-table.

It also stores the hash, compare and copy methods and the default operation mode.