PixelLightAPI  .
Public Member Functions
PLCore::SimpleMap< KeyType, ValueType, Comparer > Class Template Reference

Simple map template. More...

#include <SimpleMap.h>

Inheritance diagram for PLCore::SimpleMap< KeyType, ValueType, Comparer >:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 SimpleMap ()
 Constructor.
virtual ~SimpleMap ()
 Destructor.
Map< KeyType, ValueType > & operator= (const SimpleMap< KeyType, ValueType, Comparer > &cSource)
 Copy operator.
virtual Iterator< ValueType > GetIterator (uint32 nIndex=0) const override
 Returns an iterator operating on the derived data structure.
virtual ConstIterator< ValueType > GetConstIterator (uint32 nIndex=0) const override
 Returns a constant iterator operating on the derived data structure.
virtual Iterator< ValueType > GetEndIterator () const override
 Returns an iterator operating on the derived data structure and starting at the end.
virtual ConstIterator< ValueType > GetConstEndIterator () const override
 Returns a constant iterator operating on the derived data structure and starting at the end.
virtual void Clear () override
 Clears the map.
virtual bool IsEmpty () const override
 Checks whether the map is complete empty.
virtual uint32 GetNumOfElements () const override
 Returns the number of elements/entries.
virtual bool Add (const KeyType &Key, const ValueType &Value) override
 Adds/puts a new element to the map.
virtual bool Replace (const KeyType &Key, const ValueType &NewValue) override
 Replaces the value of a map element.
virtual bool Set (const KeyType &Key, const ValueType &Value) override
 Sets (adds or replaces) the value of a map element.
virtual bool Remove (const KeyType &Key) override
 Removes an element from the map.
virtual uint32 RemoveValue (const ValueType &Value) override
 Removes all elements with a certain value from the map.
virtual const ValueType & Get (const KeyType &Key) const override
 Returns the value of a given key.
virtual ValueType & Get (const KeyType &Key) override
 Returns the value of a given key.
virtual Iterator< KeyType > GetKeyIterator (uint32 nIndex=0) const override
 Returns a key iterator operating on the derived data structure.
virtual ConstIterator< KeyType > GetConstKeyIterator (uint32 nIndex=0) const override
 Returns a constant key iterator operating on the derived data structure.
virtual Iterator< KeyType > GetEndKeyIterator () const override
 Returns a key iterator operating on the derived data structure and starting at the end.
virtual ConstIterator< KeyType > GetConstEndKeyIterator () const override
 Returns a constant key iterator operating on the derived data structure and starting at the end.

Detailed Description

template<class KeyType, class ValueType, class Comparer = CompareFunction>
class PLCore::SimpleMap< KeyType, ValueType, Comparer >

Simple map template.

Remarks:
This map implementation is quite simple, but not that performant. It's not recommended to use this implementation if you have a lot of elements within the map.

Constructor & Destructor Documentation

template<class KeyType , class ValueType , class Comparer >
PLCore::SimpleMap< KeyType, ValueType, Comparer >::SimpleMap ( )
template<class KeyType , class ValueType , class Comparer >
PLCore::SimpleMap< KeyType, ValueType, Comparer >::~SimpleMap ( ) [virtual]

Destructor.


Member Function Documentation

template<class KeyType , class ValueType , class Comparer >
Map< KeyType, ValueType > & PLCore::SimpleMap< KeyType, ValueType, Comparer >::operator= ( const SimpleMap< KeyType, ValueType, Comparer > &  cSource)

Copy operator.

Parameters:
[in]cSource'SimpleMap' to copy from
Returns:
Reference to this instance
template<class KeyType , class ValueType , class Comparer >
Iterator< ValueType > PLCore::SimpleMap< KeyType, ValueType, Comparer >::GetIterator ( uint32  nIndex = 0) const [override, virtual]

Returns an iterator operating on the derived data structure.

