Open CASCADE Technology Reference Manual 8.0.0
Loading...
Searching...
No Matches
Data Structures | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes
NCollection_Map< TheKeyType, Hasher > Class Template Reference

#include <NCollection_Map.hxx>

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

Data Structures

class  Iterator
 Implementation of the Iterator interface. More...
 
class  MapNode
 Adaptation of the TListNode to the map notations. More...
 

Public Types

typedef TheKeyType key_type
 STL-compliant typedef for key type.
 
typedef Hasher hasher
 
typedef NCollection_StlIterator< std::forward_iterator_tag, Iterator, TheKeyType, trueconst_iterator
 Shorthand for a constant iterator type.
 
typedef const_iterator iterator
 Shorthand for iterator type (same as const_iterator for key-only maps).
 

Public Member Functions

iterator begin () const noexcept
 Returns an iterator pointing to the first element in the map.
 
iterator end () const noexcept
 Returns an iterator referring to the past-the-end element in the map.
 
const_iterator cbegin () const noexcept
 Returns a const iterator pointing to the first element in the map.
 
const_iterator cend () const noexcept
 Returns a const iterator referring to the past-the-end element in the map.
 
 NCollection_Map ()
 Empty constructor.
 
 NCollection_Map (const size_t theNbBuckets, const occ::handle< NCollection_BaseAllocator > &theAllocator=nullptr)
 Constructor.
 
 NCollection_Map (const int theNbBuckets, const occ::handle< NCollection_BaseAllocator > &theAllocator=nullptr)
 Constructor (legacy int-taking).
 
 NCollection_Map (const Hasher &theHasher, const size_t theNbBuckets=1, const occ::handle< NCollection_BaseAllocator > &theAllocator=nullptr)
 Constructor with custom hasher (copy).
 
 NCollection_Map (const Hasher &theHasher, const int theNbBuckets, const occ::handle< NCollection_BaseAllocator > &theAllocator=nullptr)
 Constructor with custom hasher (copy, legacy int-taking).
 
 NCollection_Map (Hasher &&theHasher, const size_t theNbBuckets=1, const occ::handle< NCollection_BaseAllocator > &theAllocator=nullptr)
 Constructor with custom hasher (move).
 
 NCollection_Map (Hasher &&theHasher, const int theNbBuckets, const occ::handle< NCollection_BaseAllocator > &theAllocator=nullptr)
 Constructor with custom hasher (move, legacy int-taking).
 
 NCollection_Map (const NCollection_Map &theOther)
 Copy constructor.
 
 NCollection_Map (NCollection_Map &&theOther) noexcept
 Move constructor.
 
void Exchange (NCollection_Map &theOther) noexcept
 Exchange the content of two maps without re-allocations. Notice that allocators will be swapped as well!
 
const Hasher & GetHasher () const noexcept
 Returns const reference to the hasher.
 
NCollection_MapAssign (const NCollection_Map &theOther)
 Assign. This method does not change the internal allocator.
 
NCollection_Mapoperator= (const NCollection_Map &theOther)
 Assign operator.
 
NCollection_Mapoperator= (NCollection_Map &&theOther) noexcept
 Move operator.
 
void ReSize (const size_t N)
 ReSize.
 
void ReSize (const int N)
 
bool Add (const TheKeyType &theKey)
 Add.
 
bool Add (TheKeyType &&theKey)
 Add.
 
const TheKeyTypeAdded (const TheKeyType &theKey)
 Added: add a new key if not yet in the map, and return reference to either newly added or previously existing object.
 
const TheKeyTypeAdded (TheKeyType &&theKey)
 Added: add a new key if not yet in the map, and return reference to either newly added or previously existing object.
 
template<typename... Args>
bool Emplace (Args &&... theArgs)
 Emplace constructs key in-place; if key exists, destroys and reconstructs.
 
template<typename... Args>
const TheKeyTypeEmplaced (Args &&... theArgs)
 Emplaced constructs key in-place; if key exists, destroys and reconstructs.
 
template<typename... Args>
bool TryEmplace (Args &&... theArgs)
 TryEmplace constructs key in-place only if not already present.
 
template<typename... Args>
const TheKeyTypeTryEmplaced (Args &&... theArgs)
 TryEmplaced constructs key in-place only if not already present.
 
