# FoundationClasses
TKernel
NCollection

# FoundationClasses
TKernel
NCollection

# NCollection_DataMap< TheKeyType, TheItemType > Class Template Reference

`#include <NCollection_DataMap.hxx>`

Inheritance diagram for NCollection_DataMap< TheKeyType, TheItemType >:

[legend]

## Public Member Functions

| NCollection_DataMap (const Standard_Integer NbBuckets=1, const Handle(NCollection_BaseAllocator)&theAllocator=0L)
| Constructor.
| NCollection_DataMap (const NCollection_DataMap &theOther)
| Copy constructor.
virtual void | Assign (const NCollection_BaseCollection< TheItemType > &theOther)
| Assign another collection.
NCollection_DataMap & | operator= (const NCollection_DataMap &theOther)
| = another map
void | ReSize (const Standard_Integer N)
| ReSize.
Standard_Boolean | Bind (const TheKeyType &theKey, const TheItemType &theItem)
| Bind.
Standard_Boolean | IsBound (const TheKeyType &K) const
| IsBound.
Standard_Boolean | UnBind (const TheKeyType &K)
| UnBind.
const TheItemType & | Find (const TheKeyType &theKey) const
| Find.
const TheItemType & | operator() (const TheKeyType &theKey) const
| operator ()
TheItemType & | ChangeFind (const TheKeyType &theKey)
| ChangeFind.
TheItemType & | operator() (const TheKeyType &theKey)
| operator ()
void | Clear (const Standard_Boolean doReleaseMemory=Standard_True)
| Clear data. If doReleaseMemory is false then the table of buckets is not released and will be reused.
void | Clear (const Handle(NCollection_BaseAllocator)&theAllocator)
| Clear data and reset allocator.
| ~NCollection_DataMap (void)
| Destructor.
virtual Standard_Integer | Size (void) const
| Size.

## Private Member Functions

virtual TYPENAME NCollection_BaseCollection< TheItemType >::Iterator & | CreateIterator (void) const
| Creates Iterator for use on BaseCollection.

## Data Structures

class | DataMapNode
class | Iterator

## Detailed Description

### template<class TheKeyType, class TheItemType>
class NCollection_DataMap< TheKeyType, TheItemType >

Purpose: The DataMap is a Map to store keys with associated Items. See Map from NCollection for a discussion about the number of buckets.

The DataMap can be seen as an extended array where the Keys are the indices. For this reason the operator () is defined on DataMap to fetch an Item from a Key. So the following syntax can be used :

anItem = aMap(aKey); aMap(aKey) = anItem;

This analogy has its limit. aMap(aKey) = anItem can be done only if aKey was previously bound to an item in the map.

## Constructor & Destructor Documentation

template<class TheKeyType, class TheItemType>
NCollection_DataMap< TheKeyType, TheItemType >::NCollection_DataMap | ( | const Standard_Integer | NbBuckets = `1`,
|  | const Handle(NCollection_BaseAllocator)& | theAllocator = `0L`
| ) | `[inline]`

template<class TheKeyType, class TheItemType>
NCollection_DataMap< TheKeyType, TheItemType >::NCollection_DataMap | ( | const NCollection_DataMap< TheKeyType, TheItemType > & | theOther | ) | `[inline]`

template<class TheKeyType, class TheItemType>
NCollection_DataMap< TheKeyType, TheItemType >::~NCollection_DataMap | ( | void |  | ) | `[inline]`

## Member Function Documentation

template<class TheKeyType, class TheItemType>
virtual void NCollection_DataMap< TheKeyType, TheItemType >::Assign | ( | const NCollection_BaseCollection< TheItemType > & | theOther | ) | `[inline, virtual]`

template<class TheKeyType, class TheItemType>
Standard_Boolean NCollection_DataMap< TheKeyType, TheItemType >::Bind | ( | const TheKeyType & | theKey,
|  | const TheItemType & | theItem
| ) | `[inline]`

template<class TheKeyType, class TheItemType>
TheItemType& NCollection_DataMap< TheKeyType, TheItemType >::ChangeFind | ( | const TheKeyType & | theKey | ) | `[inline]`

template<class TheKeyType, class TheItemType>
void NCollection_DataMap< TheKeyType, TheItemType >::Clear | ( | const Handle(NCollection_BaseAllocator)& | theAllocator | ) | `[inline]`

template<class TheKeyType, class TheItemType>
void NCollection_DataMap< TheKeyType, TheItemType >::Clear | ( | const Standard_Boolean | doReleaseMemory = `Standard_True` | ) | `[inline]`

template<class TheKeyType, class TheItemType>
virtual TYPENAME NCollection_BaseCollection<TheItemType>::Iterator& NCollection_DataMap< TheKeyType, TheItemType >::CreateIterator | ( | void |  | ) | const`[inline, private, virtual]`

| Implements NCollection_BaseCollection< TheItemType >.

template<class TheKeyType, class TheItemType>
const TheItemType& NCollection_DataMap< TheKeyType, TheItemType >::Find | ( | const TheKeyType & | theKey | ) | const`[inline]`

template<class TheKeyType, class TheItemType>
Standard_Boolean NCollection_DataMap< TheKeyType, TheItemType >::IsBound | ( | const TheKeyType & | K | ) | const`[inline]`

template<class TheKeyType, class TheItemType>
TheItemType& NCollection_DataMap< TheKeyType, TheItemType >::operator() | ( | const TheKeyType & | theKey | ) | `[inline]`

template<class TheKeyType, class TheItemType>
const TheItemType& NCollection_DataMap< TheKeyType, TheItemType >::operator() | ( | const TheKeyType & | theKey | ) | const`[inline]`

template<class TheKeyType, class TheItemType>
NCollection_DataMap& NCollection_DataMap< TheKeyType, TheItemType >::operator= | ( | const NCollection_DataMap< TheKeyType, TheItemType > & | theOther | ) | `[inline]`

template<class TheKeyType, class TheItemType>
void NCollection_DataMap< TheKeyType, TheItemType >::ReSize | ( | const Standard_Integer | N | ) | `[inline]`

template<class TheKeyType, class TheItemType>
virtual Standard_Integer NCollection_DataMap< TheKeyType, TheItemType >::Size | ( | void |  | ) | const`[inline, virtual]`

| Implements NCollection_BaseCollection< TheItemType >.

template<class TheKeyType, class TheItemType>
Standard_Boolean NCollection_DataMap< TheKeyType, TheItemType >::UnBind | ( | const TheKeyType & | K | ) | `[inline]`

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

- NCollection_DataMap.hxx