"L. Spiro Engine"
Classes | Public Member Functions | Protected Types | Protected Attributes

lstl::CMultiMap Class Reference

Inheritance diagram for lstl::CMultiMap:
lstl::CMultiMapBase

List of all members.

Classes

struct  LSTL_PAIR

Public Member Functions

LSE_CALL CMultiMap (const CMultiMap< _tKeyType, _tMappedType > &_mmSrc)
LSE_CALL CMultiMap (CAllocator *_paAllocator)
CMultiMap &LSE_CALL operator= (const CMultiMap &_mmOther)
LSBOOL LSE_CALL Insert (const _tKeyType &_tKey, const _tMappedType &_tValue, _tMappedType **_pptReturnValue=NULL)
LSVOID LSE_CALL RemoveNoDealloc (const _tKeyType *_ptKeys, LSUINT32 _ui32Total)
LSVOID LSE_CALL RemoveNoDealloc (const _tKeyType &_tKey)
LSVOID LSE_CALL Remove (const _tKeyType *_ptKeys, LSUINT32 _ui32Total)
LSVOID LSE_CALL Remove (const _tKeyType &_tKey)
LSVOID LSE_CALL ResetNoDealloc ()
LSVOID LSE_CALL Reset ()
LSUINT32 LSE_CALL Length () const
LSBOOL LSE_CALL GetItemIndex (const _tKeyType &_tKey, LSUINT32 &_ui32Index) const
LSUINT32 LSE_CALL ItemsOnKey (LSUINT32 _ui32Index) const
_tMappedType &LSE_CALL GetByIndex (LSUINT32 _ui32KeyIndex, LSUINT32 _ui32Index)
const _tMappedType &LSE_CALL GetByIndex (LSUINT32 _ui32KeyIndex, LSUINT32 _ui32Index) const
LSVOID LSE_CALL SetAllocator (CAllocator *_paAllocator)
CAllocator *LSE_CALL GetAllocator ()
const CAllocator *LSE_CALL GetAllocator () const

Protected Types

typedef struct
lstl::CMultiMap::LSTL_PAIR
LPLSTL_PAIR
typedef struct
lstl::CMultiMap::LSTL_PAIR 
LPCLSTL_PAIR

Protected Attributes

CVector< LSTL_PAIR, LSUINT32, 1024UL > m_vPairs

Member Typedef Documentation

Our internal representation of the mapped values. These are sorted by key.


Member Function Documentation

CAllocator* LSE_CALL lstl::CMultiMap::GetAllocator ( ) [inline]

Get our allocator.

Returns:
Returns a pointer to the allocator used by this object.
const CAllocator* LSE_CALL lstl::CMultiMap::GetAllocator ( ) const [inline]

Get our allocator.

Returns:
Returns a pointer to the allocator used by this object.
_tMappedType& LSE_CALL lstl::CMultiMap::GetByIndex ( LSUINT32  _ui32KeyIndex,
LSUINT32  _ui32Index 
) [inline]

Get a mapped value by index. _ui32KeyIndex is the index of the key containing the mapped value to get.

Parameters:
_ui32KeyIndexThe index of the key containing the mapped value to get. Index must be less than Length().
_ui32IndexThe index of the mapped value to get. Must be less than ItemsOnKey( _ui32KeyIndex ).
Returns:
Returns a reference to the mapped value at the given index inside this map.
const _tMappedType& LSE_CALL lstl::CMultiMap::GetByIndex ( LSUINT32  _ui32KeyIndex,
LSUINT32  _ui32Index 
) const [inline]

Get a mapped value by index. _ui32KeyIndex is the index of the key containing the mapped value to get.

Parameters:
_ui32KeyIndexThe index of the key containing the mapped value to get. Index must be less than Length().
_ui32IndexThe index of the mapped value to get. Must be less than ItemsOnKey( _ui32KeyIndex ).
Returns:
Returns a reference to the mapped value at the given index inside this map.
LSBOOL LSE_CALL lstl::CMultiMap::GetItemIndex ( const _tKeyType &  _tKey,
LSUINT32 &  _ui32Index 
) const [inline]

Get the index of an existing item. If the item does not exist, the index indicates where it should be if it did exist.

Parameters:
_tKeyKey of the item to find.
_ui32IndexThe returned index of the found item or the index where the item should be inserted.
Returns:
Returns true if the item exists, false otherwise.
LSBOOL LSE_CALL lstl::CMultiMap::Insert ( const _tKeyType &  _tKey,
const _tMappedType &  _tValue,
_tMappedType **  _pptReturnValue = NULL 
) [inline]

Insert a single pair of a key and its mapped value. If the given key does not exist, it is added to the multimap. If it does exist, the mapped value is added to its associations.

Parameters:
_tKeyThe pair's key.
_tValueThe pair's mapped value.
_pptReturnValueThe returned mapped value.
Returns:
Returns true if the item was added or already exists. A return of false always indicates a memory failure.
LSUINT32 LSE_CALL lstl::CMultiMap::ItemsOnKey ( LSUINT32  _ui32Index) const [inline]

Get the number of mapped values associated with the key at the given index.

Parameters:
_ui32KeyIndexThe index of the key whose total mapped values is to be found.
Returns:
Returns the total mapped values associated with the key at the given index.
LSUINT32 LSE_CALL lstl::CMultiMap::Length ( ) const [inline]

Get the total number of unique keys.

Returns:
Returns the total unique keys in the multimap.
CMultiMap& LSE_CALL lstl::CMultiMap::operator= ( const CMultiMap _mmOther) [inline]

Copy operator.

Parameters:
_mmOtherThe object to copy.
Returns:
Returns this object after the copy.
LSVOID LSE_CALL lstl::CMultiMap::Remove ( const _tKeyType *  _ptKeys,
LSUINT32  _ui32Total 
) [inline]

Remove an array of items.

Parameters:
_ptKeysThe keys of the items to remove.
_ui32TotalThe total number of pairs to remove.
LSVOID LSE_CALL lstl::CMultiMap::Remove ( const _tKeyType &  _tKey) [inline]

Remove a pair.

Parameters:
_tKeyThe key of the pair to remove.
LSVOID LSE_CALL lstl::CMultiMap::RemoveNoDealloc ( const _tKeyType &  _tKey) [inline]

Remove a pair without reallocating.

Parameters:
_tKeyThe key of the pair to remove.
LSVOID LSE_CALL lstl::CMultiMap::RemoveNoDealloc ( const _tKeyType *  _ptKeys,
LSUINT32  _ui32Total 
) [inline]

Remove an array of items without reallocating.

Parameters:
_ptKeysThe keys of the items to remove.
_ui32TotalThe total number of pairs to remove.
LSVOID LSE_CALL lstl::CMultiMap::Reset ( ) [inline]

Reset all contents.

LSVOID LSE_CALL lstl::CMultiMap::ResetNoDealloc ( ) [inline]

Reset without reallocating.

LSVOID LSE_CALL lstl::CMultiMap::SetAllocator ( CAllocator _paAllocator) [inline]

Set the allocator. Causes the object to be fully reset. Should not be used on lists that have contents already.

Parameters:
_paAllocatorThe new allocator to be used by this object or NULL to use the default allocator for map objects.

Member Data Documentation

CVector<LSTL_PAIR, LSUINT32, 1024UL> lstl::CMultiMap::m_vPairs [protected]

Our list of keys and their associated (possibly multiple) values.


The documentation for this class was generated from the following file:
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator