![]() |
Open CASCADE Technology Reference Manual 8.0.0
|
Optimized Map for integer values of various integral types. More...
#include <NCollection_PackedMap.hxx>
Data Structures | |
| class | Iterator |
| Iterator of class NCollection_PackedMap. More... | |
Public Types | |
| using | BlockType = typename std::conditional<Is64Bit, uint64_t, uint32_t>::type |
| The block type for storing packed bits. | |
| using | IndexType = typename std::conditional<sizeof(IntType) <= 4, uint32_t, uint64_t>::type |
| The index type for addressing blocks. | |
Public Member Functions | |
| NCollection_PackedMap (const size_t theNbBuckets=1) | |
| Constructor. | |
| NCollection_PackedMap (const int theNbBuckets) | |
| Constructor (legacy int-taking). | |
| NCollection_PackedMap (const NCollection_PackedMap &theOther) | |
| Copy constructor. | |
| NCollection_PackedMap & | operator= (const NCollection_PackedMap &theOther) |
| NCollection_PackedMap (NCollection_PackedMap &&theOther) noexcept | |
| Move constructor. | |
| NCollection_PackedMap & | operator= (NCollection_PackedMap &&theOther) noexcept |
| Move assignment operator. | |
| NCollection_PackedMap & | Assign (const NCollection_PackedMap &theOther) |
| Assignment operator. | |
| void | ReSize (const size_t theNbBuckets) |
| Resize the map. | |
| void | ReSize (const int theNbBuckets) |
| Resize the map (legacy int-taking). | |
| void | Clear () |
| Clear the map. | |
| ~NCollection_PackedMap () | |
| bool | Add (const IntType theKey) |
| Add a key to the map. | |
| bool | Contains (const IntType theKey) const |
| Check if the map contains a key. | |
| bool | Remove (const IntType theKey) |
| Remove a key from the map. | |
| size_t | NbBuckets () const |
| Returns the number of map buckets. | |
| int | Extent () const |
| Returns map extent (legacy int-returning API). | |
| int | Length () const |
| Returns map extent (legacy int-returning API, synonym of Extent()). | |
| size_t | Size () const |
| Returns map extent. | |
| bool | IsEmpty () const |
| Returns TRUE if map is empty. | |
| IntType | GetMinimalMapped () const |
| Query the minimal contained key value. | |
| IntType | GetMaximalMapped () const |
| Query the maximal contained key value. | |
Static Public Attributes | |
| static constexpr bool | Is64Bit = sizeof(IntType) > 4 |
| True if the integer type is larger than 32 bits. | |
| static constexpr int | BitsPerBlock = Is64Bit ? 64 : 32 |
| Number of bits per block. | |
Deprecated boolean operations (use NCollection_PackedMapAlgo instead) | |
| NCollection_PackedMapAlgo hxx instead void | Union (const NCollection_PackedMap &theLeft, const NCollection_PackedMap &theRight) |
| NCollection_PackedMapAlgo hxx instead bool | Unite (const NCollection_PackedMap &theOther) |
| NCollection_PackedMapAlgo hxx instead void | Intersection (const NCollection_PackedMap &theLeft, const NCollection_PackedMap &theRight) |
| NCollection_PackedMapAlgo hxx instead bool | Intersect (const NCollection_PackedMap &theOther) |
| NCollection_PackedMapAlgo hxx instead void | Subtraction (const NCollection_PackedMap &theLeft, const NCollection_PackedMap &theRight) |
| NCollection_PackedMapAlgo hxx instead bool | Subtract (const NCollection_PackedMap &theOther) |
| NCollection_PackedMapAlgo hxx instead void | Difference (const NCollection_PackedMap &theLeft, const NCollection_PackedMap &theRight) |
| NCollection_PackedMapAlgo hxx instead bool | Differ (const NCollection_PackedMap &theOther) |
| NCollection_PackedMapAlgo hxx instead bool | IsEqual (const NCollection_PackedMap &theOther) const |
| NCollection_PackedMapAlgo hxx instead bool | IsSubset (const NCollection_PackedMap &theOther) const |
| NCollection_PackedMapAlgo hxx instead bool | HasIntersection (const NCollection_PackedMap &theOther) const |
| NCollection_PackedMapAlgo hxx instead bool | Contains (const NCollection_PackedMap &theOther) const |
| bool | Resizable () const |
| Returns TRUE if resizing the map should be considered. | |
| static IndexType | packedKeyIndex (IntType theKey) |
| Return an integer index for specified key. | |
| static size_t | hashCode (IndexType theKeyIndex, size_t theNbBuckets) |
| Compute hash code for a key index. | |
| static size_t | population (IndexType &theMask, BlockType theData) |
| Compute the population (i.e., the number of non-zero bits) of the block. The population is stored decremented as it is defined in PackedMapNode. | |
| static IntType | findNext (const PackedMapNode *theNode, BlockType &theMask) |
| Find the smallest non-zero bit under the given mask. Outputs the new mask that does not contain the detected bit. | |
| static IntType | findPrev (const PackedMapNode *theNode, BlockType &theMask) |
| Find the highest non-zero bit under the given mask. Outputs the new mask that does not contain the detected bit. | |
Optimized Map for integer values of various integral types.
This template class provides a memory-efficient storage for sets of integers. Each block of BitsPerBlock (32 or 64) consecutive integers is stored compactly using bit manipulation. The block size is automatically selected based on the integer type: 32 bits for int/unsigned, 64 bits for int64_t/size_t.
| IntType | The integral type to store (int, unsigned int, int64_t, size_t, etc.) |
| using NCollection_PackedMap< IntType >::BlockType = typename std::conditional<Is64Bit, uint64_t, uint32_t>::type |
The block type for storing packed bits.
| using NCollection_PackedMap< IntType >::IndexType = typename std::conditional<sizeof(IntType) <= 4, uint32_t, uint64_t>::type |
The index type for addressing blocks.
|
inline |
Constructor.
|
inline |
Constructor (legacy int-taking).
|
inline |
Copy constructor.
|
inlinenoexcept |
Move constructor.
|
inline |
|
inline |
Add a key to the map.
| [in] | theKey | the key to add |
|
inline |
Assignment operator.
|
inline |
Clear the map.
|
inline |
Check if the map contains a key.
| [in] | theKey | the key to check |
| bool NCollection_PackedMap< IntType >::Contains | ( | const NCollection_PackedMap< IntType > & | theOther | ) | const |
Use NCollection_PackedMapAlgo::Contains() instead
("This method will be removed after OCCT 7.9 release. Use methods from "
| bool NCollection_PackedMap< IntType >::Differ | ( | const NCollection_PackedMap< IntType > & | theOther | ) |
Use NCollection_PackedMapAlgo::Differ() instead
("This method will be removed after OCCT 7.9 release. Use methods from "
| void NCollection_PackedMap< IntType >::Difference | ( | const NCollection_PackedMap< IntType > & | theLeft, |
| const NCollection_PackedMap< IntType > & | theRight ) |
Use NCollection_PackedMapAlgo::Difference() instead
("This method will be removed after OCCT 7.9 release. Use methods from "
|
inline |
Returns map extent (legacy int-returning API).
|
inlinestaticprotected |
Find the smallest non-zero bit under the given mask. Outputs the new mask that does not contain the detected bit.
|
inlinestaticprotected |
Find the highest non-zero bit under the given mask. Outputs the new mask that does not contain the detected bit.
|
inline |
Query the maximal contained key value.
|
inline |
Query the minimal contained key value.
|
inlinestaticprotected |
Compute hash code for a key index.
| bool NCollection_PackedMap< IntType >::HasIntersection | ( | const NCollection_PackedMap< IntType > & | theOther | ) | const |
Use NCollection_PackedMapAlgo::HasIntersection() instead
("This method will be removed after OCCT 7.9 release. Use methods from "
| bool NCollection_PackedMap< IntType >::Intersect | ( | const NCollection_PackedMap< IntType > & | theOther | ) |
Use NCollection_PackedMapAlgo::Intersect() instead
("This method will be removed after OCCT 7.9 release. Use methods from "
| void NCollection_PackedMap< IntType >::Intersection | ( | const NCollection_PackedMap< IntType > & | theLeft, |
| const NCollection_PackedMap< IntType > & | theRight ) |
Use NCollection_PackedMapAlgo::Intersection() instead
("This method will be removed after OCCT 7.9 release. Use methods from "
|
inline |
Returns TRUE if map is empty.
| bool NCollection_PackedMap< IntType >::IsEqual | ( | const NCollection_PackedMap< IntType > & | theOther | ) | const |
Use NCollection_PackedMapAlgo::IsEqual() instead
("This method will be removed after OCCT 7.9 release. Use methods from "
| bool NCollection_PackedMap< IntType >::IsSubset | ( | const NCollection_PackedMap< IntType > & | theOther | ) | const |
Use NCollection_PackedMapAlgo::IsSubset() instead
("This method will be removed after OCCT 7.9 release. Use methods from "
|
inline |
Returns map extent (legacy int-returning API, synonym of Extent()).
|
inline |
Returns the number of map buckets.
|
inline |
|
inlinenoexcept |
Move assignment operator.
|
inlinestaticprotected |
Return an integer index for specified key.
|
inlinestaticprotected |
Compute the population (i.e., the number of non-zero bits) of the block. The population is stored decremented as it is defined in PackedMapNode.
|
inline |
Remove a key from the map.
| [in] | theKey | the key to remove |
|
inlineprotected |
Returns TRUE if resizing the map should be considered.
|
inline |
Resize the map (legacy int-taking).
|
inline |
Resize the map.
|
inline |
Returns map extent.
| bool NCollection_PackedMap< IntType >::Subtract | ( | const NCollection_PackedMap< IntType > & | theOther | ) |
Use NCollection_PackedMapAlgo::Subtract() instead
("This method will be removed after OCCT 7.9 release. Use methods from "
| void NCollection_PackedMap< IntType >::Subtraction | ( | const NCollection_PackedMap< IntType > & | theLeft, |
| const NCollection_PackedMap< IntType > & | theRight ) |
Use NCollection_PackedMapAlgo::Subtraction() instead
("This method will be removed after OCCT 7.9 release. Use methods from "
| void NCollection_PackedMap< IntType >::Union | ( | const NCollection_PackedMap< IntType > & | theLeft, |
| const NCollection_PackedMap< IntType > & | theRight ) |
Use NCollection_PackedMapAlgo::Union() instead
("This method will be removed after OCCT 7.9 release. Use methods from "
| bool NCollection_PackedMap< IntType >::Unite | ( | const NCollection_PackedMap< IntType > & | theOther | ) |
Use NCollection_PackedMapAlgo::Unite() instead
("This method will be removed after OCCT 7.9 release. Use methods from "
|
staticconstexpr |
Number of bits per block.
True if the integer type is larger than 32 bits.