Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

mask.h File Reference


Detailed Description

This is a bitmasked based lookup table. Items are associated with 32bit masks and can be fetched by specifying a 32bit key. Items match if (key | mask) == key , that is if the mask contains the lookup key's bit pattern.

For example, there may be man items stored that have the lowest order bit set in their mask. If a fetch is done with 0x1 as the key then all of these items will match.

Since a fetch may return many items, a cursor based method is used.

Copyright 1998-2001 Russell Leighton

#include "util.h"

Go to the source code of this file.

Data Structures

struct  aw_mask_cursor_t
struct  aw_mask_entry_struct
struct  aw_mask_t

Defines

#define AW_MASK_NROWS   (sizeof(u_int32_t)*8)

Typedefs

typedef aw_mask_entry_struct aw_mask_entry_t

Functions

int32_t aw_mask_defrag (aw_mask_t *mt)
 Realloc all entries into a contiguous block, freeing old ones .

void aw_mask_delete (u_int32_t mask, aw_mask_t *mt)
 Delete ALL user_pointers associated with mask in table mt.

void aw_mask_delete_specific (u_int32_t mask, void *user_pointer, aw_mask_t *mt)
 Delete user_pointer associated with mask,user_pointer pair in table mt.

void aw_mask_destroy (aw_mask_t *mt)
 Free mask table.

void * aw_mask_fetch (aw_mask_cursor_t *c)
 Fill cursor with next match.

int32_t aw_mask_insert (u_int32_t mask, void *user_pointer, aw_mask_t *mt)
 Associate user_pointer with mask in table mt.

aw_mask_t * aw_mask_make (void)
 Create mask table.
Returns:
A aw_mask_t pointer is returned on success, NULL on error.


void aw_mask_query (u_int32_t key, aw_mask_cursor_t *c, const aw_mask_t *mt)
 Fill cursor with results of query. Must call aw_mask_fetch() to get data in cursor.


Define Documentation

#define AW_MASK_NROWS   (sizeof(u_int32_t)*8)
 


Typedef Documentation

typedef struct aw_mask_entry_struct aw_mask_entry_t
 


Function Documentation

int32_t aw_mask_defrag (  aw_mask_t *  mt  ) 
 

Realloc all entries into a contiguous block, freeing old ones .

aw_mask_defrag

Parameters:
mt Mask table.
Returns:
0 on success.

void aw_mask_delete (  u_int32_t  mask,
aw_mask_t *  mt
) 
 

Delete ALL user_pointers associated with mask in table mt.

Parameters:
mask 32bit mask.
mt Mask table.

void aw_mask_delete_specific (  u_int32_t  mask,
void *  user_pointer,
aw_mask_t *  mt
) 
 

Delete user_pointer associated with mask,user_pointer pair in table mt.

Parameters:
mask 32bit mask.
user_pointer Value to associated with key
mt Mask table.

void aw_mask_destroy (  aw_mask_t *  mt  ) 
 

Free mask table.

Parameters:
mt Mask table.

void* aw_mask_fetch (  aw_mask_cursor_t *  c  ) 
 

Fill cursor with next match.

Parameters:
c Cursor.
Returns:
Returns associated user_pointer, NULL when no more data.

int32_t aw_mask_insert (  u_int32_t  mask,
void *  user_pointer,
aw_mask_t *  mt
) 
 

Associate user_pointer with mask in table mt.

Parameters:
mask 32bit mask.
user_pointer Pointer to associate with mask.
mt Mask table.
Returns:
0 on success.

aw_mask_t* aw_mask_make (  void   ) 
 

Create mask table.

Returns:
A aw_mask_t pointer is returned on success, NULL on error.

void aw_mask_query (  u_int32_t  key,
aw_mask_cursor_t *  c,
const aw_mask_t *  mt
) 
 

Fill cursor with results of query. Must call aw_mask_fetch() to get data in cursor.

Parameters:
key 32bit key.
c Cursor.
mt Mask table.

Aware 0.11.1 Copyright (C) 1998-2005 Russell Leighton (russ@elegant-software.com)