Parameters:
[in]nIndexStart index, if >= 'total number of elements' the index is set to the last valid index
Returns:
Iterator operating on the derived

Implements PLCore::Iterable< ValueType >.

template<class KeyType , class ValueType , class Comparer >
ConstIterator< ValueType > PLCore::SimpleMap< KeyType, ValueType, Comparer >::GetConstIterator ( uint32  nIndex = 0) const [override, virtual]

Returns a constant iterator operating on the derived data structure.

Parameters:
[in]nIndexStart index, if >= 'total number of elements' the index is set to the last valid index
Returns:
Constant iterator operating on the derived

Implements PLCore::Iterable< ValueType >.

template<class KeyType , class ValueType , class Comparer >
Iterator< ValueType > PLCore::SimpleMap< KeyType, ValueType, Comparer >::GetEndIterator ( ) const [override, virtual]

Returns an iterator operating on the derived data structure and starting at the end.

Returns:
Iterator operating on the derived,
Remarks:
Use this function to get an iterator if you want to iterate in reversed order starting at the end last element.

Implements PLCore::Iterable< ValueType >.

template<class KeyType , class ValueType , class Comparer >
ConstIterator< ValueType > PLCore::SimpleMap< KeyType, ValueType, Comparer >::GetConstEndIterator ( ) const [override, virtual]

Returns a constant iterator operating on the derived data structure and starting at the end.

Returns:
Constant iterator operating on the derived,
Remarks:
Use this function to get a constant iterator if you want to iterate in reversed order starting at the end last element.

Implements PLCore::Iterable< ValueType >.

template<class KeyType , class ValueType , class Comparer >
void PLCore::SimpleMap< KeyType, ValueType, Comparer >::Clear ( ) [override, virtual]

Clears the map.

Implements PLCore::Map< KeyType, ValueType >.

template<class KeyType , class ValueType , class Comparer >
bool PLCore::SimpleMap< KeyType, ValueType, Comparer >::IsEmpty ( ) const [override, virtual]

Checks whether the map is complete empty.

Returns:
'true' if the map is empty, else 'false'

Implements PLCore::Map< KeyType, ValueType >.

template<class KeyType , class ValueType , class Comparer >
uint32 PLCore::SimpleMap< KeyType, ValueType, Comparer >::GetNumOfElements ( ) const [override, virtual]

Returns the number of elements/entries.

Returns:
Number of container elements/entries

Implements PLCore::Map< KeyType, ValueType >.

template<class KeyType , class ValueType , class Comparer >
bool PLCore::SimpleMap< KeyType, ValueType, Comparer >::Add ( const KeyType &  Key,
const ValueType &  Value 
) [override, virtual]

Adds/puts a new element to the map.

Parameters:
[in]KeyThe key of the new element
[in]ValueThe value of the new element
Returns:
'true' if all went fine, else 'false'
Note:
  • You have to check by yourself whether there's already such a key within the map
See also:

Implements PLCore::Map< KeyType, ValueType >.

template<class KeyType , class ValueType , class Comparer >
bool PLCore::SimpleMap< KeyType, ValueType, Comparer >::Replace ( const KeyType &  Key,
const ValueType &  NewValue 
) [override, virtual]

Replaces the value of a map element.

Parameters:
[in]KeyThe key of the element
[in]NewValueThe new value of the element
Returns:
'true' if all went fine, else 'false' (key not found?)
See also:

Implements PLCore::Map< KeyType, ValueType >.

template<class KeyType , class ValueType , class Comparer >
bool PLCore::SimpleMap< KeyType, ValueType, Comparer >::Set ( const KeyType &  Key,
const ValueType &  Value 
) [override, virtual]

Sets (adds or replaces) the value of a map element.

Parameters:
[in]KeyThe key of the element
[in]ValueThe set value of the element
Returns:
'false' if a new element was added, 'true' if the value was replaced
Remarks:
This function is a combination of the add and replace function and 'just' assigns a value to a given key without taking care of whether or not there's already an element with the given key inside the map.
See also:

