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_IndexedDataMap< TheKeyType, TheItemType, Hasher > Class Template Reference

#include <NCollection_IndexedDataMap.hxx>

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

Data Structures

class  Iterator
 Implementation of the Iterator interface. More...
 

Public Member Functions

 NCollection_IndexedDataMap (const Standard_Integer NbBuckets=1, const Handle< NCollection_BaseAllocator > &theAllocator=0L)
 Constructor. More...
 
 NCollection_IndexedDataMap (const NCollection_IndexedDataMap &theOther)
 Copy constructor. More...
 
virtual void Assign (const NCollection_BaseCollection< TheItemType > &theOther)
 Assign another collection. More...
 
void Exchange (NCollection_IndexedDataMap &theOther)
 Exchange the content of two maps without re-allocations. Notice that allocators will be swapped as well! More...
 
NCollection_IndexedDataMapoperator= (const NCollection_IndexedDataMap &theOther)
 = another map More...
 
void ReSize (const Standard_Integer N)
 ReSize. More...
 
Standard_Integer Add (const TheKeyType &theKey1, const TheItemType &theItem)
 Add. More...
 
Standard_Boolean Contains (const TheKeyType &theKey1) const
 Contains. More...
 
void Substitute (const Standard_Integer theIndex, const TheKeyType &theKey1, const TheItemType &theItem)
 Substitute. More...
 
void RemoveLast (void)
 RemoveLast. More...
 
const TheKeyType & FindKey (const Standard_Integer theKey2) const
 FindKey. More...
 
const TheItemType & FindFromIndex (const Standard_Integer theKey2) const
 FindFromIndex. More...
 
const TheItemType & operator() (const Standard_Integer theKey2) const
 operator () More...
 
TheItemType & ChangeFromIndex (const Standard_Integer theKey2)
 ChangeFromIndex. More...
 
TheItemType & operator() (const Standard_Integer theKey2)
 operator () More...
 
Standard_Integer FindIndex (const TheKeyType &theKey1) const
 FindIndex. More...
 
const TheItemType & FindFromKey (const TheKeyType &theKey1) const
 FindFromKey. More...
 
TheItemType & ChangeFromKey (const TheKeyType &theKey1)
 ChangeFromKey. More...
 
Standard_Boolean FindFromKey (const TheKeyType &theKey1, TheItemType &theValue) const
 Find value for key with copying. 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_IndexedDataMap (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_IndexedDataMap< TheKeyType, TheItemType, Hasher >

Purpose: An indexed map is used to store keys and to bind an index to them. Each new key stored in the map gets an index. Index are incremented as keys are stored in the map. A key can be found by the index and an index by the key. No key but the last can be removed so the indices are in the range 1.. Extent. An Item is stored with each key.

This class is similar to IndexedMap from NCollection with the Item as a new feature. Note the important difference on the operator (). In the IndexedMap this operator returns the Key. In the IndexedDataMap this operator returns the Item.

See the class Map from NCollection for a discussion about the number of buckets.

Constructor & Destructor Documentation

template<class TheKeyType, class TheItemType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
NCollection_IndexedDataMap< TheKeyType, TheItemType, Hasher >::NCollection_IndexedDataMap ( const Standard_Integer  NbBuckets = 1,
const Handle< NCollection_BaseAllocator > &  theAllocator = 0L 
)
inline

Constructor.

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

Copy constructor.

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

Destructor.

Member Function Documentation

template<class TheKeyType, class TheItemType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
Standard_Integer NCollection_IndexedDataMap< TheKeyType, TheItemType, Hasher >::Add ( const TheKeyType &  theKey1,
const TheItemType &  theItem 
)
inline

Add.

template<class TheKeyType, class TheItemType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
virtual void NCollection_IndexedDataMap< 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>>
TheItemType& NCollection_IndexedDataMap< TheKeyType, TheItemType, Hasher >::ChangeFromIndex ( const Standard_Integer  theKey2)
inline

ChangeFromIndex.

template<class TheKeyType, class TheItemType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
TheItemType& NCollection_IndexedDataMap< TheKeyType, TheItemType, Hasher >::ChangeFromKey ( const TheKeyType &  theKey1)
inline

ChangeFromKey.

template<class TheKeyType, class TheItemType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
void NCollection_IndexedDataMap< 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_IndexedDataMap< 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>>
Standard_Boolean NCollection_IndexedDataMap< TheKeyType, TheItemType, Hasher >::Contains ( const TheKeyType &  theKey1) const
inline

Contains.

template<class TheKeyType, class TheItemType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
void NCollection_IndexedDataMap< TheKeyType, TheItemType, Hasher >::Exchange ( NCollection_IndexedDataMap< 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_IndexedDataMap< TheKeyType, TheItemType, Hasher >::FindFromIndex ( const Standard_Integer  theKey2) const
inline

FindFromIndex.

template<class TheKeyType, class TheItemType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
const TheItemType& NCollection_IndexedDataMap< TheKeyType, TheItemType, Hasher >::FindFromKey ( const TheKeyType &  theKey1) const
inline

FindFromKey.

template<class TheKeyType, class TheItemType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
Standard_Boolean NCollection_IndexedDataMap< TheKeyType, TheItemType, Hasher >::FindFromKey ( const TheKeyType &  theKey1,
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_Integer NCollection_IndexedDataMap< TheKeyType, TheItemType, Hasher >::FindIndex ( const TheKeyType &  theKey1) const
inline

FindIndex.

template<class TheKeyType, class TheItemType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
const TheKeyType& NCollection_IndexedDataMap< TheKeyType, TheItemType, Hasher >::FindKey ( const Standard_Integer  theKey2) const
inline

FindKey.

template<class TheKeyType, class TheItemType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
const TheItemType& NCollection_IndexedDataMap< TheKeyType, TheItemType, Hasher >::operator() ( const Standard_Integer  theKey2) const
inline

operator ()

template<class TheKeyType, class TheItemType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
TheItemType& NCollection_IndexedDataMap< TheKeyType, TheItemType, Hasher >::operator() ( const Standard_Integer  theKey2)
inline

operator ()

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

= another map

template<class TheKeyType, class TheItemType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
void NCollection_IndexedDataMap< TheKeyType, TheItemType, Hasher >::RemoveLast ( void  )
inline

RemoveLast.

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

ReSize.

template<class TheKeyType, class TheItemType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
virtual Standard_Integer NCollection_IndexedDataMap< TheKeyType, TheItemType, Hasher >::Size ( void  ) const
inlinevirtual
template<class TheKeyType, class TheItemType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
void NCollection_IndexedDataMap< TheKeyType, TheItemType, Hasher >::Substitute ( const Standard_Integer  theIndex,
const TheKeyType &  theKey1,
const TheItemType &  theItem 
)
inline

Substitute.


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