Open CASCADE Technology  7.3.1.dev
Data Structures | Public Types | Public Member Functions
NCollection_DoubleMap< TheKey1Type, TheKey2Type, Hasher1, Hasher2 > Class Template Reference

#include <NCollection_DoubleMap.hxx>

Inheritance diagram for NCollection_DoubleMap< TheKey1Type, TheKey2Type, Hasher1, Hasher2 >:
Inheritance graph
[legend]

Data Structures

class  DoubleMapNode
 
class  Iterator
 

Public Types

typedef TheKey1Type key1_type
 STL-compliant typedef for key1 type. More...
 
typedef TheKey2Type key2_type
 STL-compliant typedef for key2 type. More...
 

Public Member Functions

 NCollection_DoubleMap ()
 Empty constructor. More...
 
 NCollection_DoubleMap (const Standard_Integer theNbBuckets, const Handle< NCollection_BaseAllocator > &theAllocator=0L)
 Constructor. More...
 
 NCollection_DoubleMap (const NCollection_DoubleMap &theOther)
 Copy constructor. More...
 
void Exchange (NCollection_DoubleMap &theOther)
 Exchange the content of two maps without re-allocations. Notice that allocators will be swapped as well! More...
 
NCollection_DoubleMapAssign (const NCollection_DoubleMap &theOther)
 Assignment. This method does not change the internal allocator. More...
 
NCollection_DoubleMapoperator= (const NCollection_DoubleMap &theOther)
 Assignment operator. More...
 
void ReSize (const Standard_Integer N)
 ReSize. More...
 
void Bind (const TheKey1Type &theKey1, const TheKey2Type &theKey2)
 Bind. More...
 
Standard_Boolean AreBound (const TheKey1Type &theKey1, const TheKey2Type &theKey2) const
 
Standard_Boolean IsBound1 (const TheKey1Type &theKey1) const
 IsBound1. More...
 
Standard_Boolean IsBound2 (const TheKey2Type &theKey2) const
 IsBound2. More...
 
Standard_Boolean UnBind1 (const TheKey1Type &theKey1)
 UnBind1. More...
 
Standard_Boolean UnBind2 (const TheKey2Type &theKey2)
 UnBind2. More...
 
const TheKey2Type & Find1 (const TheKey1Type &theKey1) const
 Find the Key1 and return Key2 value. Raises an exception if Key1 was not bound. More...
 
Standard_Boolean Find1 (const TheKey1Type &theKey1, TheKey2Type &theKey2) const
 Find the Key1 and return Key2 value (by copying its value). More...
 
const TheKey2Type * Seek1 (const TheKey1Type &theKey1) const
 Find the Key1 and return pointer to Key2 or NULL if Key1 is not bound. More...
 
const TheKey1Type & Find2 (const TheKey2Type &theKey2) const
 Find the Key2 and return Key1 value. Raises an exception if Key2 was not bound. More...
 
Standard_Boolean Find2 (const TheKey2Type &theKey2, TheKey1Type &theKey1) const
 Find the Key2 and return Key1 value (by copying its value). More...
 