Implements PLCore::Map< KeyType, ValueType >.

template<class KeyType , class ValueType , class Comparer >
bool PLCore::SimpleMap< KeyType, ValueType, Comparer >::Remove ( const KeyType &  Key) [override, virtual]

Removes an element from the map.

Parameters:
[in]KeyKey of the element which should be removed
Returns:
'true' if all went fine, else 'false'

Implements PLCore::Map< KeyType, ValueType >.

template<class KeyType , class ValueType , class Comparer >
uint32 PLCore::SimpleMap< KeyType, ValueType, Comparer >::RemoveValue ( const ValueType &  Value) [override, virtual]

Removes all elements with a certain value from the map.

Parameters:
[in]ValueValue to look for
Returns:
Number of removed elements
Note:
  • For performance reasons, try to use the Remove(<Key>) function whenever possible!

Implements PLCore::Map< KeyType, ValueType >.

template<class KeyType , class ValueType , class Comparer >
const ValueType & PLCore::SimpleMap< KeyType, ValueType, Comparer >::Get ( const KeyType &  Key) const [override, virtual]

Returns the value of a given key.

Parameters:
[in]KeyKey to use
Returns:
Reference of the value of the given key, reference to the 'Null'-object on error

Implements PLCore::Map< KeyType, ValueType >.

template<class KeyType , class ValueType , class Comparer >
ValueType & PLCore::SimpleMap< KeyType, ValueType, Comparer >::Get ( const KeyType &  Key) [override, virtual]

Returns the value of a given key.

Parameters:
[in]KeyKey to use
Returns:
Reference of the value of the given key, reference to the 'Null'-object on error

Implements PLCore::Map< KeyType, ValueType >.

template<class KeyType , class ValueType , class Comparer >
Iterator< KeyType > PLCore::SimpleMap< KeyType, ValueType, Comparer >::GetKeyIterator ( uint32  nIndex = 0) const [override, virtual]

Returns a key iterator operating on the derived data structure.

Parameters:
[in]nIndexStart index, if >= 'total number of elements' the index is set to the last valid index
Returns:
Key iterator operating on the derived

Implements PLCore::Map< KeyType, ValueType >.

template<class KeyType , class ValueType , class Comparer >
ConstIterator< KeyType > PLCore::SimpleMap< KeyType, ValueType, Comparer >::GetConstKeyIterator ( uint32  nIndex = 0) const [override, virtual]

Returns a constant key iterator operating on the derived data structure.

Parameters:
[in]nIndexStart index, if >= 'total number of elements' the index is set to the last valid index
Returns:
Constant key iterator operating on the derived

Implements PLCore::Map< KeyType, ValueType >.

template<class KeyType , class ValueType , class Comparer >
Iterator< KeyType > PLCore::SimpleMap< KeyType, ValueType, Comparer >::GetEndKeyIterator ( ) const [override, virtual]

Returns a key iterator operating on the derived data structure and starting at the end.

Returns:
Key iterator operating on the derived,
Remarks:
Use this function to get a key iterator if you want to iterate in reversed order starting at the end last element.

Implements PLCore::Map< KeyType, ValueType >.

template<class KeyType , class ValueType , class Comparer >
ConstIterator< KeyType > PLCore::SimpleMap< KeyType, ValueType, Comparer >::GetConstEndKeyIterator ( ) const [override, virtual]

Returns a constant key iterator operating on the derived data structure and starting at the end.

Returns:
Constant key iterator operating on the derived,
Remarks:
Use this function to get a constant key iterator if you want to iterate in reversed order starting at the end last element.

Implements PLCore::Map< KeyType, ValueType >.


The documentation for this class was generated from the following files:


PixelLight PixelLight 0.9.11-R1
Copyright (C) 2002-2012 by The PixelLight Team
Last modified Thu Feb 23 2012 14:09:25
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported