#include
"../kernel/value.h"
Define Documentation
#define
KEY_IS_OBJECT 0x0001 |
#define
VALUE_IS_OBJECT 0x0002 |
#define is_hashtable |
( |
|
v |
) |
((DbgVerify(!is_sourcepositionwrapper(v)),
(v))->tag == class_tag(HashTable)) |
#define
SECONDARY_BUCKET 5 |
Function Documentation
ScripterExport int default_eq_fn |
( |
const void * |
key1, |
|
|
const void * |
key2 |
|
) |
|
|
ScripterExport DWORD_PTR default_hash_fn |
( |
const void * |
key |
) |
|
visible_class_debug_ok |
( |
HashTable |
|
) |
|
: public Value
{
public:
typedef DWORD_PTR (*hash_fn_type)(const void*);
typedef int (*eq_fn_type)(const void*, const void*);
private:
secondary **table;
UINT size;
int n_entries;
eq_fn_type eq_fn;
hash_fn_type hash_fn;
int cursor;
int secondCursor;
short flags;
HashTable* inner;
HashTable* outer;
int level;
public:
ScripterExport HashTable(UINT primary_size, eq_fn_type key_eq_fn, hash_fn_type key_hash_fn, int flags);
HashTable() { init(17, default_eq_fn, default_hash_fn, KEY_IS_OBJECT + VALUE_IS_OBJECT); }
HashTable(UINT primary_size) { init(primary_size, default_eq_fn, default_hash_fn, KEY_IS_OBJECT + VALUE_IS_OBJECT); }
ScripterExport ~HashTable();
ScripterExport void init(UINT primary_size, eq_fn_type key_eq_fn, hash_fn_type key_hash_fn, int flags);
# define is_hashtable(v) ((DbgVerify(!is_sourcepositionwrapper(v)), (v))->tag == class_tag(HashTable))
ScripterExport static CRITICAL_SECTION hash_update;
static void setup();
classof_methods (HashTable, Value);
ScripterExport void collect();
ScripterExport void gc_trace();
ScripterExport Value* get(const void* key);
ScripterExport Value* put(const void* key, const void* val);
ScripterExport Value* put_new(const void* key, const void* val);
ScripterExport Value* find_key(const void *val);
ScripterExport Value* set(const void* key, const void* val);
ScripterExport void remove(const void* key);
ScripterExport void map_keys_and_vals(void (*fn)(const void* key, const void* val, void* arg), void* arg);
ScripterExport void map_keys_and_vals(HashTabMapper* mapper);
ScripterExport int num_entries() { return n_entries; }
HashTable* enter_scope();
HashTable* leave_scope();
HashTable* next_scope();
int scope_level() { return level; }
};