![]() |
Open CASCADE Technology Reference Manual 8.0.0
|
Centralized transient cache for algorithm-computed per-node values. More...
#include <BRepGraph_TransientCache.hxx>
Data Structures | |
| struct | CacheSlot |
| Per-slot storage: cached value handle + SubtreeGen stamp. More... | |
Public Member Functions | |
| void | Set (const BRepGraph_NodeId theNode, const occ::handle< BRepGraph_CacheKind > &theKind, const occ::handle< BRepGraph_CacheValue > &theValue, const uint32_t theCurrentSubtreeGen) |
| Store a cached value for a node and cache kind. | |
| void | Set (const BRepGraph_NodeId theNode, const int theKindSlot, const occ::handle< BRepGraph_CacheValue > &theValue, const uint32_t theCurrentSubtreeGen) |
| Store a cached value using a pre-resolved kind slot index. Bypasses BRepGraph_CacheKindRegistry lookup - use in hot parallel paths. | |
| occ::handle< BRepGraph_CacheValue > | Get (const BRepGraph_NodeId theNode, const occ::handle< BRepGraph_CacheKind > &theKind, const uint32_t theCurrentSubtreeGen) const |
| Retrieve a cached value for a node and cache kind. | |
| occ::handle< BRepGraph_CacheValue > | Get (const BRepGraph_NodeId theNode, const int theKindSlot, const uint32_t theCurrentSubtreeGen) const |
| Retrieve a cached value using a pre-resolved kind slot index. Bypasses BRepGraph_CacheKindRegistry lookup - use in hot parallel paths. | |
| bool | Remove (const BRepGraph_NodeId theNode, const occ::handle< BRepGraph_CacheKind > &theKind) |
| Remove a cached value for a node and cache kind. | |
| bool | Remove (const BRepGraph_NodeId theNode, const int theKindSlot) |
| Remove a cached value using a pre-resolved cache-kind slot. | |
| int | CollectCacheKindSlots (const BRepGraph_NodeId theNode, const uint32_t theCurrentSubtreeGen, int theSlots[]) const |
| Collect fresh cache-kind slot indices for a node (zero heap allocation). Used internally by CacheView::CacheKindIterator. | |
| void | Reserve (const int theKindCount, const int theCounts[THE_KIND_COUNT]) |
| Pre-allocate storage for lock-free parallel access. | |
| bool | IsReserved () const noexcept |
| True if Reserve() has been called and storage is pre-allocated. | |
| void | Clear () noexcept |
| Clear all cached data. Called on BRepGraph_Builder::Add() and Compact(). | |
| BRepGraph_TransientCache (BRepGraph_TransientCache &&theOther) noexcept | |
| Move constructor: transfers data, creates fresh mutex. | |
| BRepGraph_TransientCache & | operator= (BRepGraph_TransientCache &&theOther) noexcept |
| Move assignment: transfers data, mutex stays local. | |
| BRepGraph_TransientCache ()=default | |
| BRepGraph_TransientCache (const BRepGraph_TransientCache &)=delete | |
| BRepGraph_TransientCache & | operator= (const BRepGraph_TransientCache &)=delete |
Static Public Attributes | |
| static constexpr int | THE_KIND_COUNT = BRepGraph_NodeId::THE_KIND_COUNT |
| Number of Kind enum slots to cover (0..11, with gap at 9). | |
| static constexpr int | THE_DEFAULT_RESERVED_KIND_COUNT = 16 |
| Default number of cache-kind slots reserved after BRepGraph_Builder::Add(). | |
Centralized transient cache for algorithm-computed per-node values.
Stores short-lived cached data (BndBox, UVBounds, etc.) in dense per-cache-kind vectors indexed by entity index. O(1) access by direct indexing - no hashing.
Each stored slot records SubtreeGen at write time. On read, if stored SubtreeGen differs from entity's current SubtreeGen the cached value is considered stale - the caller decides how to handle it.
NOT a Layer. Cleared on BRepGraph_Builder::Add() and Compact(). No OnNodeRemoved handling - stale data is auto-detected by SubtreeGen mismatch.
After Reserve(), Get() and Set() for in-range indices bypass the mutex entirely - safe because parallel algorithms access different entity slots. Out-of-range access (entities added after construction) falls back to mutex.
|
inlinenoexcept |
Move constructor: transfers data, creates fresh mutex.
|
default |
|
delete |
|
noexcept |
Clear all cached data. Called on BRepGraph_Builder::Add() and Compact().
| int BRepGraph_TransientCache::CollectCacheKindSlots | ( | const BRepGraph_NodeId | theNode, |
| const uint32_t | theCurrentSubtreeGen, | ||
| int | theSlots[] ) const |
Collect fresh cache-kind slot indices for a node (zero heap allocation). Used internally by CacheView::CacheKindIterator.
| [in] | theNode | node to query |
| [in] | theCurrentSubtreeGen | freshness stamp to match |
| [out] | theSlots | output array (caller-allocated, must hold THE_DEFAULT_RESERVED_KIND_COUNT) |
| occ::handle< BRepGraph_CacheValue > BRepGraph_TransientCache::Get | ( | const BRepGraph_NodeId | theNode, |
| const int | theKindSlot, | ||
| const uint32_t | theCurrentSubtreeGen ) const |
Retrieve a cached value using a pre-resolved kind slot index. Bypasses BRepGraph_CacheKindRegistry lookup - use in hot parallel paths.
| [in] | theKindSlot | slot from BRepGraph_CacheKindRegistry::Register() |
| occ::handle< BRepGraph_CacheValue > BRepGraph_TransientCache::Get | ( | const BRepGraph_NodeId | theNode, |
| const occ::handle< BRepGraph_CacheKind > & | theKind, | ||
| const uint32_t | theCurrentSubtreeGen ) const |
Retrieve a cached value for a node and cache kind.
|
inlinenoexcept |
True if Reserve() has been called and storage is pre-allocated.
|
inlinenoexcept |
Move assignment: transfers data, mutex stays local.
|
delete |
| bool BRepGraph_TransientCache::Remove | ( | const BRepGraph_NodeId | theNode, |
| const int | theKindSlot ) |
Remove a cached value using a pre-resolved cache-kind slot.
| bool BRepGraph_TransientCache::Remove | ( | const BRepGraph_NodeId | theNode, |
| const occ::handle< BRepGraph_CacheKind > & | theKind ) |
Remove a cached value for a node and cache kind.
| void BRepGraph_TransientCache::Reserve | ( | const int | theKindCount, |
| const int | theCounts[THE_KIND_COUNT] ) |
Pre-allocate storage for lock-free parallel access.
| void BRepGraph_TransientCache::Set | ( | const BRepGraph_NodeId | theNode, |
| const int | theKindSlot, | ||
| const occ::handle< BRepGraph_CacheValue > & | theValue, | ||
| const uint32_t | theCurrentSubtreeGen ) |
Store a cached value using a pre-resolved kind slot index. Bypasses BRepGraph_CacheKindRegistry lookup - use in hot parallel paths.
| [in] | theKindSlot | slot from BRepGraph_CacheKindRegistry::Register() |
| void BRepGraph_TransientCache::Set | ( | const BRepGraph_NodeId | theNode, |
| const occ::handle< BRepGraph_CacheKind > & | theKind, | ||
| const occ::handle< BRepGraph_CacheValue > & | theValue, | ||
| const uint32_t | theCurrentSubtreeGen ) |
Store a cached value for a node and cache kind.
Default number of cache-kind slots reserved after BRepGraph_Builder::Add().
|
staticconstexpr |
Number of Kind enum slots to cover (0..11, with gap at 9).