![]() |
Open CASCADE Technology Reference Manual 8.0.0
|
Abstract base class for named attribute layers. More...
#include <BRepGraph_Layer.hxx>

Public Member Functions | |
| virtual const Standard_GUID & | ID () const =0 |
| Layer type identity (unique within a graph). | |
| virtual const TCollection_AsciiString & | Name () const =0 |
| Layer identity (unique within a graph). | |
| virtual void | OnNodeRemoved (const BRepGraph_NodeId theNode, const BRepGraph_NodeId theReplacement) noexcept=0 |
| Called when a node is soft-removed. | |
| virtual void | OnCompact (const NCollection_DataMap< BRepGraph_NodeId, BRepGraph_NodeId > &theRemapMap) noexcept=0 |
| Called after Compact with a unified old->new remap map. Layer must remap all internal NodeId references using this map. The map covers all node kinds (Vertex through CompSolid and future extensions). Nodes absent from the map were removed during compaction - layers should drop data associated with those nodes. | |
| virtual void | InvalidateAll () noexcept=0 |
| Mark all cached values dirty (bulk invalidation). | |
| virtual void | Clear () noexcept=0 |
| Clear all stored data. | |
| virtual int | SubscribedKinds () const |
| Return a bitmask of BRepGraph_NodeId::Kind values this layer subscribes to. Only modification events matching subscribed kinds are dispatched. Default: 0 (no subscription - no modification events received). Override to receive OnNodeModified/OnNodesModified callbacks. The returned value must be constant for the lifetime of the layer. | |
| virtual void | OnNodeModified (const BRepGraph_NodeId theNode) noexcept |
| Called in immediate (non-deferred) mode after a single node is modified. Only dispatched if the node's kind matches SubscribedKinds(). Default: no-op. | |
| virtual void | OnNodesModified (const NCollection_DynamicArray< BRepGraph_NodeId > &theModifiedNodes) noexcept |
| Called after EndDeferredInvalidation() with all nodes modified during the deferred scope. Only dispatched if at least one modified node's kind matches SubscribedKinds(). The vector may contain nodes of kinds not subscribed to - layers should filter internally if needed. Default: no-op. | |
| virtual int | SubscribedRefKinds () const |
| Return a bitmask of BRepGraph_RefId::Kind values this layer subscribes to. Only modification events matching subscribed ref kinds are dispatched. Default: 0 (no subscription). Must be constant for the layer's lifetime. | |
| virtual void | OnRefRemoved (const BRepGraph_RefId theRef) noexcept |
| Called when a reference is soft-deleted via RemoveRef(). No replacement concept - refs are simply removed (unlike nodes which can have a replacement during sewing or deduplication). Dispatched to all layers regardless of SubscribedRefKinds(). Default: no-op. | |
| virtual void | OnRefModified (const BRepGraph_RefId theRef) noexcept |
| Called in immediate (non-deferred) mode after a single ref is mutated. Only dispatched if the ref's kind matches SubscribedRefKinds(). Default: no-op. | |
| virtual void | OnRefsModified (const NCollection_DynamicArray< BRepGraph_RefId > &theModifiedRefs, const int theModifiedRefKindsMask) noexcept |
| Called after EndDeferredInvalidation() with all refs modified during the deferred scope. Only dispatched if at least one modified ref's kind matches SubscribedRefKinds(). The vector may contain refs of kinds not subscribed to - layers should filter internally if needed. Default: no-op. | |
| uint64_t | Revision () const noexcept |
| Monotonic revision counter incremented by touch() on every observable state change. Consumers compare stored revisions to detect staleness in O(1). Derived layers MUST call touch() from their mutators. | |
| const BRepGraph * | OwningGraph () const noexcept |
| Owning graph, set by the registry on RegisterLayer() and cleared on Unregister(). Nullptr before registration or after unregistration. | |
| BRepGraph * | OwningMutableGraph () const noexcept |
| Mutable accessor for layers that drive graph mutations (e.g. meshing). | |
Public Member Functions inherited from Standard_Transient | |
| Standard_Transient () | |
| Empty constructor. | |
| Standard_Transient (const Standard_Transient &) | |
| Copy constructor – does nothing. | |
| Standard_Transient & | operator= (const Standard_Transient &) |
| Assignment operator, needed to avoid copying reference counter. | |
| virtual | ~Standard_Transient ()=default |
| Destructor must be virtual. | |
| virtual const opencascade::handle< Standard_Type > & | DynamicType () const |
| Returns a type descriptor about this object. | |
| bool | IsInstance (const opencascade::handle< Standard_Type > &theType) const |
| Returns a true value if this is an instance of Type. | |
| bool | IsInstance (const char *const theTypeName) const |
| Returns a true value if this is an instance of TypeName. | |
| bool | IsKind (const opencascade::handle< Standard_Type > &theType) const |
| Returns true if this is an instance of Type or an instance of any class that inherits from Type. Note that multiple inheritance is not supported by OCCT RTTI mechanism. | |
| bool | IsKind (const char *const theTypeName) const |
| Returns true if this is an instance of TypeName or an instance of any class that inherits from TypeName. Note that multiple inheritance is not supported by OCCT RTTI mechanism. | |
| Standard_Transient * | This () const |
| Returns non-const pointer to this object (like const_cast). For protection against creating handle to objects allocated in stack or call from constructor, it will raise exception Standard_ProgramError if reference counter is zero. | |
| int | GetRefCount () const noexcept |
| Get the reference counter of this object. | |
| void | IncrementRefCounter () noexcept |
| Increments the reference counter of this object. Uses relaxed memory ordering since incrementing only requires atomicity, not synchronization with other memory operations. | |
| int | DecrementRefCounter () noexcept |
| Decrements the reference counter of this object; returns the decremented value. Uses release ordering for the decrement to ensure all writes to the object are visible before the count reaches zero. An acquire fence is added only when the count reaches zero, ensuring proper synchronization before deletion. This is more efficient than using acq_rel for every decrement. | |
| virtual void | Delete () const |
| Memory deallocator for transient classes. | |
Static Public Member Functions | |
| static int | KindBit (const BRepGraph_NodeId::Kind theKind) |
| Convenience: return bitmask bit for a given Kind. | |
| static int | RefKindBit (const BRepGraph_RefId::Kind theKind) |
| Convenience: return bitmask bit for a given RefId::Kind. | |
Static Public Member Functions inherited from Standard_Transient | |
| static constexpr const char * | get_type_name () |
| Returns a type descriptor about this object. | |
| static const opencascade::handle< Standard_Type > & | get_type_descriptor () |
| Returns type descriptor of Standard_Transient class. | |
Protected Member Functions | |
| void | touch () noexcept |
| Bump the revision counter. | |
Additional Inherited Members | |
Public Types inherited from Standard_Transient | |
| typedef void | base_type |
| Returns a type descriptor about this object. | |
Abstract base class for named attribute layers.
A layer groups per-node and per-reference metadata under a unique name with lifecycle callbacks. Layers are registered on BRepGraph and automatically notified when nodes or references are removed, remapped (compact), or modified.
Derived layers store domain-specific data (names, colors, materials, etc.) in internal maps keyed by BRepGraph_NodeId or BRepGraph_RefId. The lifecycle callbacks ensure data consistency across all graph mutations.
Layers subscribe to node modification events by overriding SubscribedKinds() to return a non-zero bitmask of Kind values. When a subscribed node kind is modified, OnNodeModified() (immediate mode) or OnNodesModified() (deferred batch mode) is called. Layers with SubscribedKinds() == 0 (default) incur zero dispatch overhead.
Layers subscribe to reference modification events by overriding SubscribedRefKinds() to return a non-zero bitmask of BRepGraph_RefId::Kind values. When a subscribed ref kind is mutated, OnRefModified() (immediate mode) or OnRefsModified() (deferred batch mode) is called. Removal is always dispatched via OnRefRemoved() regardless of subscription.
Callback dispatch is single-threaded (called from mutation paths). Layers that only provide read access can skip internal locking.
Clear all stored data.
Implemented in BRepGraph_LayerParam, and BRepGraph_LayerRegularity.
|
pure virtual |
Layer type identity (unique within a graph).
Implemented in BRepGraph_LayerParam, and BRepGraph_LayerRegularity.
Mark all cached values dirty (bulk invalidation).
Implemented in BRepGraph_LayerParam, and BRepGraph_LayerRegularity.
|
inlinestatic |
Convenience: return bitmask bit for a given Kind.
|
pure virtual |
Layer identity (unique within a graph).
Implemented in BRepGraph_LayerParam, and BRepGraph_LayerRegularity.
|
pure virtualnoexcept |
Called after Compact with a unified old->new remap map. Layer must remap all internal NodeId references using this map. The map covers all node kinds (Vertex through CompSolid and future extensions). Nodes absent from the map were removed during compaction - layers should drop data associated with those nodes.
| [in] | theRemapMap | maps old NodeId to new NodeId for all surviving nodes |
Implemented in BRepGraph_LayerParam, and BRepGraph_LayerRegularity.
|
virtualnoexcept |
Called in immediate (non-deferred) mode after a single node is modified. Only dispatched if the node's kind matches SubscribedKinds(). Default: no-op.
| [in] | theNode | the modified node |
|
pure virtualnoexcept |
Called when a node is soft-removed.
| [in] | theNode | the removed node |
| [in] | theReplacement | if valid, the node that replaces theNode (e.g., sewing edge merge, deduplicate). If invalid, pure deletion. Layers should migrate data from theNode to theReplacement when valid, otherwise discard or archive removed-node data. Implementations must validate theReplacement before dereferencing graph data through it. |
Implemented in BRepGraph_LayerParam, and BRepGraph_LayerRegularity.
|
virtualnoexcept |
Called after EndDeferredInvalidation() with all nodes modified during the deferred scope. Only dispatched if at least one modified node's kind matches SubscribedKinds(). The vector may contain nodes of kinds not subscribed to - layers should filter internally if needed. Default: no-op.
| [in] | theModifiedNodes | all modified, non-removed nodes |
|
virtualnoexcept |
Called in immediate (non-deferred) mode after a single ref is mutated. Only dispatched if the ref's kind matches SubscribedRefKinds(). Default: no-op.
| [in] | theRef | the modified reference |
|
virtualnoexcept |
Called when a reference is soft-deleted via RemoveRef(). No replacement concept - refs are simply removed (unlike nodes which can have a replacement during sewing or deduplication). Dispatched to all layers regardless of SubscribedRefKinds(). Default: no-op.
| [in] | theRef | the removed reference |
|
virtualnoexcept |
Called after EndDeferredInvalidation() with all refs modified during the deferred scope. Only dispatched if at least one modified ref's kind matches SubscribedRefKinds(). The vector may contain refs of kinds not subscribed to - layers should filter internally if needed. Default: no-op.
| [in] | theModifiedRefs | all modified, non-removed refs |
| [in] | theModifiedRefKindsMask | bitwise OR of all modified ref kinds |
|
inlinenoexcept |
Owning graph, set by the registry on RegisterLayer() and cleared on Unregister(). Nullptr before registration or after unregistration.
|
inlinenoexcept |
Mutable accessor for layers that drive graph mutations (e.g. meshing).
|
inlinestatic |
Convenience: return bitmask bit for a given RefId::Kind.
|
inlinenoexcept |
Return a bitmask of BRepGraph_NodeId::Kind values this layer subscribes to. Only modification events matching subscribed kinds are dispatched. Default: 0 (no subscription - no modification events received). Override to receive OnNodeModified/OnNodesModified callbacks. The returned value must be constant for the lifetime of the layer.
Return a bitmask of BRepGraph_RefId::Kind values this layer subscribes to. Only modification events matching subscribed ref kinds are dispatched. Default: 0 (no subscription). Must be constant for the layer's lifetime.
|
inlineprotectednoexcept |
Bump the revision counter.