This is the documentation for Enlighten.

class Geo GeoHashMap

template<typename, typename, typename, typename>
class Geo::GeoHashMap

The hash table.

It's a straight forward key/value hash table where every key has one associated value (so it's a hash map, rather than a hash multi map).

Typedefs

Name Description
GeoHashConstHandle< GeoHashMap > ConstHandle

A const handle to an entry in the container.

const DataType & DataParamType

The Data type stored internally when passed as a parameter.

GeoPair< KeyType, ValueType > DataType

The Data type stored internally.

GeoHashHandle< GeoHashMap > Handle

A handle to an entry in the container.

tHashFunctor HashFunctor

The specified Hash Functor type.

tKeyCmp KeyCompareFunctor

The specified Key Compare type.

const KeyType & KeyParamType

The Key type when passed as a parameter.

tKey KeyType

The specified Key type.

const ValueType & ValueParamType

The Value type when passed as a parameter.

tValue ValueType

The specified Value type.

Variables

Name Description
const u32 MemoryAlignment = GEO_ALIGN_OF(DataType) > GEO_ALIGN_OF(u32) ? GEO_ALIGN_OF(DataType) : GEO_ALIGN_OF(u32)

The required alignment of the memory block passed to the appropriate GeoHashMap constructor.

Functions

Name Description
~GeoHashMap()

Delete.

CalcMemoryUsage(s32)

Gets the amount of memory (in bytes) required by a GeoHashMap with the given capacity.

Clear()

Clears the table.

Exists(KeyParamType)

This returns true if the key exists.

GeoHashMap(s32, float, HashFunctor, KeyCompareFunctor)

Construct a hash table.

GeoHashMap(void *, s32, HashFunctor, KeyCompareFunctor)

Construct a hash table using the given block of memory for storage. The given block must be at least the size returned by CalcMemoryUsage() and be 4-byte aligned.

GeoHashMap(const GeoHashMap &)

Copy-constructor.

GeoHashMap(GeoHashMap &&)

Move constructor.

operator=(const GeoHashMap &)

Assignment operator.

operator=(GeoHashMap &&)

Move assignment operator.

Remove(KeyParamType)

Removes the key/value pair indexed by this key.

Remove(Handle)

Removes the key/value pair reference by the handle.

Swap(GeoHashMap &)

Swap places with another table.


Geo::GeoHashMap< tKey, tValue, tHashFunctor, tKeyCmp >::~GeoHashMap


public: ~GeoHashMap()


Delete.

This will erase everything from the table.

Warning

Invalidates all existing handles.


static s32 Geo::GeoHashMap< tKey, tValue, tHashFunctor, tKeyCmp >::CalcMemoryUsage


public: s32 CalcMemoryUsage
(
    s32 capacity
)


Gets the amount of memory (in bytes) required by a GeoHashMap with the given capacity.

This is the size of the memory block which must be passed to the appropriate GeoHashMap constructor.


void Geo::GeoHashMap< tKey, tValue, tHashFunctor, tKeyCmp >::Clear


public: void Clear()


Clears the table.

Warning

Invalidates all existing handles.


bool Geo::GeoHashMap< tKey, tValue, tHashFunctor, tKeyCmp >::Exists


public: bool Exists
(
    KeyParamType key
) const


This returns true if the key exists.

Note

If you intend to access the value if it does exist it's more efficient to use Find().


Geo::GeoHashMap< tKey, tValue, tHashFunctor, tKeyCmp >::GeoHashMap


public: GeoHashMap
(
    s32 capacity,
    float loadLimit,
    HashFunctor h,
    KeyCompareFunctor cmp
)


Construct a hash table.

The last two parameters are optional and you won't need to specify them unless you are using a non-default hash or key compare functor that needs to be constructed with something other than the default constructor.

Parameters
[in] capacity

This is the minimum size of the table.

[in] loadLimit

The load factor at which the table will grow (recommended value: 0.5. Specifying zero disables growth)

[in] h

The hashing function (can be ignored)

[in] cmp

The key comparison function (can be ignored)


Geo::GeoHashMap< tKey, tValue, tHashFunctor, tKeyCmp >::GeoHashMap


public: GeoHashMap
(
    void * memory,
    s32 capacity,
    HashFunctor h,
    KeyCompareFunctor cmp
)


Construct a hash table using the given block of memory for storage. The given block must be at least the size returned by CalcMemoryUsage() and be 4-byte aligned.


Geo::GeoHashMap< tKey, tValue, tHashFunctor, tKeyCmp >::GeoHashMap


public: GeoHashMap
(
    const GeoHashMap & rhs
)


Copy-constructor.


Geo::GeoHashMap< tKey, tValue, tHashFunctor, tKeyCmp >::GeoHashMap


public: GeoHashMap
(
    GeoHashMap && rhs
)


Move constructor.


GeoHashMap& Geo::GeoHashMap< tKey, tValue, tHashFunctor, tKeyCmp >::operator=


public: GeoHashMap & operator=
(
    const GeoHashMap & rhs
)


Assignment operator.

Warning

Invalidates all existing handles.


GeoHashMap& Geo::GeoHashMap< tKey, tValue, tHashFunctor, tKeyCmp >::operator=


public: GeoHashMap & operator=
(
    GeoHashMap && rhs
)


Move assignment operator.

Warning

Invalidates all existing handles.


bool Geo::GeoHashMap< tKey, tValue, tHashFunctor, tKeyCmp >::Remove


public: bool Remove
(
    KeyParamType key
)


Removes the key/value pair indexed by this key.

Returns

Returns true if the key was found and removed, otherwise false if the key doesn't exist.

Warning

Invalidates all existing handles.


void Geo::GeoHashMap< tKey, tValue, tHashFunctor, tKeyCmp >::Remove


public: void Remove
(
    Handle h
)


Removes the key/value pair reference by the handle.

Warning

Invalidates all existing handles.


void Geo::GeoHashMap< tKey, tValue, tHashFunctor, tKeyCmp >::Swap


public: void Swap
(
    GeoHashMap & other
)


Swap places with another table.

Warning

Invalidates all existing handles.