00001 #ifndef POINTER_HASH_CLASS 00002 #define POINTER_HASH_CLASS 00003 00004 /*****************************************************************************\ 00005 * * 00006 * Name : pointer_hash * 00007 * Author : Chris Koeritz * 00008 * * 00009 ******************************************************************************* 00010 * Copyright (c) 2001-$now By Author. This program is free software; you can * 00011 * redistribute it and/or modify it under the terms of the GNU General Public * 00012 * License as published by the Free Software Foundation; either version 2 of * 00013 * the License or (at your option) any later version. This is online at: * 00014 * http://www.fsf.org/copyleft/gpl.html * 00015 * Please send any updates to: fred@gruntose.com * 00016 \*****************************************************************************/ 00017 00018 #include "hash_table.h" 00019 00021 00028 // forward. 00029 class pointer_set; 00030 00031 template <class contents> 00032 class pointer_hash : public hash_table<void *, contents> 00033 { 00034 public: 00035 pointer_hash(int max_bits); 00036 ~pointer_hash(); 00037 00038 const pointer_set &ids() const; 00039 void ids(pointer_set &ids) const; 00041 00042 outcome add(void *key, contents *to_store); 00044 contents *acquire(void *key); 00046 bool zap(void *key); 00048 void reset(); 00050 00051 typedef bool apply_function(const void * &key, contents ¤t, 00052 void *data_link); 00053 00054 void apply(apply_function *to_apply, void *data_link); 00056 00057 private: 00058 pointer_set *_ids; 00060 00062 }; 00063 00064 #endif 00065
1.5.1