bool Contains (const TheKeyType &theKey) const
 Contains.
 
std::optional< std::reference_wrapper< const TheKeyType > > Contained (const TheKeyType &theKey) const
 Contained returns optional const reference to the key in the map. Returns std::nullopt if the key is not found.
 
bool Remove (const TheKeyType &K)
 Remove.
 
void Clear (const bool doReleaseMemory=false)
 Clear data. If doReleaseMemory is false then the table of buckets is not released and will be reused.
 
void Clear (const occ::handle< NCollection_BaseAllocator > &theAllocator)
 Clear data and reset allocator.
 
 ~NCollection_Map () override
 Destructor.
 
NCollection_MapAlgo hxx instead bool IsEqual (const NCollection_Map &theOther) const
 Checks if two maps contain exactly the same keys. This function compares the keys of this map and another map and returns true if they contain exactly the same keys.
 
NCollection_MapAlgo hxx instead bool Contains (const NCollection_Map &theOther) const
 Checks if this map contains all keys of another map. This function checks if this map contains all keys of another map.
 
NCollection_MapAlgo hxx instead void Union (const NCollection_Map &theLeft, const NCollection_Map &theRight)
 Sets this Map to be the result of union (aka addition, fuse, merge, boolean OR) operation between two given Maps The new Map contains the values that are contained either in the first map or in the second map or in both. All previous content of this Map is cleared. This map (result of the boolean operation) can also be passed as one of operands.
 
NCollection_MapAlgo hxx instead bool Unite (const NCollection_Map &theOther)
 Apply to this Map the boolean operation union (aka addition, fuse, merge, boolean OR) with another (given) Map. The result contains the values that were previously contained in this map or contained in the given (operand) map. This algorithm is similar to method Union(). Returns True if contents of this map is changed.
 
NCollection_MapAlgo hxx instead bool HasIntersection (const NCollection_Map &theMap) const
 Returns true if this and theMap have common elements.
 
NCollection_MapAlgo hxx instead void Intersection (const NCollection_Map &theLeft, const NCollection_Map &theRight)
 Sets this Map to be the result of intersection (aka multiplication, common, boolean AND) operation between two given Maps. The new Map contains only the values that are contained in both map operands. All previous content of this Map is cleared. This same map (result of the boolean operation) can also be used as one of operands.
 
NCollection_MapAlgo hxx instead bool Intersect (const NCollection_Map &theOther)
 Apply to this Map the intersection operation (aka multiplication, common, boolean AND) with another (given) Map. The result contains only the values that are contained in both this and the given maps. This algorithm is similar to method Intersection(). Returns True if contents of this map is changed.
 
NCollection_MapAlgo hxx instead void Subtraction (const NCollection_Map &theLeft, const NCollection_Map &theRight)
 Sets this Map to be the result of subtraction (aka set-theoretic difference, relative complement, exclude, cut, boolean NOT) operation between two given Maps. The new Map contains only the values that are contained in the first map operands and not contained in the second one. All previous content of this Map is cleared.
 
NCollection_MapAlgo hxx instead bool Subtract (const NCollection_Map &theOther)
 Apply to this Map the subtraction (aka set-theoretic difference, relative complement, exclude, cut, boolean NOT) operation with another (given) Map. The result contains only the values that were previously contained in this map and not contained in this map. This algorithm is similar to method Subtract() with two operands. Returns True if contents of this map is changed.
 
NCollection_MapAlgo hxx instead void Difference (const NCollection_Map &theLeft, const NCollection_Map &theRight)
 Sets this Map to be the result of symmetric difference (aka exclusive disjunction, boolean XOR) operation between two given Maps. The new Map contains the values that are contained only in the first or the second operand maps but not in both. All previous content of this Map is cleared. This map (result of the boolean operation) can also be used as one of operands.
 
NCollection_MapAlgo hxx instead bool Differ (const NCollection_Map &theOther)
 Apply to this Map the symmetric difference (aka exclusive disjunction, boolean XOR) operation with another (given) Map. The result contains the values that are contained only in this or the operand map, but not in both. This algorithm is similar to method Difference(). Returns True if contents of this map is changed.
 
