Torque2D Reference
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
HashMap< Key, Value, Sequence > Class Template Reference

#include <hashTable.h>

+ Inheritance diagram for HashMap< Key, Value, Sequence >:

Public Types

typedef Parent::Pair Pair
 
typedef Pair ValueType
 
typedef PairReference
 
typedef const PairConstReference
 
typedef Parent::iterator iterator
 
typedef Parent::const_iterator const_iterator
 
typedef S32 DifferenceType
 
typedef U32 SizeType
 

Public Member Functions

 HashMap ()
 
 ~HashMap ()
 
 HashMap (const HashMap &p)
 
U32 size () const
 Return the number of elements.
 
void clear ()
 Empty the HashMap.
 
bool isEmpty () const
 Returns true if the map is empty.
 
iterator insert (const Key &key, const Value &)
 
void erase (iterator)
 Erase the given entry.
 
void erase (const Key &key)
 Erase the key from the map.
 
iterator find (const Key &)
 Find entry for the given key.
 
const_iterator find (const Key &) const
 Find entry for the given key.
 
bool contains (const Key &a)
 
iterator begin ()
 iterator to first element
 
const_iterator begin () const
 iterator to first element
 
iterator end ()
 IIterator to last element + 1.
 
const_iterator end () const
 iterator to last element + 1
 
Value & operator[] (const Key &)
 Index using the given key. If the key is not currently in the map it is added.
 

Detailed Description

template<typename Key, typename Value, class Sequence = HashTable<Key,Value>>
class HashMap< Key, Value, Sequence >

A HashMap template class. The map class maps between a key and an associated value. Keys are unique. The hash table class is used as the default implementation so the the key must be hashable, see util/hash.h for details.

Member Typedef Documentation

◆ const_iterator

template<typename Key , typename Value , class Sequence = HashTable<Key,Value>>
typedef Parent::const_iterator const_iterator

◆ ConstReference

template<typename Key , typename Value , class Sequence = HashTable<Key,Value>>
typedef const Pair& ConstReference

◆ DifferenceType

template<typename Key , typename Value , class Sequence = HashTable<Key,Value>>
typedef S32 DifferenceType

◆ iterator

template<typename Key , typename Value , class Sequence = HashTable<Key,Value>>
typedef Parent::iterator iterator

◆ Pair

template<typename Key , typename Value , class Sequence = HashTable<Key,Value>>
typedef Parent::Pair Pair

◆ Reference

template<typename Key , typename Value , class Sequence = HashTable<Key,Value>>
typedef Pair& Reference

◆ SizeType

template<typename Key , typename Value , class Sequence = HashTable<Key,Value>>
typedef U32 SizeType

◆ ValueType

template<typename Key , typename Value , class Sequence = HashTable<Key,Value>>
typedef Pair ValueType

Constructor & Destructor Documentation

◆ HashMap() [1/2]

template<typename Key , typename Value , class Sequence = HashTable<Key,Value>>
HashMap ( )
inline

◆ ~HashMap()

template<typename Key , typename Value , class Sequence = HashTable<Key,Value>>
~HashMap ( )
inline

◆ HashMap() [2/2]

template<typename Key , typename Value , class Sequence >
HashMap ( const HashMap< Key, Value, Sequence > &  p)

Member Function Documentation

◆ begin() [1/2]

template<typename Key , typename Value , class Sequence >
HashMap< Key, Value, Sequence >::iterator begin ( )
inline

iterator to first element

◆ begin() [2/2]

template<typename Key , typename Value , class Sequence >
HashMap< Key, Value, Sequence >::const_iterator begin ( ) const
inline

iterator to first element

◆ clear()

template<typename Key , typename Value , class Sequence >
void clear ( )
inline

Empty the HashMap.

◆ contains()

template<typename Key , typename Value , class Sequence = HashTable<Key,Value>>
bool contains ( const Key &  a)
inline

◆ end() [1/2]

template<typename Key , typename Value , class Sequence >
HashMap< Key, Value, Sequence >::iterator end ( )
inline

IIterator to last element + 1.

◆ end() [2/2]

template<typename Key , typename Value , class Sequence >
HashMap< Key, Value, Sequence >::const_iterator end ( ) const
inline

iterator to last element + 1

◆ erase() [1/2]

template<typename Key , typename Value , class Sequence >
void erase ( const Key &  key)

Erase the key from the map.

◆ erase() [2/2]

template<typename Key , typename Value , class Sequence >
void erase ( iterator  node)

Erase the given entry.

◆ find() [1/2]

template<typename Key , typename Value , class Sequence >
HashMap< Key, Value, Sequence >::iterator find ( const Key &  key)

Find entry for the given key.

◆ find() [2/2]

template<typename Key , typename Value , class Sequence = HashTable<Key,Value>>
const_iterator find ( const Key &  ) const

Find entry for the given key.

◆ insert()

template<typename Key , typename Value , class Sequence >
HashMap< Key, Value, Sequence >::iterator insert ( const Key &  key,
const Value &  x 
)

Insert the key value pair but don't allow duplicates. The map class does not allow duplicates keys. If the key already exists in the map the function will fail and return end().

◆ isEmpty()

template<typename Key , typename Value , class Sequence >
bool isEmpty ( ) const
inline

Returns true if the map is empty.

◆ operator[]()

template<typename Key , typename Value , class Sequence >
Value & operator[] ( const Key &  key)
inline

Index using the given key. If the key is not currently in the map it is added.

◆ size()

template<typename Key , typename Value , class Sequence >
U32 size ( ) const
inline

Return the number of elements.


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