Torque2D Reference

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

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 Pair & | Reference
typedef const Pair & | ConstReference
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. More...
void | clear ()
| Empty the HashMap. More...
bool | isEmpty () const
| Returns true if the map is empty. More...
iterator | insert (const Key &key, const Value &)
void | erase (iterator)
| Erase the given entry. More...
void | erase (const Key &key)
| Erase the key from the map. More...
iterator | find (const Key &)
| Find entry for the given key. More...
const_iterator | find (const Key &) const
| Find entry for the given key. More...
bool | contains (const Key &a)
iterator | begin ()
| iterator to first element More...
const_iterator | begin () const
| iterator to first element More...
iterator | end ()
| IIterator to last element + 1. More...
const_iterator | end () const
| iterator to last element + 1 More...
Value & | operator[] (const Key &)
| Index using the given key. If the key is not currently in the map it is added. More...

## 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

typedef Parent::const_iterator const_iterator

typedef const Pair& ConstReference

typedef S32 DifferenceType

typedef Parent::iterator iterator

typedef Parent::Pair Pair

typedef Pair& Reference

typedef U32 SizeType

typedef Pair ValueType

## Constructor & Destructor Documentation

HashMap | ( |  | ) |
| inline

~HashMap | ( |  | ) |
| inline

HashMap | ( | const HashMap< Key, Value, Sequence > & | p | ) |

## Member Function Documentation

HashMap< Key, Value, Sequence >::iterator begin | ( |  | ) |
| inline

iterator to first element

HashMap< Key, Value, Sequence >::const_iterator begin | ( |  | ) | const
| inline

iterator to first element

void clear | ( |  | ) |
| inline

Empty the HashMap.

bool contains | ( | const Key & | a | ) |
| inline

HashMap< Key, Value, Sequence >::iterator end | ( |  | ) |
| inline

IIterator to last element + 1.

HashMap< Key, Value, Sequence >::const_iterator end | ( |  | ) | const
| inline

iterator to last element + 1

void erase | ( | iterator | node | ) |

Erase the given entry.

void erase | ( | const Key & | key | ) |

Erase the key from the map.

HashMap< Key, Value, Sequence >::iterator find | ( | const Key & | key | ) |

Find entry for the given key.

const_iterator find | ( | const Key & |  | ) | const

Find entry for the given key.

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().

bool isEmpty | ( |  | ) | const
| inline

Returns true if the map is empty.

Value & operator[] | ( | const Key & | key | ) |
| inline

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

U32 size | ( |  | ) | const
| inline

Return the number of elements.

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

- collection/hashTable.h