- Public Member Functions inherited from NCollection_BaseMap
size_t NbBuckets () const noexcept
 NbBuckets.
 
int Extent () const noexcept
 Extent (number of elements, legacy int-returning API).
 
int Length () const noexcept
 Length - number of elements (legacy int-returning API, synonym of Extent()).
 
size_t Size () const noexcept
 Size - number of elements.
 
bool IsEmpty () const noexcept
 IsEmpty.
 
const occ::handle< NCollection_BaseAllocator > & Allocator () const noexcept
 Returns attached allocator.
 

Protected Member Functions

bool lookup (const TheKeyType &theKey, MapNode *&theNode, size_t &theHash) const
 Lookup for particular key in map.
 
bool lookup (const TheKeyType &theKey, MapNode *&theNode) const
 Lookup for particular key in map.
 
bool IsEqual (const TheKeyType &theKey1, const TheKeyType &theKey2) const
 
size_t HashCode (const TheKeyType &theKey, const size_t theUpperBound) const
 
template<typename K , bool ReturnRef>
auto addImpl (K &&theKey, std::bool_constant< ReturnRef >) -> std::conditional_t< ReturnRef, const TheKeyType &, bool >
 Implementation helper for Add/Added.
 
template<bool IsTry, bool ReturnRef, typename... Args>
auto emplaceImpl (std::bool_constant< IsTry >, std::bool_constant< ReturnRef >, Args &&... theArgs) -> std::conditional_t< ReturnRef, const TheKeyType &, bool >
 Implementation helper for Emplace/TryEmplace/Emplaced/TryEmplaced.
 
- Protected Member Functions inherited from NCollection_BaseMap
 NCollection_BaseMap (const size_t theNbBuckets, const bool single, const occ::handle< NCollection_BaseAllocator > &theAllocator)
 Constructor.
 
 NCollection_BaseMap (NCollection_BaseMap &&theOther) noexcept
 Move Constructor.
 
virtual ~NCollection_BaseMap ()=default
 Destructor.
 
bool BeginResize (const size_t theExtent, size_t &theNewBuckets, NCollection_ListNode **&data1, NCollection_ListNode **&data2) const
 BeginResize.
 
void EndResize (const size_t theExtent, const size_t theNewBuckets, NCollection_ListNode **data1, NCollection_ListNode **data2) noexcept
 EndResize.
 
bool Resizable () const noexcept
 Resizable.
 
size_t Increment () noexcept
 Increment.
 
size_t Decrement () noexcept
 Decrement.
 
void Destroy (NCollection_DelMapNode fDel, bool doReleaseMemory=true)
 Destroy.
 
size_t NextPrimeForMap (const size_t N) const noexcept
 NextPrimeForMap.
 
void exchangeMapsData (NCollection_BaseMap &theOther) noexcept
 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

Hasher myHasher
 
- Protected Attributes inherited from NCollection_BaseMap
occ::handle< NCollection_BaseAllocatormyAllocator
 
NCollection_ListNode ** myData1
 
NCollection_ListNode ** myData2
 

Additional Inherited Members

- Static Protected Member Functions inherited from NCollection_BaseMap
static size_t NbBucketsFromInt (const int theNbBuckets)
 Converts legacy int bucket count to size_t with validation.
 

Detailed Description

template<class TheKeyType, class Hasher = NCollection_DefaultHasher<TheKeyType>>
class NCollection_Map< TheKeyType, Hasher >

Purpose: Single hashed Map. This Map is used to store and retrieve keys in linear time.

The ::Iterator class can be used to explore the content of the map. It is not wise to iterate and modify a map in parallel.

To compute the hashcode of the key the function HashCode must be defined in the global namespace

To compare two keys the function IsEqual must be defined in the global namespace.

The performance of a Map is conditioned by its number of buckets that should be kept greater to the number of keys. This map has an automatic management of the number of buckets. It is resized when the number of Keys becomes greater than the number of buckets.

If you have a fair idea of the number of objects you can save on automatic resizing by giving a number of buckets at creation or using the ReSize method. This should be consider only for crucial optimisation issues.

Member Typedef Documentation

◆ const_iterator

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

Shorthand for a constant iterator type.

◆ hasher

