#include "common.h"
#include "idtable.h"
#include "override.h"
Defines | |
#define | BLOCK_BITS 5 |
#define | BLOCK_SIZE (1 << BLOCK_BITS) |
#define | BLOCK_MASK (BLOCK_SIZE - 1) |
#define | BLOCK_COUNT(tbl) (((tbl->size - 1) >> BLOCK_BITS) + 1) |
#define | ID_BLOCK(id) (id >> BLOCK_BITS) |
#define | MARK_ID(tbl, s) (tbl->used_ids[ID_BLOCK(s)] |= (guint32)0x80000000 >> (s & BLOCK_MASK)) |
#define | CLEAR_ID(tbl, s) (tbl->used_ids[ID_BLOCK(s)] &= ~((guint32)0x80000000 >> (s & BLOCK_MASK))) |
#define | IS_ID_TAKEN(tbl, s) (tbl->used_ids[ID_BLOCK(s)] & ((guint32)0x80000000 >> (s & BLOCK_MASK))) |
Functions | |
RCSID ("$Id:idtable.c, v 1.4 2005/06/25 01:37:42 daichik Exp $") | |
guint32 | find_unused_id (idtable_t *tbl) |
void | idtable_extend (idtable_t *tbl) |
idtable_t * | idtable_new (guint32 isize, guint32 esize) |
idtable_new | |
void | idtable_destroy (idtable_t *tbl) |
idtable_destroy: | |
guint32 | idtable_new_id (idtable_t *tbl, gpointer value) |
idtable_new_id: | |
void | idtable_new_id_value (idtable_t *tbl, guint32 id, gpointer value) |
idtable_new_id_value | |
void | idtable_set_value (idtable_t *tbl, guint32 id, gpointer value) |
idtable_set_value: | |
gpointer | idtable_get_value (idtable_t *tbl, guint32 id) |
idtable_get_value: | |
G_INLINE_FUNC gboolean | idtable_is_id_used (idtable_t *tbl, guint32 id) |
idtable_is_id_used: | |
void | idtable_free_id (idtable_t *tbl, guint32 id) |
idtable_free_id: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
idtable_destroy: Free all memory occupied by this table. The table must not be used again after idtable_destroy call called on it. |
|
|
|
idtable_free_id: Mark this id as unused. If will eventually be reissued. |
|
idtable_get_value: Fetch the value associated with the given id. The id must have been requested with idtable_request_id before and must not be accessed after it has been dropped by idtable_drop_id. |
|
idtable_is_id_used:
|
|
idtable_new Allocate new id table. Sizes will be rounded up to multiples of 32. The size of the table will be automatically expanded if necessary. Initial size and extend size must be larger then 0 and are internally rounded up to the closest multiple of 32. |
|
idtable_new_id: Get a id for the given value. The id can be used to look up the value later. |
|
idtable_new_id_value Request a special id for a given value. If the id must not be already in use.Best check whether the id is already in use with the idtable_is_id_used call. If the id is outside the current id range, the table is extend until the id is in range. |
|
idtable_set_value: Replace the value of a give id. The id must already be in use. |
|
|