Open CASCADE Technology 7.8.0
Data Structures | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes
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.
 
typedef TheKey2Type key2_type
 STL-compliant typedef for key2 type.
 

Public Member Functions

 NCollection_DoubleMap ()
 Empty constructor.
 
 NCollection_DoubleMap (const Standard_Integer theNbBuckets, const Handle< NCollection_BaseAllocator > &theAllocator=0L)
 Constructor.
 
 NCollection_DoubleMap (const NCollection_DoubleMap &theOther)
 Copy constructor.
 
void Exchange (NCollection_DoubleMap &theOther)
 Exchange the content of two maps without re-allocations. Notice that allocators will be swapped as well!
 
NCollection_DoubleMapAssign (const NCollection_DoubleMap &theOther)
 Assignment. This method does not change the internal allocator.
 
NCollection_DoubleMapoperator= (const NCollection_DoubleMap &theOther)
 Assignment operator.
 
void ReSize (const Standard_Integer N)
 ReSize.
 
void Bind (const TheKey1Type &theKey1, const TheKey2Type &theKey2)
 Bind.
 
Standard_Boolean AreBound (const TheKey1Type &theKey1, const TheKey2Type &theKey2) const
 
Standard_Boolean IsBound1 (const TheKey1Type &theKey1) const
 IsBound1.
 
Standard_Boolean IsBound2 (const TheKey2Type &theKey2) const
 IsBound2.
 
Standard_Boolean UnBind1 (const TheKey1Type &theKey1)
 UnBind1.
 
Standard_Boolean UnBind2 (const TheKey2Type &theKey2)
 UnBind2.
 
const TheKey2TypeFind1 (const TheKey1Type &theKey1) const
 Find the Key1 and return Key2 value. Raises an exception if Key1 was not bound.
 
Standard_Boolean Find1 (const TheKey1Type &theKey1, TheKey2Type &theKey2) const
 Find the Key1 and return Key2 value (by copying its value).
 
const TheKey2TypeSeek1 (const TheKey1Type &theKey1) const
 Find the Key1 and return pointer to Key2 or NULL if Key1 is not bound.
 
const TheKey1TypeFind2 (const TheKey2Type &theKey2) const
 Find the Key2 and return Key1 value. Raises an exception if Key2 was not bound.
 
Standard_Boolean Find2 (const TheKey2Type &theKey2, TheKey1Type &theKey1) const
 Find the Key2 and return Key1 value (by copying its value).
 
const TheKey1TypeSeek2 (const TheKey2Type &theKey2) const
 Find the Key2 and return pointer to Key1 or NULL if not bound.
 
void Clear (const Standard_Boolean doReleaseMemory=Standard_False)
 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_DoubleMap (void)
 Destructor.
 
Standard_Integer Size (void) const
 Size.
 
- Public Member Functions inherited from NCollection_BaseMap
Standard_Integer NbBuckets () const
 NbBuckets.
 
Standard_Integer Extent () const
 Extent.
 
Standard_Boolean IsEmpty () const
 IsEmpty.
 
void Statistics (Standard_OStream &S) const
 Statistics.
 
const Handle< NCollection_BaseAllocator > & Allocator () const
 Returns attached allocator.
 

Protected Member Functions

bool IsEqual1 (const TheKey1Type &theKey1, const TheKey1Type &theKey2) const
 
size_t HashCode1 (const TheKey1Type &theKey, const int theUpperBound) const
 
bool IsEqual2 (const TheKey2Type &theKey1, const TheKey2Type &theKey2) const
 
size_t HashCode2 (const TheKey2Type &theKey, const int theUpperBound) const
 
- Protected Member Functions inherited from NCollection_BaseMap
 NCollection_BaseMap (const Standard_Integer NbBuckets, const Standard_Boolean single, const Handle< NCollection_BaseAllocator > &theAllocator)
 Constructor.
 
 NCollection_BaseMap (NCollection_BaseMap &&theOther) noexcept
 Move Constructor.
 
virtual ~NCollection_BaseMap ()
 Destructor.
 