template<class TheKeyType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
typedef Hasher NCollection_Map< TheKeyType, Hasher >::hasher

◆ iterator

template<class TheKeyType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
typedef const_iterator NCollection_Map< TheKeyType, Hasher >::iterator

Shorthand for iterator type (same as const_iterator for key-only maps).

◆ key_type

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

STL-compliant typedef for key type.

Constructor & Destructor Documentation

◆ NCollection_Map() [1/9]

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

Empty constructor.

◆ NCollection_Map() [2/9]

template<class TheKeyType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
NCollection_Map< TheKeyType, Hasher >::NCollection_Map ( const size_t theNbBuckets,
const occ::handle< NCollection_BaseAllocator > & theAllocator = nullptr )
inlineexplicit

Constructor.

◆ NCollection_Map() [3/9]

template<class TheKeyType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
NCollection_Map< TheKeyType, Hasher >::NCollection_Map ( const int theNbBuckets,
const occ::handle< NCollection_BaseAllocator > & theAllocator = nullptr )
inlineexplicit

Constructor (legacy int-taking).

◆ NCollection_Map() [4/9]

template<class TheKeyType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
NCollection_Map< TheKeyType, Hasher >::NCollection_Map ( const Hasher & theHasher,
const size_t theNbBuckets = 1,
const occ::handle< NCollection_BaseAllocator > & theAllocator = nullptr )
inlineexplicit

Constructor with custom hasher (copy).

Parameters
theHashercustom hasher instance
theNbBucketsinitial number of buckets
theAllocatorcustom memory allocator

◆ NCollection_Map() [5/9]

template<class TheKeyType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
NCollection_Map< TheKeyType, Hasher >::NCollection_Map ( const Hasher & theHasher,
const int theNbBuckets,
const occ::handle< NCollection_BaseAllocator > & theAllocator = nullptr )
inlineexplicit

Constructor with custom hasher (copy, legacy int-taking).

◆ NCollection_Map() [6/9]

template<class TheKeyType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
NCollection_Map< TheKeyType, Hasher >::NCollection_Map ( Hasher && theHasher,
const size_t theNbBuckets = 1,
const occ::handle< NCollection_BaseAllocator > & theAllocator = nullptr )
inlineexplicit

Constructor with custom hasher (move).

Parameters
theHashercustom hasher instance (moved)
theNbBucketsinitial number of buckets
theAllocatorcustom memory allocator

◆ NCollection_Map() [7/9]

template<class TheKeyType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
NCollection_Map< TheKeyType, Hasher >::NCollection_Map ( Hasher && theHasher,
const int theNbBuckets,
const occ::handle< NCollection_BaseAllocator > & theAllocator = nullptr )
inlineexplicit

Constructor with custom hasher (move, legacy int-taking).

◆ NCollection_Map() [8/9]

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

Copy constructor.

◆ NCollection_Map() [9/9]

template<class TheKeyType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
NCollection_Map< TheKeyType, Hasher >::NCollection_Map ( NCollection_Map< TheKeyType, Hasher > && theOther)
inlinenoexcept

Move constructor.

◆ ~NCollection_Map()

template<class TheKeyType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
NCollection_Map< TheKeyType, Hasher >::~NCollection_Map ( )
inlineoverride

Destructor.

Member Function Documentation

◆ Add() [1/2]

template<class TheKeyType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
bool NCollection_Map< TheKeyType, Hasher >::Add ( const TheKeyType & theKey)
inline

Add.

◆ Add() [2/2]

template<class TheKeyType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
bool NCollection_Map< TheKeyType, Hasher >::Add ( TheKeyType && theKey)
inline

Add.

◆ Added() [1/2]

template<class TheKeyType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
const TheKeyType & NCollection_Map< TheKeyType, Hasher >::Added ( const TheKeyType & theKey)
inline

Added: add a new key if not yet in the map, and return reference to either newly added or previously existing object.

◆ Added() [2/2]

template<class TheKeyType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
const TheKeyType & NCollection_Map< TheKeyType, Hasher >::Added ( TheKeyType && theKey)
inline

Added: add a new key if not yet in the map, and return reference to either newly added or previously existing object.

◆ addImpl()

