module vrt.vacuum.aa

Platform independent AA implementation, see interface in core.rt.aa.

Code Map

//! Platform independent AA implementation, see interface in core.rt.aa.
module vrt.vacuum.aa;


alias HashValue = void*;

struct SizeBehaviourPrime
{
public:
	fn setStarting(min: size_t) size_t { }
	fn getNextSize() size_t { }
	fn getIndex(hash: u64) size_t { }
}

struct ArrayHash
{
public:
	enum Factor;


public:
	alias KeyElement = KE;
	alias Key = scope (const(scope (KeyElement)[]);
	alias Value = V;
	alias Distance = u8;
	alias SizeBehaviour = SB;


public:
	fn dup(old: HashMapArray) { }
	fn setup(size: size_t) { }
	fn getOrInit(key: scope (Key)) Value { }
	fn ptrKeys(ti: TypeInfo) void[] { }
	fn keys(ti: TypeInfo) void[] { }
	fn values(aa: AA*) void[] { }
	fn findPtr(key: scope (Key)) Value* { }
	fn find(key: scope (Key), ret: Value) bool { }
	fn add(key: scope (Key), value: Value) { }
	fn remove(key: scope (Key)) bool { }
	fn grow() { }
	fn allocArrays(entries: size_t) { }
	fn removeAt(index: size_t) { }
	fn clearAt(index: size_t) { }
	fn wantsToGetRicher(index: size_t) bool { }


public:
	static fn makeHash(key: scope (Key)) u64 { }
}

struct ValueHash
{
public:
	enum Factor;


public:
	alias Key = K;
	alias Value = V;
	alias HashType = u64;
	alias Distance = u8;
	alias SizeBehaviour = SB;


public:
	fn dup(old: HashMapInteger) { }
	fn setup(size: size_t) { }
	fn getOrInit(key: Key) Value { }
	fn keys(ti: TypeInfo) void[] { }
	fn values(aa: AA*) void[] { }
	fn findPtr(key: Key) Value* { }
	fn find(key: Key, ret: Value) bool { }
	fn add(key: Key, value: Value) { }
	fn remove(key: Key) bool { }
	fn grow() { }
	fn allocArrays(entries: size_t) { }
	fn removeAt(index: size_t) { }
	fn clearAt(index: size_t) { }
	fn wantsToGetRicher(index: size_t) bool { }


public:
	static fn makeHash(key: Key) u64 { }
}

struct AA
{
public:
	keytid: TypeInfo;
	valuetid: TypeInfo;
	u: HashUnion;
	arrayKey: bool;
	ptrKey: bool;
}

union HashUnion
{
public:
	array: ArrayHash;
	value: ValueHash;
}

fn getPrimeSize(index: u32) u64 { }
fn fastPrimeHashToIndex(index: u8, hash: u64) u64 { }
//! Returns the log2 of the given u32, does not throw on 0.
fn log2(x: u32) u32 { }
fn hashFNV1A_64(arr: scope (const(scope (void)[])) u64 { }
fn writeToPtr(aa: AA*, ret: void*, value: HashValue) { }
fn fromHashValuePtr(aa: AA*, ptr: HashValue*) void* { }
fn toHashValue(aa: AA*, value: void*) HashValue { }
//! Creates a new associative array.
fn vrt_aa_new(value: TypeInfo, key: TypeInfo) void* { }
//! Copies an existing associative array.
fn vrt_aa_dup(rbtv: void*) void* { }
fn vrt_aa_in_primitive(rbtv: void*, key: K, ret: void*) bool { }
fn vrt_aa_in_array(rbtv: void*, key: K, ret: void*) bool { }
fn vrt_aa_in_ptr(rbtv: void*, key: K, ret: void*) bool { }
fn vrt_aa_insert_primitive(rbtv: void*, key: K, value: void*) { }
fn vrt_aa_insert_array(rbtv: void*, key: K, value: void*) { }
fn vrt_aa_insert_ptr(rbtv: void*, key: K, value: void*) { }
fn vrt_aa_delete_primitive(rbtv: void*, key: K) bool { }
fn vrt_aa_delete_array(rbtv: void*, key: K) bool { }
fn vrt_aa_delete_ptr(rbtv: void*, key: K) bool { }
//! Get the keys array for a given associative array.
fn vrt_aa_get_keys(rbtv: void*) void[] { }
//! Get the values array for a given associative array.
fn vrt_aa_get_values(rbtv: void*) void[] { }
//! Get the number of pairs in a given associative array.
fn vrt_aa_get_length(rbtv: void*) size_t { }
fn vrt_aa_in_binop_primitive(rbtv: void*, key: K) void* { }
fn vrt_aa_in_binop_array(rbtv: void*, key: K) void* { }
fn vrt_aa_in_binop_ptr(rbtv: void*, key: K) void* { }
//! Rehash an associative array to optimise performance.
fn vrt_aa_rehash(rbtv: void*) { }
fn log2(x: u32) u32

Returns the log2 of the given u32, does not throw on 0.

fn vrt_aa_new(value: TypeInfo, key: TypeInfo) void*

Creates a new associative array.

fn vrt_aa_dup(rbtv: void*) void*

Copies an existing associative array.

fn vrt_aa_get_keys(rbtv: void*) void[]

Get the keys array for a given associative array.

fn vrt_aa_get_values(rbtv: void*) void[]

Get the values array for a given associative array.

fn vrt_aa_get_length(rbtv: void*) size_t

Get the number of pairs in a given associative array.

fn vrt_aa_rehash(rbtv: void*)

Rehash an associative array to optimise performance.

This is a no-op in the current implementation.