sorted_hash.h File Reference

#include "common.h"
#include "collection.h"
#include "vector.h"
#include "mempool.h"

Go to the source code of this file.

Data Structures

struct  _cp_sh_entry
struct  _cp_sorted_hash
#define SH_RED   0
#define SH_BLACK   1
#define cp_sorted_hash_rdlock(tree)   (cp_sorted_hash_lock((tree), COLLECTION_LOCK_READ))
#define cp_sorted_hash_wrlock(tree)   (cp_sorted_hash_lock((tree), COLLECTION_LOCK_WRITE))
typedef CPROPS_DLL struct
typedef CPROPS_DLL struct
CPROPS_DLL cp_sh_entry * cp_sh_entry_create (void *key, void *value, cp_mempool *pool)
CPROPS_DLL void cp_sorted_hash_destroy_entry (struct _cp_sorted_hash *owner, cp_sh_entry *entry)
CPROPS_DLL void cp_sorted_hash_destroy_entry_deep (struct _cp_sorted_hash *owner, cp_sh_entry *entry)
CPROPS_DLL cp_sorted_hash * cp_sorted_hash_create (cp_hashfunction hash, cp_compare_fn cmp_key, cp_mapping_cmp_fn cmp_mapping)
CPROPS_DLL cp_sorted_hash * cp_sorted_hash_create_by_option (int mode, unsigned long size_hint, cp_hashfunction hash, cp_compare_fn cmp_key, cp_mapping_cmp_fn cmp_mapping, cp_copy_fn key_copy, cp_destructor_fn key_dtr, cp_copy_fn val_copy, cp_destructor_fn val_dtr)
CPROPS_DLL void cp_sorted_hash_destroy (cp_sorted_hash *tree)
CPROPS_DLL void cp_sorted_hash_destroy_custom (cp_sorted_hash *tree, cp_destructor_fn key_dtr, cp_destructor_fn val_dtr)
CPROPS_DLL void * cp_sorted_hash_insert (cp_sorted_hash *tree, void *key, void *value)
CPROPS_DLL void * cp_sorted_hash_get (cp_sorted_hash *tree, void *key)
CPROPS_DLL void * cp_sorted_hash_find (cp_sorted_hash *tree, cp_mapping *mapping, cp_op op)
CPROPS_DLL int cp_sorted_hash_contains (cp_sorted_hash *tree, void *key)
CPROPS_DLL void * cp_sorted_hash_delete (cp_sorted_hash *tree, void *key)
CPROPS_DLL int cp_sorted_hash_callback_preorder (cp_sorted_hash *tree, cp_callback_fn callback, void *prm)
CPROPS_DLL int cp_sorted_hash_callback (cp_sorted_hash *tree, cp_callback_fn callback, void *prm)
CPROPS_DLL int cp_sorted_hash_callback_postorder (cp_sorted_hash *tree, cp_callback_fn callback, void *prm)
CPROPS_DLL int cp_sorted_hash_count (cp_sorted_hash *tree)
CPROPS_DLL int cp_sorted_hash_lock (cp_sorted_hash *tree, int type)
CPROPS_DLL int cp_sorted_hash_unlock (cp_sorted_hash *tree)
CPROPS_DLL int cp_sorted_hash_get_mode (cp_sorted_hash *tree)
CPROPS_DLL int cp_sorted_hash_set_mode (cp_sorted_hash *tree, int mode)
CPROPS_DLL int cp_sorted_hash_unset_mode (cp_sorted_hash *tree, int mode)
CPROPS_DLL void cp_sorted_hash_dump (cp_sorted_hash *tree)

Detailed Description

sorted hash table - not unlike cp_hashlist, only nodes are arranged in a red black tree to allow ordered traversal. Hence a user defined ordering is conserved rather than insertion order.

cp_sorted_hash allows hash table like lookups using the given keys. Sorting is done on a cp_mapping structure, so that the comparison function can examine key, value or both.

Definition in file sorted_hash.h.

Function Documentation

CPROPS_DLL void cp_sorted_hash_dump ( cp_sorted_hash *  tree  ) 

print tree to stdout

Definition at line 1171 of file sorted_hash.c.


Generated on Mon Dec 5 23:00:22 2011 for cprops by  doxygen 1.4.7