class Geo GeoKeyValueArray

This is the documentation for Enlighten.

class Geo GeoKeyValueArray

template<typename, typename>
class Geo::GeoKeyValueArray

 

A fast implementation of a set associative container, this one using a sorted array of key values to lookup a similar array of value pointers.

 

  • Requires that the key type support both operator< and operator<=. This could be removed by a small refactor of the binary search loop.

  • Requires that the value type be stored on the heap, as this class only stores pointers. Fixing this would require changing the class to work with iterators (to allow a sentinel value such as end() to represent a missing value).

 

Functions

Name

Description

Name

Description

Clear()

Removes all entries from the collection. Remember, this object did not take ownership.

Find(const TKey &)

Find a value in the collection with TKey key.

FindIndex(const TKey &)

Find the index of a given key.

GetKey(s32)

Get the key at index i.

GetSize()

Returns the number of entries in the collection.

GetValue(s32)

Get the value at index i.

GetValue(s32)

Get the value at index i.

Insert(const TKey &, TValue *)

Insert an pointer to a TValue item into the container.

operator[](s32)

Get the value at index i.

operator[](s32)

Get the value at index i.

Remove(const TKey &, s32 &)

Remove the entry referenced to by key.

Remove(const TKey &)

Remove the entry referenced to by key.



void Geo::GeoKeyValueArray< TKey, TValue >::Clear


public: void Clear()


Removes all entries from the collection. Remember, this object did not take ownership.



TValue * Geo::GeoKeyValueArray< TKey, TValue >::Find


public: TValue * Find
(
    const TKey & key
) const


Find a value in the collection with TKey key.

O(logN) operation.

Returns

NULL on failure.

 



s32 Geo::GeoKeyValueArray< TKey, TValue >::FindIndex


public: s32 FindIndex
(
    const TKey & key
) const