Open CASCADE Technology  7.3.0
Data Structures | Public Types | Public Member Functions

NCollection_IndexedMap< TheKeyType, Hasher > Class Template Reference

#include <NCollection_IndexedMap.hxx>

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

Data Structures

class  Iterator
 

Public Types

typedef TheKeyType key_type
 STL-compliant typedef for key type. More...
 
typedef NCollection_StlIterator< std::forward_iterator_tag, Iterator, TheKeyType, true > const_iterator
 Shorthand for a constant iterator type. More...
 

Public Member Functions

const_iterator cbegin () const
 Returns a const iterator pointing to the first element in the map. More...
 
const_iterator cend () const
 Returns a const iterator referring to the past-the-end element in the map. More...
 
 NCollection_IndexedMap ()
 Empty constructor. More...
 
 NCollection_IndexedMap (const Standard_Integer theNbBuckets, const Handle< NCollection_BaseAllocator > &theAllocator=0L)
 Constructor. More...
 
 NCollection_IndexedMap (const NCollection_IndexedMap &theOther)
 Copy constructor. More...
 
void Exchange (NCollection_IndexedMap &theOther)
 Exchange the content of two maps without re-allocations. Notice that allocators will be swapped as well! More...
 
NCollection_IndexedMapAssign (const NCollection_IndexedMap &theOther)
 Assign. This method does not change the internal allocator. More...
 
NCollection_IndexedMapoperator= (const NCollection_IndexedMap &theOther)
 Assignment operator. More...
 
void ReSize (const Standard_Integer theExtent)
 ReSize. More...
 
Standard_Integer Add (const TheKeyType &theKey1)
 Add. More...
 
Standard_Boolean Contains (const TheKeyType &theKey1) const
 Contains. More...
 
void Substitute (const Standard_Integer theIndex, const TheKeyType &theKey1)
 Substitute. More...
 
void Swap (const Standard_Integer theIndex1, const Standard_Integer theIndex2)
 Swaps two elements with the given indices. More...
 
void RemoveLast (void)
 RemoveLast. More...
 
void RemoveFromIndex (const Standard_Integer theIndex)
 Remove the key of the given index. Caution! The index of the last key can be changed. More...
 
Standard_Boolean RemoveKey (const TheKeyType &theKey1)
 Remove the given key. Caution! The index of the last key can be changed. More...
 
const TheKeyType & FindKey (const Standard_Integer theIndex) const
 FindKey. More...
 
const TheKeyType & operator() (const Standard_Integer theIndex) const
 operator () More...
 
Standard_Integer FindIndex (const TheKeyType &theKey1) const
 FindIndex. 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...
 
virtual ~NCollection_IndexedMap (void)
 Destructor. More...
 
Standard_Integer Size (void) const
 Size. 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...
 
const Handle< NCollection_BaseAllocator > & Allocator () const
 Returns attached allocator. More...
 

Additional Inherited Members

- Protected Member Functions inherited from NCollection_BaseMap
 NCollection_BaseMap (const Standard_Integer NbBuckets, const Standard_Boolean single, const Handle< NCollection_BaseAllocator > &theAllocator)
 Constructor. More...
 
virtual ~NCollection_BaseMap ()
 Destructor. More...
 
Standard_Boolean BeginResize (const Standard_Integer NbBuckets, Standard_Integer &NewBuckets, NCollection_ListNode **&data1, NCollection_ListNode **&data2) const
 BeginResize. More...
 
void EndResize (const Standard_Integer NbBuckets, const Standard_Integer NewBuckets, NCollection_ListNode **data1, NCollection_ListNode **data2)
 EndResize. More...
 
Standard_Boolean Resizable () const
 Resizable. More...
 
Standard_Integer Increment ()
 Increment. More...
 
Standard_Integer Decrement ()
 Decrement. More...
 
