Elm  1.0
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
elm::genstruct::SortedBinMap< K, T, C > Class Template Reference

#include <elm/genstruct/SortedBinMap.h>

Classes

class  Iterator
 
class  KeyIterator
 
class  PairIterator
 

Public Member Functions

 SortedBinMap (void)
 
 SortedBinMap (const SortedBinMap &map)
 
int count (void) const
 
bool contains (const K &item) const
 
bool isEmpty (void) const
 
 operator bool (void) const
 
const T & get (const K &key, const T &def) const
 
Option< T > get (const K &key) const
 
bool hasKey (const K &key) const
 
void put (const K &key, const T &value)
 
void remove (const K &key)
 
void remove (const PairIterator &iter)
 

Detailed Description

template<class K, class T, class C = Comparator<K>>
class elm::genstruct::SortedBinMap< K, T, C >

A map implemented using the SortedBinTree class.

Implemented concepts: concept::Collection, concept::Map.

Parameters
KType of keys,
TType of values,
CUsed comparator (must implement concept::Comparator).

Constructor & Destructor Documentation

template<class K, class T, class C = Comparator<K>>
elm::genstruct::SortedBinMap< K, T, C >::SortedBinMap ( void  )

Build an empty map.

template<class K, class T, class C = Comparator<K>>
elm::genstruct::SortedBinMap< K, T, C >::SortedBinMap ( const SortedBinMap< K, T, C > &  map)

Build a copy of an existing SortedBinMap.

Member Function Documentation

template<class K, class T, class C = Comparator<K>>
bool elm::genstruct::SortedBinMap< K, T, C >::contains ( const K &  key) const

Test if an entry with the given key is in the map.

Parameters
keyKey to look for.
Returns
True if the key is in the map, false else.
template<class K, class T, class C = Comparator<K>>
int elm::genstruct::SortedBinMap< K, T, C >::count ( void  ) const

Count the item of entries in the map.

Returns
Number of entries in the map.
template<class K, class T, class C = Comparator<K>>
T elm::genstruct::SortedBinMap< K, T, C >::get ( const K &  key,
const T &  def 
) const

Look for a value matching the given key.

Parameters
keyKey to look for.
defDefault value returned if the key is not found.
Returns
Found value or the default value.
template<class K, class T, class C = Comparator<K>>
Option< const T > elm::genstruct::SortedBinMap< K, T, C >::get ( const K &  key) const

Look for a value matching the given key.

Parameters
keyKey to look for.
Returns
Optional matching value.
template<class K, class T, class C = Comparator<K>>
bool elm::genstruct::SortedBinMap< K, T, C >::hasKey ( const K &  key) const
template<class K, class T, class C = Comparator<K>>
bool elm::genstruct::SortedBinMap< K, T, C >::isEmpty ( void  ) const

Test if the map is empty.

Returns
True if the map is empty, false else.

Referenced by elm::genstruct::SortedBinMap< char, elm::option::Option * >::operator bool().

template<class K, class T, class C = Comparator<K>>
elm::genstruct::SortedBinMap< K, T, C >::operator bool ( void  ) const

Same !isEmpty().

template<class K, class T, class C = Comparator<K>>
void elm::genstruct::SortedBinMap< K, T, C >::put ( const K &  key,
const T &  value 
)

Put a new value in the map.

Parameters
keyKey of the stored value.
valueStored value.
template<class K, class T, class C = Comparator<K>>
void elm::genstruct::SortedBinMap< K, T, C >::remove ( const K &  key)

Remove a value from the map.

Parameters
keyKey of the value to remove.
Warning
It is an error to pass a key not stored in the map.
template<class K, class T, class C = Comparator<K>>
void elm::genstruct::SortedBinMap< K, T, C >::remove ( const PairIterator iter)

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