template<class TheKeyType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
template<typename K , bool ReturnRef>
auto NCollection_Map< TheKeyType, Hasher >::addImpl ( K && theKey,
std::bool_constant< ReturnRef >  ) -> std::conditional_t<ReturnRef, const TheKeyType&, bool>
inlineprotected

Implementation helper for Add/Added.

Template Parameters
Kforwarding reference type for key
ReturnRefif true, returns const reference to key; if false, returns bool
Parameters
theKeykey to add
Returns
bool (Add) or const TheKeyType& (Added)

◆ Assign()

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

Assign. This method does not change the internal allocator.

◆ begin()

template<class TheKeyType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
iterator NCollection_Map< TheKeyType, Hasher >::begin ( ) const
inlinenoexcept

Returns an iterator pointing to the first element in the map.

◆ cbegin()

template<class TheKeyType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
const_iterator NCollection_Map< TheKeyType, Hasher >::cbegin ( ) const
inlinenoexcept

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

◆ cend()

template<class TheKeyType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
const_iterator NCollection_Map< TheKeyType, Hasher >::cend ( ) const
inlinenoexcept

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_Map< TheKeyType, Hasher >::Clear ( const bool doReleaseMemory = false)
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_Map< TheKeyType, Hasher >::Clear ( const occ::handle< NCollection_BaseAllocator > & theAllocator)
inline

Clear data and reset allocator.

◆ Contained()

template<class TheKeyType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
std::optional< std::reference_wrapper< const TheKeyType > > NCollection_Map< TheKeyType, Hasher >::Contained ( const TheKeyType & theKey) const
inline

Contained returns optional const reference to the key in the map. Returns std::nullopt if the key is not found.

◆ Contains() [1/2]

template<class TheKeyType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
NCollection_MapAlgo hxx instead bool NCollection_Map< TheKeyType, Hasher >::Contains ( const NCollection_Map< TheKeyType, Hasher > & theOther) const
inline

Checks if this map contains all keys of another map. This function checks if this map contains all keys of another map.

