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

mask.h

Go to the documentation of this file.
00001 
00002 /*
00003 ** Copyright (C) 2002 Russell Leighton
00004 **
00005 ** This program is free software; you can redistribute it and/or modify
00006 ** it under the terms of the GNU General Public License as published by
00007 ** the Free Software Foundation; either version 2 of the License, or
00008 ** (at your option) any later version.
00009 **
00010 ** This program is distributed in the hope that it will be useful,
00011 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 ** GNU General Public License for more details.
00014 **
00015 ** You should have received a copy of the GNU General Public License
00016 ** along with this program; if not, write to the Free Software
00017 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00018 */
00019 
00020 
00021 
00022 #ifndef __AW_MASK__
00023 #define __AW_MASK__
00024 
00025 #include "util.h"
00026 
00044 /* ------------------------- mask.c */
00045 
00046 typedef struct aw_mask_entry_struct {
00047 
00048   struct aw_mask_entry_struct *next;
00049 
00050   u_int32_t mask;
00051 
00052   void *user_pointer;
00053 
00054 } aw_mask_entry_t;
00055 
00056 #define AW_MASK_NROWS (sizeof(u_int32_t)*8)
00057 typedef struct {
00058 
00059   aw_mask_entry_t *by_bit[ AW_MASK_NROWS ];
00060 
00061 } aw_mask_t;
00062 
00063 typedef struct {
00064 
00065   u_int32_t key;                /* key to match against all masks */
00066 
00067   const aw_mask_t *mt;          /* mask table */
00068 
00069   aw_mask_entry_t *next;        /* entry to fetch */
00070 
00071   int32_t row;
00072 
00073 } aw_mask_cursor_t;
00074 
00075 
00080 aw_mask_t *aw_mask_make(void);
00081 
00086 void aw_mask_destroy(aw_mask_t *mt);
00087 
00095 int32_t aw_mask_insert(u_int32_t mask, void *user_pointer, aw_mask_t *mt);
00096 
00103 int32_t aw_mask_defrag(aw_mask_t *mt);
00104 
00110 void aw_mask_delete(u_int32_t mask, aw_mask_t *mt);
00111 
00118 void aw_mask_delete_specific(u_int32_t mask, void *user_pointer, aw_mask_t *mt);
00119 
00126 void aw_mask_query(u_int32_t key, aw_mask_cursor_t  *c, const aw_mask_t *mt);
00127 
00133 void *aw_mask_fetch(aw_mask_cursor_t *c);
00134 
00135 #endif
Aware 0.11.1 Copyright (C) 1998-2005 Russell Leighton (russ@elegant-software.com)