const TheKey1Type * Seek2 (const TheKey2Type &theKey2) const
 Find the Key2 and return pointer to Key1 or NULL if not bound. 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_DoubleMap (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 TheKey1Type, class TheKey2Type, class Hasher1 = NCollection_DefaultHasher<TheKey1Type>, class Hasher2 = NCollection_DefaultHasher<TheKey2Type>>
class NCollection_DoubleMap< TheKey1Type, TheKey2Type, Hasher1, Hasher2 >

Purpose: The DoubleMap is used to bind pairs (Key1,Key2) and retrieve them in linear time.

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

Member Typedef Documentation

◆ key1_type

template<class TheKey1Type, class TheKey2Type, class Hasher1 = NCollection_DefaultHasher<TheKey1Type>, class Hasher2 = NCollection_DefaultHasher<TheKey2Type>>
typedef TheKey1Type NCollection_DoubleMap< TheKey1Type, TheKey2Type, Hasher1, Hasher2 >::key1_type

STL-compliant typedef for key1 type.

◆ key2_type

template<class TheKey1Type, class TheKey2Type, class Hasher1 = NCollection_DefaultHasher<TheKey1Type>, class Hasher2 = NCollection_DefaultHasher<TheKey2Type>>
typedef TheKey2Type NCollection_DoubleMap< TheKey1Type, TheKey2Type, Hasher1, Hasher2 >::key2_type

STL-compliant typedef for key2 type.

Constructor & Destructor Documentation

◆ NCollection_DoubleMap() [1/3]

template<class TheKey1Type, class TheKey2Type, class Hasher1 = NCollection_DefaultHasher<TheKey1Type>, class Hasher2 = NCollection_DefaultHasher<TheKey2Type>>
NCollection_DoubleMap< TheKey1Type, TheKey2Type, Hasher1, Hasher2 >::NCollection_DoubleMap ( )
inline

Empty constructor.

◆ NCollection_DoubleMap() [2/3]

template<class TheKey1Type, class TheKey2Type, class Hasher1 = NCollection_DefaultHasher<TheKey1Type>, class Hasher2 = NCollection_DefaultHasher<TheKey2Type>>
NCollection_DoubleMap< TheKey1Type, TheKey2Type, Hasher1, Hasher2 >::NCollection_DoubleMap ( const Standard_Integer  theNbBuckets,
const Handle< NCollection_BaseAllocator > &  theAllocator = 0L 
)
inlineexplicit

Constructor.

◆ NCollection_DoubleMap() [3/3]

template<class TheKey1Type, class TheKey2Type, class Hasher1 = NCollection_DefaultHasher<TheKey1Type>, class Hasher2 = NCollection_DefaultHasher<TheKey2Type>>
NCollection_DoubleMap< TheKey1Type, TheKey2Type, Hasher1, Hasher2 >::NCollection_DoubleMap ( const NCollection_DoubleMap< TheKey1Type, TheKey2Type, Hasher1, Hasher2 > &  theOther)
inline

Copy constructor.

◆ ~NCollection_DoubleMap()

template<class TheKey1Type, class TheKey2Type, class Hasher1 = NCollection_DefaultHasher<TheKey1Type>, class Hasher2 = NCollection_DefaultHasher<TheKey2Type>>
NCollection_DoubleMap< TheKey1Type, TheKey2Type, Hasher1, Hasher2 >::~NCollection_DoubleMap ( void  )
inline

Destructor.

Member Function Documentation

◆ AreBound()

template<class TheKey1Type, class TheKey2Type, class Hasher1 = NCollection_DefaultHasher<TheKey1Type>, class Hasher2 = NCollection_DefaultHasher<TheKey2Type>>
Standard_Boolean NCollection_DoubleMap< TheKey1Type, TheKey2Type, Hasher1, Hasher2 >::AreBound ( const TheKey1Type &  theKey1,
const TheKey2Type &  theKey2 
) const
inline
  • AreBound

◆ Assign()

template<class TheKey1Type, class TheKey2Type, class Hasher1 = NCollection_DefaultHasher<TheKey1Type>, class Hasher2 = NCollection_DefaultHasher<TheKey2Type>>
NCollection_DoubleMap& NCollection_DoubleMap< TheKey1Type, TheKey2Type, Hasher1, Hasher2 >::Assign ( const NCollection_DoubleMap< TheKey1Type, TheKey2Type, Hasher1, Hasher2 > &  theOther)
inline

Assignment. This method does not change the internal allocator.

◆ Bind()

template<class TheKey1Type, class TheKey2Type, class Hasher1 = NCollection_DefaultHasher<TheKey1Type>, class Hasher2 = NCollection_DefaultHasher<TheKey2Type>>
void NCollection_DoubleMap< TheKey1Type, TheKey2Type, Hasher1, Hasher2 >::Bind ( const TheKey1Type &  theKey1,
const TheKey2Type &  theKey2 
)
inline

Bind.

◆ Clear() [1/2]

template<class TheKey1Type, class TheKey2Type, class Hasher1 = NCollection_DefaultHasher<TheKey1Type>, class Hasher2 = NCollection_DefaultHasher<TheKey2Type>>
void NCollection_DoubleMap< TheKey1Type, TheKey2Type, Hasher1, Hasher2 >::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 TheKey1Type, class TheKey2Type, class Hasher1 = NCollection_DefaultHasher<TheKey1Type>, class Hasher2 = NCollection_DefaultHasher<TheKey2Type>>
void NCollection_DoubleMap< TheKey1Type, TheKey2Type, Hasher1, Hasher2 >::Clear ( const Handle< NCollection_BaseAllocator > &  theAllocator)
inline

Clear data and reset allocator.

◆ Exchange()

template<class TheKey1Type, class TheKey2Type, class Hasher1 = NCollection_DefaultHasher<TheKey1Type>, class Hasher2 = NCollection_DefaultHasher<TheKey2Type>>
void NCollection_DoubleMap< TheKey1Type, TheKey2Type, Hasher1, Hasher2 >::Exchange ( NCollection_DoubleMap< TheKey1Type, TheKey2Type, Hasher1, Hasher2 > &  theOther)
inline

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

◆ Find1() [1/2]

template<class TheKey1Type, class TheKey2Type, class Hasher1 = NCollection_DefaultHasher<TheKey1Type>, class Hasher2 = NCollection_DefaultHasher<TheKey2Type>>
const TheKey2Type& NCollection_DoubleMap< TheKey1Type, TheKey2Type, Hasher1, Hasher2 >::Find1 ( const TheKey1Type &  theKey1) const
inline

Find the Key1 and return Key2 value. Raises an exception if Key1 was not bound.

◆ Find1() [2/2]

template<class TheKey1Type, class TheKey2Type, class Hasher1 = NCollection_DefaultHasher<TheKey1Type>, class Hasher2 = NCollection_DefaultHasher<TheKey2Type>>
Standard_Boolean NCollection_DoubleMap< TheKey1Type, TheKey2Type, Hasher1, Hasher2 >::Find1 ( const TheKey1Type &  theKey1,
TheKey2Type &  theKey2 
) const
inline

Find the Key1 and return Key2 value (by copying its value).

Parameters
[in]theKey1Key1 to find
[out]theKey2Key2 to return
Returns
TRUE if Key1 has been found

◆ Find2() [1/2]

template<class TheKey1Type, class TheKey2Type, class Hasher1 = NCollection_DefaultHasher<TheKey1Type>, class Hasher2 = NCollection_DefaultHasher<TheKey2Type>>
const TheKey1Type& NCollection_DoubleMap< TheKey1Type, TheKey2Type, Hasher1, Hasher2 >::Find2 ( const TheKey2Type &  theKey2) const
inline

Find the Key2 and return Key1 value. Raises an exception if Key2 was not bound.

◆ Find2() [2/2]

template<class TheKey1Type, class TheKey2Type, class Hasher1 = NCollection_DefaultHasher<TheKey1Type>, class Hasher2 = NCollection_DefaultHasher<TheKey2Type>>
Standard_Boolean NCollection_DoubleMap< TheKey1Type, TheKey2Type, Hasher1, Hasher2 >::Find2 ( const TheKey2Type &  theKey2,
TheKey1Type &  theKey1 
) const
inline

Find the Key2 and return Key1 value (by copying its value).

Parameters
[in]theKey2Key2 to find
[out]theKey1Key1 to return
Returns
TRUE if Key2 has been found

◆ IsBound1()

template<class TheKey1Type, class TheKey2Type, class Hasher1 = NCollection_DefaultHasher<TheKey1Type>, class Hasher2 = NCollection_DefaultHasher<TheKey2Type>>
Standard_Boolean NCollection_DoubleMap< TheKey1Type, TheKey2Type, Hasher1, Hasher2 >::IsBound1 ( const TheKey1Type &  theKey1) const
inline

IsBound1.

◆ IsBound2()

template<class TheKey1Type, class TheKey2Type, class Hasher1 = NCollection_DefaultHasher<TheKey1Type>, class Hasher2 = NCollection_DefaultHasher<TheKey2Type>>
Standard_Boolean NCollection_DoubleMap< TheKey1Type, TheKey2Type, Hasher1, Hasher2 >::IsBound2 ( const TheKey2Type &  theKey2) const
inline

IsBound2.

◆ operator=()

template<class TheKey1Type, class TheKey2Type, class Hasher1 = NCollection_DefaultHasher<TheKey1Type>, class Hasher2 = NCollection_DefaultHasher<TheKey2Type>>
NCollection_DoubleMap& NCollection_DoubleMap< TheKey1Type, TheKey2Type, Hasher1, Hasher2 >::operator= ( const NCollection_DoubleMap< TheKey1Type, TheKey2Type, Hasher1, Hasher2 > &  theOther)
inline

Assignment operator.

◆ ReSize()

template<class TheKey1Type, class TheKey2Type, class Hasher1 = NCollection_DefaultHasher<TheKey1Type>, class Hasher2 = NCollection_DefaultHasher<TheKey2Type>>
void NCollection_DoubleMap< TheKey1Type, TheKey2Type, Hasher1, Hasher2 >::ReSize ( const Standard_Integer  N)
inline

ReSize.

◆ Seek1()

template<class TheKey1Type, class TheKey2Type, class Hasher1 = NCollection_DefaultHasher<TheKey1Type>, class Hasher2 = NCollection_DefaultHasher<TheKey2Type>>
const TheKey2Type* NCollection_DoubleMap< TheKey1Type, TheKey2Type, Hasher1, Hasher2 >::Seek1 ( const TheKey1Type &  theKey1) const
inline

Find the Key1 and return pointer to Key2 or NULL if Key1 is not bound.

Parameters
[in]theKey1Key1 to find
Returns
pointer to Key2 or NULL if Key1 is not found

◆ Seek2()

template<class TheKey1Type, class TheKey2Type, class Hasher1 = NCollection_DefaultHasher<TheKey1Type>, class Hasher2 = NCollection_DefaultHasher<TheKey2Type>>
const TheKey1Type* NCollection_DoubleMap< TheKey1Type, TheKey2Type, Hasher1, Hasher2 >::Seek2 ( const TheKey2Type &  theKey2) const
inline

Find the Key2 and return pointer to Key1 or NULL if not bound.

Parameters
[in]theKey2Key2 to find
Returns
pointer to Key1 if Key2 has been found

◆ Size()

template<class TheKey1Type, class TheKey2Type, class Hasher1 = NCollection_DefaultHasher<TheKey1Type>, class Hasher2 = NCollection_DefaultHasher<TheKey2Type>>
Standard_Integer NCollection_DoubleMap< TheKey1Type, TheKey2Type, Hasher1, Hasher2 >::Size ( void  ) const
inline

Size.

◆ UnBind1()

template<class TheKey1Type, class TheKey2Type, class Hasher1 = NCollection_DefaultHasher<TheKey1Type>, class Hasher2 = NCollection_DefaultHasher<TheKey2Type>>
Standard_Boolean NCollection_DoubleMap< TheKey1Type, TheKey2Type, Hasher1, Hasher2 >::UnBind1 ( const TheKey1Type &  theKey1)
inline

UnBind1.

◆ UnBind2()

template<class TheKey1Type, class TheKey2Type, class Hasher1 = NCollection_DefaultHasher<TheKey1Type>, class Hasher2 = NCollection_DefaultHasher<TheKey2Type>>
Standard_Boolean NCollection_DoubleMap< TheKey1Type, TheKey2Type, Hasher1, Hasher2 >::UnBind2 ( const TheKey2Type &  theKey2)
inline

UnBind2.


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