Open CASCADE Technology  6.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Data Structures | Public Member Functions
NCollection_DataMap< TheKeyType, TheItemType, Hasher > Class Template Reference

#include <NCollection_DataMap.hxx>

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

Data Structures

class  DataMapNode
 
class  Iterator
 

Public Member Functions

 NCollection_DataMap (const Standard_Integer NbBuckets=1, const Handle< NCollection_BaseAllocator > &theAllocator=0L)
 Constructor. More...
 
 NCollection_DataMap (const NCollection_DataMap &theOther)
 Copy constructor. More...
 
virtual void Assign (const NCollection_BaseCollection< TheItemType > &theOther)
 Assign another collection. More...
 
void Exchange (NCollection_DataMap &theOther)
 Exchange the content of two maps without re-allocations. Notice that allocators will be swapped as well! More...
 
NCollection_DataMapoperator= (const NCollection_DataMap &theOther)
 = another map More...
 
void ReSize (const Standard_Integer N)
 ReSize. More...
 
Standard_Boolean Bind (const TheKeyType &theKey, const TheItemType &theItem)
 Bind. More...
 
Standard_Boolean IsBound (const TheKeyType &K) const
 IsBound. More...
 
Standard_Boolean UnBind (const TheKeyType &K)
 UnBind. More...
 
const TheItemType & Find (const TheKeyType &theKey) const
 Find. More...
 
Standard_Boolean Find (const TheKeyType &theKey, TheItemType &theValue) const
 Find value for key with copying. More...
 
const TheItemType & operator() (const TheKeyType &theKey) const
 operator () More...
 
TheItemType & ChangeFind (const TheKeyType &theKey)
 ChangeFind. More...
 
TheItemType & operator() (const TheKeyType &theKey)
 operator () More...
 
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. More...
 
void Clear (const Handle< NCollection_BaseAllocator > &theAllocator)
 Clear data and reset allocator. More...
 
 ~NCollection_DataMap (void)
 Destructor. More...
 
virtual Standard_Integer Size (void) const
 Size. More...
 
- Public Member Functions inherited from NCollection_BaseCollection< TheItemType >
 NCollection_BaseCollection (const Handle< NCollection_BaseAllocator > &theAllocator=0L)
 Common for all collections constructor takes care of theAllocator. More...
 
virtual ~NCollection_BaseCollection (void)
 Destructor - must be implemented to release the memory. More...
 
const Handle
< NCollection_BaseAllocator > & 
Allocator () const
 Returns attached allocator. More...
 
- Public Member Functions inherited from NCollection_BaseMap
Standard_Integer NbBuckets () const
 NbBuckets. More...
 
Standard_Integer Extent () const
 Extent. More...
 
Standard_Boolean IsEmpty () const
 IsEmpty. More...
 
void Statistics (Standard_OStream &S) const
 Statistics. More...
 

Additional Inherited Members

- Protected Member Functions inherited from NCollection_BaseCollection< TheItemType >
const Handle
< NCollection_BaseAllocator > & 
IterAllocator (void) const
 
void exchangeAllocators (NCollection_BaseCollection &theOther)
 Exchange allocators of two collections. More...
 
- Protected Member Functions inherited from NCollection_BaseMap
 NCollection_BaseMap (const Standard_Integer NbBuckets, const Standard_Boolean single)
 Constructor. More...
 
Standard_Boolean BeginResize (const Standard_Integer NbBuckets, Standard_Integer &NewBuckets, NCollection_ListNode **&data1, NCollection_ListNode **&data2, Handle< NCollection_BaseAllocator > &theAllocator) const
 BeginResize. More...
 
void EndResize (const Standard_Integer NbBuckets, const Standard_Integer NewBuckets, NCollection_ListNode **data1, NCollection_ListNode **data2, Handle< NCollection_BaseAllocator > &theAllocator)
 EndResize. More...
 
Standard_Boolean Resizable () const
 Resizable. More...
 
void Increment ()
 Increment. More...
 
void Decrement ()
 Decrement. More...
 
void Destroy (NCollection_DelMapNode fDel, Handle< NCollection_BaseAllocator > &theAllocator, const Standard_Boolean doReleaseMemory=Standard_True)
 Destroy. More...
 
Standard_Integer NextPrimeForMap (const Standard_Integer N) const
 NextPrimeForMap. More...
 
void exchangeMapsData (NCollection_BaseMap &theOther)
 Exchange content of two maps without data copying. More...
 
- Protected Attributes inherited from NCollection_BaseCollection< TheItemType >
Handle< NCollection_BaseAllocatormyAllocator
 
