Open CASCADE Technology 6.6.0
Data Structures | Public Member Functions
NCollection_Map< TheKeyType, Hasher > Class Template Reference

#include <NCollection_Map.hxx>

Inheritance diagram for NCollection_Map< TheKeyType, Hasher >:
Inheritance graph
[legend]

Data Structures

class  Iterator
 Implementation of the Iterator interface. More...
class  MapNode
 Adaptation of the TListNode to the map notations. More...

Public Member Functions

 NCollection_Map (const Standard_Integer NbBuckets=1, const Handle< NCollection_BaseAllocator > &theAllocator=0L)
 Constructor.
 NCollection_Map (const NCollection_Map &theOther)
 Copy constructor.
virtual void Assign (const NCollection_BaseCollection< TheKeyType > &theOther)
 Assign another collection.
NCollection_Mapoperator= (const NCollection_Map &theOther)
 = another map
void ReSize (const Standard_Integer N)
 ReSize.
Standard_Boolean Add (const TheKeyType &K)
 Add.
const TheKeyType & Added (const TheKeyType &K)
 Added: add a new key if not yet in the map, and return reference to either newly added or previously existing object.
Standard_Boolean Contains (const TheKeyType &K) const
 Contains.
Standard_Boolean Remove (const TheKeyType &K)
 Remove.
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_Map (void)
 Destructor.
virtual Standard_Integer Size (void) const
 Size.

Detailed Description

template<class TheKeyType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
class NCollection_Map< TheKeyType, Hasher >

Purpose: Single hashed Map. This Map is used to store and retrieve keys in linear time.

The ::Iterator class can be used to explore the content of the map. It is not wise to iterate and modify a map in parallel.

To compute the hashcode of the key the function HashCode must be defined in the global namespace

To compare two keys the function IsEqual must be defined in the global namespace.

The performance of a Map is conditionned by its number of buckets that should be kept greater to the number of keys. This map has an automatic management of the number of buckets. It is resized when the number of Keys becomes greater than the number of buckets.

If you have a fair idea of the number of objects you can save on automatic resizing by giving a number of buckets at creation or using the ReSize method. This should be consider only for crucial optimisation issues.


Constructor & Destructor Documentation

template<class TheKeyType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
NCollection_Map< TheKeyType, Hasher >::NCollection_Map ( const Standard_Integer  NbBuckets = 1,
const Handle< NCollection_BaseAllocator > &  theAllocator = 0L 
) [inline]
template<class TheKeyType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
NCollection_Map< TheKeyType, Hasher >::NCollection_Map ( const NCollection_Map< TheKeyType, Hasher > &  theOther) [inline]
template<class TheKeyType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
NCollection_Map< TheKeyType, Hasher >::~NCollection_Map ( void  ) [inline]

Member Function Documentation

template<class TheKeyType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
Standard_Boolean NCollection_Map< TheKeyType, Hasher >::Add ( const TheKeyType &  K) [inline]
template<class TheKeyType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
const TheKeyType& NCollection_Map< TheKeyType, Hasher >::Added ( const TheKeyType &  K) [inline]
template<class TheKeyType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
virtual void NCollection_Map< TheKeyType, Hasher >::Assign ( const NCollection_BaseCollection< TheKeyType > &  theOther) [inline, virtual]
template<class TheKeyType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
void NCollection_Map< TheKeyType, Hasher >::Clear ( const Handle< NCollection_BaseAllocator > &  theAllocator) [inline]
template<class TheKeyType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
void NCollection_Map< TheKeyType, Hasher >::Clear ( const Standard_Boolean  doReleaseMemory = Standard_True) [inline]
template<class TheKeyType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
Standard_Boolean NCollection_Map< TheKeyType, Hasher >::Contains ( const TheKeyType &  K) const [inline]
template<class TheKeyType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
NCollection_Map& NCollection_Map< TheKeyType, Hasher >::operator= ( const NCollection_Map< TheKeyType, Hasher > &  theOther) [inline]
template<class TheKeyType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
Standard_Boolean NCollection_Map< TheKeyType, Hasher >::Remove ( const TheKeyType &  K) [inline]
template<class TheKeyType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
void NCollection_Map< TheKeyType, Hasher >::ReSize ( const Standard_Integer  N) [inline]
template<class TheKeyType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
virtual Standard_Integer NCollection_Map< TheKeyType, Hasher >::Size ( void  ) const [inline, virtual]

The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines