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

htable2.h File Reference

Detailed Description

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

Hash tables templates, take 2.

Note: this version stores the given element types as entries (instead of always storing a pointer to element). It can be used without <sofia-sip/su_alloc.h>.

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 HTABLE2_DECLARE2(). The prototypes for hashing functions are instantiated with macro HTABLE2_PROTOS2(). The implementation is instantiated with macro HTABLE2_BODIES2().

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

 #define ENTRY_HASH(e) ((e).e_hash_value)

When a entry with new identical 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 htable2.h.

Go to the source code of this file.


#define HTABLE2_BODIES(type, prefix, pr, entrytype, hfun, is_used, reclaim, is_equal, halloc)
#define HTABLE2_BODIES2(type, prefix, pr, entrytype, sizetype,hfun, is_used, reclaim, is_equal, halloc)
#define HTABLE2_DECLARE(sname, prefix, pr, entrytype)   HTABLE2_DECLARE2(prefix##t, sname, pr, entrytype, unsigned)
#define HTABLE2_DECLARE2(type, sname, pr, entrytype, sizetype)
#define HTABLE2_MIN_SIZE   31
#define HTABLE2_PROTOS(type, prefix, pr, entrytype)   HTABLE2_PROTOS2(type, prefix, pr, entrytype, unsigned)
#define HTABLE2_PROTOS2(type, prefix, pr, entrytype, sizetype)
#define HTABLE2_SCOPE   su_inline


typedef unsigned long hash_value_t

Generated by  Doxygen 1.6.0   Back to index