- Protected Attributes inherited from NCollection_BaseMap
NCollection_ListNode ** myData1
 
NCollection_ListNode ** myData2
 

Detailed Description

template<class TheKeyType, class TheItemType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
class NCollection_DataMap< TheKeyType, TheItemType, Hasher >

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, class Hasher = NCollection_DefaultHasher<TheKeyType>>
NCollection_DataMap< TheKeyType, TheItemType, Hasher >::NCollection_DataMap ( const Standard_Integer  NbBuckets = 1,
const Handle< NCollection_BaseAllocator > &  theAllocator = 0L 
)
inline

Constructor.

template<class TheKeyType, class TheItemType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
NCollection_DataMap< TheKeyType, TheItemType, Hasher >::NCollection_DataMap ( const NCollection_DataMap< TheKeyType, TheItemType, Hasher > &  theOther)
inline

Copy constructor.

template<class TheKeyType, class TheItemType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
NCollection_DataMap< TheKeyType, TheItemType, Hasher >::~NCollection_DataMap ( void  )
inline

Destructor.

Member Function Documentation

template<class TheKeyType, class TheItemType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
virtual void NCollection_DataMap< TheKeyType, TheItemType, Hasher >::Assign ( const NCollection_BaseCollection< TheItemType > &  theOther)
inlinevirtual

Assign another collection.

Implements NCollection_BaseCollection< TheItemType >.

template<class TheKeyType, class TheItemType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
Standard_Boolean NCollection_DataMap< TheKeyType, TheItemType, Hasher >::Bind ( const TheKeyType &  theKey,
const TheItemType &  theItem 
)
inline

Bind.

template<class TheKeyType, class TheItemType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
TheItemType& NCollection_DataMap< TheKeyType, TheItemType, Hasher >::ChangeFind ( const TheKeyType &  theKey)
inline

ChangeFind.

template<class TheKeyType, class TheItemType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
void NCollection_DataMap< TheKeyType, TheItemType, Hasher >::Clear ( const Standard_Boolean  doReleaseMemory = Standard_True)
inline

Clear data. If doReleaseMemory is false then the table of buckets is not released and will be reused.

template<class TheKeyType, class TheItemType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
void NCollection_DataMap< TheKeyType, TheItemType, Hasher >::Clear ( const Handle< NCollection_BaseAllocator > &  theAllocator)
inline

Clear data and reset allocator.

template<class TheKeyType, class TheItemType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
void NCollection_DataMap< TheKeyType, TheItemType, Hasher >::Exchange ( NCollection_DataMap< TheKeyType, TheItemType, Hasher > &  theOther)
inline

Exchange the content of two maps without re-allocations. Notice that allocators will be swapped as well!

template<class TheKeyType, class TheItemType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
const TheItemType& NCollection_DataMap< TheKeyType, TheItemType, Hasher >::Find ( const TheKeyType &  theKey) const
inline

Find.

template<class TheKeyType, class TheItemType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
Standard_Boolean NCollection_DataMap< TheKeyType, TheItemType, Hasher >::Find ( const TheKeyType &  theKey,
TheItemType &  theValue 
) const
inline

Find value for key with copying.

Returns
true if key was found
template<class TheKeyType, class TheItemType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
Standard_Boolean NCollection_DataMap< TheKeyType, TheItemType, Hasher >::IsBound ( const TheKeyType &  K) const
inline

IsBound.

template<class TheKeyType, class TheItemType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
const TheItemType& NCollection_DataMap< TheKeyType, TheItemType, Hasher >::operator() ( const TheKeyType &  theKey) const
inline

operator ()

template<class TheKeyType, class TheItemType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
TheItemType& NCollection_DataMap< TheKeyType, TheItemType, Hasher >::operator() ( const TheKeyType &  theKey)
inline

operator ()

template<class TheKeyType, class TheItemType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
NCollection_DataMap& NCollection_DataMap< TheKeyType, TheItemType, Hasher >::operator= ( const NCollection_DataMap< TheKeyType, TheItemType, Hasher > &  theOther)
inline

= another map

template<class TheKeyType, class TheItemType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
void NCollection_DataMap< TheKeyType, TheItemType, Hasher >::ReSize ( const Standard_Integer  N)
inline

ReSize.

template<class TheKeyType, class TheItemType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
virtual Standard_Integer NCollection_DataMap< TheKeyType, TheItemType, Hasher >::Size ( void  ) const
inlinevirtual
template<class TheKeyType, class TheItemType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
Standard_Boolean NCollection_DataMap< TheKeyType, TheItemType, Hasher >::UnBind ( const TheKeyType &  K)
inline

UnBind.


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