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

mntd_volume_hash.h

00001 /***************************************************************************
00002  * CVSID: $Id: mntd_volume_hash.h,v 1.8 2004/05/26 19:12:40 stefanb Exp $
00003  *
00004  * mntd_volume_hash.h : Volume Manager hash functions for MNT daemon
00005  *
00006  * Copyright (C) 2004 Stefan Bambach, <stefan@bambach.biz>
00007  *
00008  * Licensed under the GNU General Public License 2.0
00009  *
00010  * This program is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2 of the License, or
00013  * (at your option) any later version.
00014  *
00015  * This program is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  * GNU General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU General Public License
00021  * along with this program; if not, write to the Free Software
00022  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00023  *
00024  **************************************************************************/
00025 
00026 #ifndef __HASHMAP_H__
00027 #define __HASHMAP_H__
00028 
00029 #include "mntd_volume_hash_types.h"
00030 #include "hashmap.h"
00031 #include "linklist.h"
00032 
00033 #if defined(__cplusplus)
00034 extern "C" {
00035 #endif
00036 
00037     
00049 #define DEFAULT_BUCKETS 1021    
00062 PHASHMAP new_HashMap(unsigned int bucket, void (*func_free)(void *obj));
00063 
00064     
00068 struct HASHMAPELEMENT_ {
00069     PHASHMAP phm;                
00070     char *key;                   
00071     void *userdata;              
00078     void    (*destroy)      (PHASHMAPELEMENT phme);
00079     
00084     void    (*free)         (void *data);
00085 };
00086 
00087 
00091 struct HASHMAP_ {
00092     CHTbl *hm;                   
00093     unsigned int bucket;         
00101     int (*init)         (PHASHMAP phm);
00102     
00109     int (*hash)         (const void *obj);
00110     
00118     int (*compare)      (const void *obj1, const void *obj2);
00119     
00125     void    (*free)         (void *data);
00126 
00133     void    (*destroy)      (PHASHMAP phm);
00134     
00144     int (*add)          (PHASHMAP phm, const char *key, void *data);
00145     
00152     int (*remove)       (PHASHMAP phm, const char *key);
00153     
00159     int (*size)         (PHASHMAP phm);
00160     
00167     int (*contains)     (PHASHMAP phm, const char *key);
00168     
00176     int (*get)          (PHASHMAP phm, const char *key, void **userdata);
00177     
00185     int (*update)       (PHASHMAP phm, const char *key, void *userdata);
00186     
00194     int (*foreach)      (PHASHMAP phm, int (*func)(void *data, void *userdata), void *userdata);
00195     
00196 };
00197 
00198 
00202 #if defined(__cplusplus)
00203 }
00204 #endif
00205 
00206 #endif /* __HASHMAP_H__ */

Generated on Thu May 27 23:27:28 2004 for Mntd by doxygen 1.3.5