Standard_Boolean BeginResize (const Standard_Integer NbBuckets, Standard_Integer &NewBuckets, NCollection_ListNode **&data1, NCollection_ListNode **&data2) const
 BeginResize.
 
void EndResize (const Standard_Integer NbBuckets, const Standard_Integer NewBuckets, NCollection_ListNode **data1, NCollection_ListNode **data2)
 EndResize.
 
Standard_Boolean Resizable () const
 Resizable.
 
Standard_Integer Increment ()
 Increment.
 
Standard_Integer Decrement ()
 Decrement.
 
void Destroy (NCollection_DelMapNode fDel, Standard_Boolean doReleaseMemory=Standard_True)
 Destroy.
 
Standard_Integer NextPrimeForMap (const Standard_Integer N) const
 NextPrimeForMap.
 
void exchangeMapsData (NCollection_BaseMap &theOther)
 Exchange content of two maps without data copying.
 
NCollection_BaseMapoperator= (NCollection_BaseMap &&) noexcept=delete
 Move operator.
 
 NCollection_BaseMap (const NCollection_BaseMap &)=delete
 Copy Constructor.
 
NCollection_BaseMapoperator= (const NCollection_BaseMap &)=delete
 Assign operator.
 

Protected Attributes

Hasher1 myHasher1
 
Hasher2 myHasher2
 
- 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 Handle< NCollection_BaseAllocator > &  theAllocator)
inline

Clear data and reset allocator.

◆ 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 Standard_Boolean  doReleaseMemory = Standard_False)
inline

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

◆ 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

◆ HashCode1()

template<class TheKey1Type , class TheKey2Type , class Hasher1 = NCollection_DefaultHasher<TheKey1Type>, class Hasher2 = NCollection_DefaultHasher<TheKey2Type>>
size_t NCollection_DoubleMap< TheKey1Type, TheKey2Type, Hasher1, Hasher2 >::HashCode1 ( const TheKey1Type theKey,
const int  theUpperBound 
) const
inlineprotected

◆ HashCode2()

template<class TheKey1Type , class TheKey2Type , class Hasher1 = NCollection_DefaultHasher<TheKey1Type>, class Hasher2 = NCollection_DefaultHasher<TheKey2Type>>
size_t NCollection_DoubleMap< TheKey1Type, TheKey2Type, Hasher1, Hasher2 >::HashCode2 ( const TheKey2Type theKey,
const int  theUpperBound 
) const
inlineprotected

◆ 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.

◆ IsEqual1()

template<class TheKey1Type , class TheKey2Type , class Hasher1 = NCollection_DefaultHasher<TheKey1Type>, class Hasher2 = NCollection_DefaultHasher<TheKey2Type>>
bool NCollection_DoubleMap< TheKey1Type, TheKey2Type, Hasher1, Hasher2 >::IsEqual1 ( const TheKey1Type theKey1,
const TheKey1Type theKey2 
) const
inlineprotected

◆ IsEqual2()

template<class TheKey1Type , class TheKey2Type , class Hasher1 = NCollection_DefaultHasher<TheKey1Type>, class Hasher2 = NCollection_DefaultHasher<TheKey2Type>>
bool NCollection_DoubleMap< TheKey1Type, TheKey2Type, Hasher1, Hasher2 >::IsEqual2 ( const TheKey2Type theKey1,
const TheKey2Type theKey2 
) const
inlineprotected

◆ 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.

Field Documentation

◆ myHasher1

template<class TheKey1Type , class TheKey2Type , class Hasher1 = NCollection_DefaultHasher<TheKey1Type>, class Hasher2 = NCollection_DefaultHasher<TheKey2Type>>
Hasher1 NCollection_DoubleMap< TheKey1Type, TheKey2Type, Hasher1, Hasher2 >::myHasher1
protected

◆ myHasher2

template<class TheKey1Type , class TheKey2Type , class Hasher1 = NCollection_DefaultHasher<TheKey1Type>, class Hasher2 = NCollection_DefaultHasher<TheKey2Type>>
Hasher2 NCollection_DoubleMap< TheKey1Type, TheKey2Type, Hasher1, Hasher2 >::myHasher2
protected

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