void Destroy (NCollection_DelMapNode fDel, 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_BaseMap
Handle< NCollection_BaseAllocatormyAllocator
 
NCollection_ListNode ** myData1
 
NCollection_ListNode ** myData2
 

Detailed Description

template<class TheKeyType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
class NCollection_IndexedMap< TheKeyType, 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. See the class Map from NCollection for a discussion about the number of buckets.

Member Typedef Documentation

◆ const_iterator

template<class TheKeyType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
typedef NCollection_StlIterator<std::forward_iterator_tag, Iterator, TheKeyType, true> NCollection_IndexedMap< TheKeyType, Hasher >::const_iterator

Shorthand for a constant iterator type.

◆ key_type

template<class TheKeyType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
typedef TheKeyType NCollection_IndexedMap< TheKeyType, Hasher >::key_type

STL-compliant typedef for key type.

Constructor & Destructor Documentation

◆ NCollection_IndexedMap() [1/3]

template<class TheKeyType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
NCollection_IndexedMap< TheKeyType, Hasher >::NCollection_IndexedMap ( )
inline

Empty constructor.

◆ NCollection_IndexedMap() [2/3]

template<class TheKeyType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
NCollection_IndexedMap< TheKeyType, Hasher >::NCollection_IndexedMap ( const Standard_Integer  theNbBuckets,
const Handle< NCollection_BaseAllocator > &  theAllocator = 0L 
)
inlineexplicit

Constructor.

◆ NCollection_IndexedMap() [3/3]

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

Copy constructor.

◆ ~NCollection_IndexedMap()

template<class TheKeyType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
virtual NCollection_IndexedMap< TheKeyType, Hasher >::~NCollection_IndexedMap ( void  )
inlinevirtual

Destructor.

Member Function Documentation

◆ Add()

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

Add.

◆ Assign()

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

Assign. This method does not change the internal allocator.

◆ cbegin()

template<class TheKeyType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
const_iterator NCollection_IndexedMap< TheKeyType, Hasher >::cbegin ( ) const
inline

Returns a const iterator pointing to the first element in the map.

◆ cend()

template<class TheKeyType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
const_iterator NCollection_IndexedMap< TheKeyType, Hasher >::cend ( ) const
inline

Returns a const iterator referring to the past-the-end element in the map.

◆ Clear() [1/2]

template<class TheKeyType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
void NCollection_IndexedMap< TheKeyType, 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.

◆ Clear() [2/2]

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

Clear data and reset allocator.

◆ Contains()

template<class TheKeyType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
Standard_Boolean NCollection_IndexedMap< TheKeyType, Hasher >::Contains ( const TheKeyType &  theKey1) const
inline

Contains.

◆ Exchange()

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

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

◆ FindIndex()

template<class TheKeyType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
Standard_Integer NCollection_IndexedMap< TheKeyType, Hasher >::FindIndex ( const TheKeyType &  theKey1) const
inline

FindIndex.

◆ FindKey()

template<class TheKeyType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
const TheKeyType& NCollection_IndexedMap< TheKeyType, Hasher >::FindKey ( const Standard_Integer  theIndex) const
inline

FindKey.

◆ operator()()

template<class TheKeyType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
const TheKeyType& NCollection_IndexedMap< TheKeyType, Hasher >::operator() ( const Standard_Integer  theIndex) const
inline

operator ()

◆ operator=()

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

Assignment operator.

◆ RemoveFromIndex()

template<class TheKeyType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
void NCollection_IndexedMap< TheKeyType, Hasher >::RemoveFromIndex ( const Standard_Integer  theIndex)
inline

Remove the key of the given index. Caution! The index of the last key can be changed.

◆ RemoveKey()

template<class TheKeyType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
Standard_Boolean NCollection_IndexedMap< TheKeyType, Hasher >::RemoveKey ( const TheKeyType &  theKey1)
inline

Remove the given key. Caution! The index of the last key can be changed.

◆ RemoveLast()

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

RemoveLast.

◆ ReSize()

template<class TheKeyType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
void NCollection_IndexedMap< TheKeyType, Hasher >::ReSize ( const Standard_Integer  theExtent)
inline

ReSize.

◆ Size()

template<class TheKeyType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
Standard_Integer NCollection_IndexedMap< TheKeyType, Hasher >::Size ( void  ) const
inline

Size.

◆ Substitute()

template<class TheKeyType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
void NCollection_IndexedMap< TheKeyType, Hasher >::Substitute ( const Standard_Integer  theIndex,
const TheKeyType &  theKey1 
)
inline

Substitute.

◆ Swap()

template<class TheKeyType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
void NCollection_IndexedMap< TheKeyType, Hasher >::Swap ( const Standard_Integer  theIndex1,
const Standard_Integer  theIndex2 
)
inline

Swaps two elements with the given indices.


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