Logo Search packages:      
Sourcecode: sofia-sip version File versions  Download package

htable.h File Reference

Detailed Description

Defined when <sofia-sip/htable.h> has been included.

Hash tables templates.

This file contain a hash table template for C. The hash tables are resizeable, and they usually contain pointers to entries. The declaration for template datatypes is instantiated with macro HTABLE_DECLARE(). The prototypes for hashing functions are instantiated with macro HTABLE_PROTOS(). The implementation is instantiated with macro HTABLE_BODIES().

The hash table template is most efficient when the hash value is precalculated and stored in each entry. The hash "function" given to the HTABLE_BODIES() would then be something like macro

 #define HTABLE_ENTRY_HASH(e) ((e)->e_hash_value)

When a entry with new identical hash key is added to the table, it can be either inserted (before any other entry with same key value) or appended.

Example code can be found from <htable_test.c>.

Pekka Pessi <Pekka.Pessi@nokia.com>
Created: Tue Sep 25 17:42:40 2001 ppessi

Definition in file htable.h.

Go to the source code of this file.


#define HTABLE_BODIES(prefix, pr, entry_t, hfun)   HTABLE_BODIES_WITH(prefix, pr, entry_t, hfun, unsigned, hash_value_t)
#define HTABLE_BODIES_WITH(prefix, pr, entry_t, hfun, size_t, hash_value_t)
#define HTABLE_DECLARE(prefix, pr, entry_t)   HTABLE_DECLARE_WITH(prefix, pr, entry_t, unsigned, hash_value_t)
#define HTABLE_DECLARE_WITH(prefix, pr, entry_t, size_t, hash_value_t)
#define HTABLE_MIN_SIZE   31
#define HTABLE_PROTOS(prefix, pr, entry_t)   HTABLE_PROTOS_WITH(prefix, pr, entry_t, unsigned, hash_value_t)
#define HTABLE_PROTOS_WITH(prefix, pr, entry_t, size_t, hash_value_t)
#define HTABLE_SCOPE   su_inline


typedef unsigned long hash_value_t

Generated by  Doxygen 1.6.0   Back to index