Deprecated
("This method will be removed right after 7.9. release. Use methods from "

◆ Contains() [2/2]

template<class TheKeyType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
bool NCollection_Map< TheKeyType, Hasher >::Contains ( const TheKeyType & theKey) const
inline

Contains.

◆ Differ()

template<class TheKeyType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
NCollection_MapAlgo hxx instead bool NCollection_Map< TheKeyType, Hasher >::Differ ( const NCollection_Map< TheKeyType, Hasher > & theOther)
inline

Apply to this Map the symmetric difference (aka exclusive disjunction, boolean XOR) operation with another (given) Map. The result contains the values that are contained only in this or the operand map, but not in both. This algorithm is similar to method Difference(). Returns True if contents of this map is changed.

Deprecated
("This method will be removed right after 7.9. release. Use methods from "

◆ Difference()

template<class TheKeyType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
NCollection_MapAlgo hxx instead void NCollection_Map< TheKeyType, Hasher >::Difference ( const NCollection_Map< TheKeyType, Hasher > & theLeft,
const NCollection_Map< TheKeyType, Hasher > & theRight )
inline

Sets this Map to be the result of symmetric difference (aka exclusive disjunction, boolean XOR) operation between two given Maps. The new Map contains the values that are contained only in the first or the second operand maps but not in both. All previous content of this Map is cleared. This map (result of the boolean operation) can also be used as one of operands.

Deprecated
("This method will be removed right after 7.9. release. Use methods from "

◆ Emplace()

template<class TheKeyType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
template<typename... Args>
bool NCollection_Map< TheKeyType, Hasher >::Emplace ( Args &&... theArgs)
inline

Emplace constructs key in-place; if key exists, destroys and reconstructs.

Parameters
theArgsarguments forwarded to key constructor
Returns
true if key was newly added, false if key already existed (and was reconstructed)

◆ Emplaced()

template<class TheKeyType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
template<typename... Args>
const TheKeyType & NCollection_Map< TheKeyType, Hasher >::Emplaced ( Args &&... theArgs)
inline

Emplaced constructs key in-place; if key exists, destroys and reconstructs.

Parameters
theArgsarguments forwarded to key constructor
Returns
const reference to the key in the map

◆ emplaceImpl()

template<class TheKeyType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
template<bool IsTry, bool ReturnRef, typename... Args>
auto NCollection_Map< TheKeyType, Hasher >::emplaceImpl ( std::bool_constant< IsTry > ,
std::bool_constant< ReturnRef > ,
Args &&... theArgs ) -> std::conditional_t<ReturnRef, const TheKeyType&, bool>
inlineprotected

Implementation helper for Emplace/TryEmplace/Emplaced/TryEmplaced.

Template Parameters
IsTryif true, does not modify existing; if false, destroys and reconstructs
ReturnRefif true, returns const reference to key; if false, returns bool
Parameters
theArgsarguments forwarded to key constructor
Returns
bool or const TheKeyType& depending on ReturnRef

◆ end()

template<class TheKeyType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
iterator NCollection_Map< TheKeyType, Hasher >::end ( ) const
inlinenoexcept

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

◆ Exchange()

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

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

◆ GetHasher()

template<class TheKeyType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
const Hasher & NCollection_Map< TheKeyType, Hasher >::GetHasher ( ) const
inlinenoexcept

Returns const reference to the hasher.

◆ HashCode()

template<class TheKeyType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
size_t NCollection_Map< TheKeyType, Hasher >::HashCode ( const TheKeyType & theKey,
const size_t theUpperBound ) const
inlineprotected

◆ HasIntersection()

template<class TheKeyType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
NCollection_MapAlgo hxx instead bool NCollection_Map< TheKeyType, Hasher >::HasIntersection ( const NCollection_Map< TheKeyType, Hasher > & theMap) const
inline

Returns true if this and theMap have common elements.

Deprecated
("This method will be removed right after 7.9. release. Use methods from "

◆ Intersect()

template<class TheKeyType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
NCollection_MapAlgo hxx instead bool NCollection_Map< TheKeyType, Hasher >::Intersect ( const NCollection_Map< TheKeyType, Hasher > & theOther)
inline

Apply to this Map the intersection operation (aka multiplication, common, boolean AND) with another (given) Map. The result contains only the values that are contained in both this and the given maps. This algorithm is similar to method Intersection(). Returns True if contents of this map is changed.

Deprecated
("This method will be removed right after 7.9. release. Use methods from "

◆ Intersection()

template<class TheKeyType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
NCollection_MapAlgo hxx instead void NCollection_Map< TheKeyType, Hasher >::Intersection ( const NCollection_Map< TheKeyType, Hasher > & theLeft,
const NCollection_Map< TheKeyType, Hasher > & theRight )
inline

Sets this Map to be the result of intersection (aka multiplication, common, boolean AND) operation between two given Maps. The new Map contains only the values that are contained in both map operands. All previous content of this Map is cleared. This same map (result of the boolean operation) can also be used as one of operands.

Deprecated
("This method will be removed right after 7.9. release. Use methods from "

◆ IsEqual() [1/2]

template<class TheKeyType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
NCollection_MapAlgo hxx instead bool NCollection_Map< TheKeyType, Hasher >::IsEqual ( const NCollection_Map< TheKeyType, Hasher > & theOther) const
inline

Checks if two maps contain exactly the same keys. This function compares the keys of this map and another map and returns true if they contain exactly the same keys.

Deprecated
("This method will be removed right after 7.9. release. Use methods from "

◆ IsEqual() [2/2]

template<class TheKeyType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
bool NCollection_Map< TheKeyType, Hasher >::IsEqual ( const TheKeyType & theKey1,
const TheKeyType & theKey2 ) const
inlineprotected

◆ lookup() [1/2]

template<class TheKeyType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
bool NCollection_Map< TheKeyType, Hasher >::lookup ( const TheKeyType & theKey,
MapNode *& theNode ) const
inlineprotected

Lookup for particular key in map.

Parameters
[in]theKeykey to compute hash
[out]theNodethe detected node with equal key. Can be null.
Returns
true if key is found

◆ lookup() [2/2]

template<class TheKeyType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
bool NCollection_Map< TheKeyType, Hasher >::lookup ( const TheKeyType & theKey,
MapNode *& theNode,
size_t & theHash ) const
inlineprotected

Lookup for particular key in map.

Parameters
[in]theKeykey to compute hash
[out]theNodethe detected node with equal key. Can be null.
[out]theHashcomputed bounded hash code for current key.
Returns
true if key is found

◆ operator=() [1/2]

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

Assign operator.

◆ operator=() [2/2]

template<class TheKeyType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
NCollection_Map & NCollection_Map< TheKeyType, Hasher >::operator= ( NCollection_Map< TheKeyType, Hasher > && theOther)
inlinenoexcept

Move operator.

◆ Remove()

template<class TheKeyType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
bool NCollection_Map< TheKeyType, Hasher >::Remove ( const TheKeyType & K)
inline

Remove.

◆ ReSize() [1/2]

template<class TheKeyType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
void NCollection_Map< TheKeyType, Hasher >::ReSize ( const int N)
inline

◆ ReSize() [2/2]

template<class TheKeyType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
void NCollection_Map< TheKeyType, Hasher >::ReSize ( const size_t N)
inline

ReSize.

◆ Subtract()

template<class TheKeyType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
NCollection_MapAlgo hxx instead bool NCollection_Map< TheKeyType, Hasher >::Subtract ( const NCollection_Map< TheKeyType, Hasher > & theOther)
inline

Apply to this Map the subtraction (aka set-theoretic difference, relative complement, exclude, cut, boolean NOT) operation with another (given) Map. The result contains only the values that were previously contained in this map and not contained in this map. This algorithm is similar to method Subtract() with two operands. Returns True if contents of this map is changed.

Deprecated
("This method will be removed right after 7.9. release. Use methods from "

◆ Subtraction()

template<class TheKeyType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
NCollection_MapAlgo hxx instead void NCollection_Map< TheKeyType, Hasher >::Subtraction ( const NCollection_Map< TheKeyType, Hasher > & theLeft,
const NCollection_Map< TheKeyType, Hasher > & theRight )
inline

Sets this Map to be the result of subtraction (aka set-theoretic difference, relative complement, exclude, cut, boolean NOT) operation between two given Maps. The new Map contains only the values that are contained in the first map operands and not contained in the second one. All previous content of this Map is cleared.

Deprecated
("This method will be removed right after 7.9. release. Use methods from "

◆ TryEmplace()

template<class TheKeyType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
template<typename... Args>
bool NCollection_Map< TheKeyType, Hasher >::TryEmplace ( Args &&... theArgs)
inline

TryEmplace constructs key in-place only if not already present.

Parameters
theArgsarguments forwarded to key constructor
Returns
true if key was newly added, false if key already existed

◆ TryEmplaced()

template<class TheKeyType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
template<typename... Args>
const TheKeyType & NCollection_Map< TheKeyType, Hasher >::TryEmplaced ( Args &&... theArgs)
inline

TryEmplaced constructs key in-place only if not already present.

Parameters
theArgsarguments forwarded to key constructor
Returns
const reference to the key (existing or newly added)

◆ Union()

template<class TheKeyType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
NCollection_MapAlgo hxx instead void NCollection_Map< TheKeyType, Hasher >::Union ( const NCollection_Map< TheKeyType, Hasher > & theLeft,
const NCollection_Map< TheKeyType, Hasher > & theRight )
inline

Sets this Map to be the result of union (aka addition, fuse, merge, boolean OR) operation between two given Maps The new Map contains the values that are contained either in the first map or in the second map or in both. All previous content of this Map is cleared. This map (result of the boolean operation) can also be passed as one of operands.

Deprecated
("This method will be removed right after 7.9. release. Use methods from "

◆ Unite()

template<class TheKeyType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
NCollection_MapAlgo hxx instead bool NCollection_Map< TheKeyType, Hasher >::Unite ( const NCollection_Map< TheKeyType, Hasher > & theOther)
inline

Apply to this Map the boolean operation union (aka addition, fuse, merge, boolean OR) with another (given) Map. The result contains the values that were previously contained in this map or contained in the given (operand) map. This algorithm is similar to method Union(). Returns True if contents of this map is changed.

Deprecated
("This method will be removed right after 7.9. release. Use methods from "

Field Documentation

◆ myHasher

template<class TheKeyType , class Hasher = NCollection_DefaultHasher<TheKeyType>>
Hasher NCollection_Map< TheKeyType, Hasher >::myHasher
protected

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