Open CASCADE Technology Reference Manual 8.0.2
Loading...
Searching...
No Matches
BRepGraph_MutGuard< T > Class Template Reference

RAII scope token batching mutation notifications for a single entity. More...

#include <BRepGraph_MutGuard.hxx>

Public Member Functions

 BRepGraph_MutGuard (BRepGraph &theGraph, BRepGraphInc_Storage &theStorage, T *theEntity, const TypeId theId)
 Construct a guard over a mutable entity. Registers the item via the storage bit-plane. The Mut() factory pre-validates that no guard is active, so this assertion should never fire in normal use.
 ~BRepGraph_MutGuard ()
 Destructor: clears the guard bit-plane and notifies the graph if the guard owns an entity AND at least one setter (or MarkDirty) flagged it modified. Guard clearance happens BEFORE notification so that markModified() propagation does not see a stale guard registration on the same item.
 BRepGraph_MutGuard (BRepGraph_MutGuard &&theOther) noexcept
 Move constructor: transfers guard ownership. The source becomes inert and will not deregister on its destruction.
BRepGraph_MutGuard & operator= (BRepGraph_MutGuard &&theOther) noexcept
 Move assignment: deregisters current guard (if active), then transfers ownership from the source. The source becomes inert.
 BRepGraph_MutGuard (const BRepGraph_MutGuard &)=delete
BRepGraph_MutGuard & operator= (const BRepGraph_MutGuard &)=delete
 operator bool () const noexcept
 True when the guard still owns an entity; false after a move or when constructed in an inert state.
const T * operator-> () const
 Read-only access via pointer syntax. Field writes go through the Editor's typed setters.
const T & operator* () const
 Read-only dereference.
TypeId Id () const noexcept
 Identity for notification.
BRepGraph & Graph () const
 Owning graph handle.
void MarkDirty () noexcept
 Flag the guarded entity as modified without writing through Internal(). Use when an external mutation (e.g. in-place geometry transform on a shared Geom handle) is not visible to the guard.
bool IsDirty () const noexcept
 True if Internal() or MarkDirty() flagged the entity modified.
T & Internal () noexcept
 INTERNAL USE ONLY. Mutable accessor; auto-flags dirty. External code MUST go through Editor's typed setters. Use operator->() / operator*() for reads.

Detailed Description

template<typename T>
class BRepGraph_MutGuard< T >

RAII scope token batching mutation notifications for a single entity.

Obtained via BRepGraph::Editor().<Ops>().Mut() / MutRef() / MutSurface() etc. Reads via operator->() / operator*(); writes via Editor's typed setters (or Internal() for in-tree structural remaps). Any call to Internal() flags the guard dirty and the destructor fires markModified / markRefModified once on scope exit.

The guard registers itself as active on the guarded item at construction and deregisters on destruction. This prevents double-mutation: attempting to acquire a second guard on the same item while the first is still alive will throw. Move-only; after a move, the source guard becomes inert and does not deregister.

Compile-time dispatch selects the ID type and notification method:

{
theGraph.Editor().Edges().Mut(BRepGraph_EdgeId(42));
theGraph.Editor().Edges().SetTolerance(anEdge, 0.5);
} // markModified called once here, guard deregistered
BRepGraph_NodeId::Typed< BRepGraph_NodeId::Kind::Edge > BRepGraph_EdgeId
Definition BRepGraph_NodeId.hxx:409
BRepGraph_MutGuard(BRepGraph &theGraph, BRepGraphInc_Storage &theStorage, T *theEntity, const TypeId theId)
Construct a guard over a mutable entity. Registers the item via the storage bit-plane....
Definition BRepGraph_MutGuard.hxx:86

Constructor & Destructor Documentation

◆ BRepGraph_MutGuard() [1/3]

template<typename T>
BRepGraph_MutGuard< T >::BRepGraph_MutGuard ( BRepGraph & theGraph,
BRepGraphInc_Storage & theStorage,
T * theEntity,
const TypeId theId )
inline

Construct a guard over a mutable entity. Registers the item via the storage bit-plane. The Mut() factory pre-validates that no guard is active, so this assertion should never fire in normal use.

Parameters
[in]theGraphowning graph (used for notification)
[in]theStoragestorage instance (for bit-plane guard tracking)
[in]theEntitypointer to the mutable entity
[in]theIdidentity for notification and guard registration

◆ ~BRepGraph_MutGuard()

template<typename T>
BRepGraph_MutGuard< T >::~BRepGraph_MutGuard ( )
inline

Destructor: clears the guard bit-plane and notifies the graph if the guard owns an entity AND at least one setter (or MarkDirty) flagged it modified. Guard clearance happens BEFORE notification so that markModified() propagation does not see a stale guard registration on the same item.

◆ BRepGraph_MutGuard() [2/3]

template<typename T>
BRepGraph_MutGuard< T >::BRepGraph_MutGuard ( BRepGraph_MutGuard< T > && theOther)
inlinenoexcept

Move constructor: transfers guard ownership. The source becomes inert and will not deregister on its destruction.

◆ BRepGraph_MutGuard() [3/3]

template<typename T>
BRepGraph_MutGuard< T >::BRepGraph_MutGuard ( const BRepGraph_MutGuard< T > & )
delete

Member Function Documentation

◆ Graph()

template<typename T>
BRepGraph & BRepGraph_MutGuard< T >::Graph ( ) const
inlinenodiscard

Owning graph handle.

◆ Id()

template<typename T>
TypeId BRepGraph_MutGuard< T >::Id ( ) const
inlinenodiscardnoexcept

Identity for notification.

◆ Internal()

template<typename T>
T & BRepGraph_MutGuard< T >::Internal ( )
inlinenodiscardnoexcept

INTERNAL USE ONLY. Mutable accessor; auto-flags dirty. External code MUST go through Editor's typed setters. Use operator->() / operator*() for reads.

◆ IsDirty()

template<typename T>
bool BRepGraph_MutGuard< T >::IsDirty ( ) const
inlinenodiscardnoexcept

True if Internal() or MarkDirty() flagged the entity modified.

◆ MarkDirty()

template<typename T>
void BRepGraph_MutGuard< T >::MarkDirty ( )
inlinenoexcept

Flag the guarded entity as modified without writing through Internal(). Use when an external mutation (e.g. in-place geometry transform on a shared Geom handle) is not visible to the guard.

◆ operator bool()

template<typename T>
BRepGraph_MutGuard< T >::operator bool ( ) const
inlineexplicitnodiscardnoexcept

True when the guard still owns an entity; false after a move or when constructed in an inert state.

◆ operator*()

template<typename T>
const T & BRepGraph_MutGuard< T >::operator* ( ) const
inlinenodiscard

Read-only dereference.

◆ operator->()

template<typename T>
const T * BRepGraph_MutGuard< T >::operator-> ( ) const
inlinenodiscard

Read-only access via pointer syntax. Field writes go through the Editor's typed setters.

◆ operator=() [1/2]

template<typename T>
BRepGraph_MutGuard & BRepGraph_MutGuard< T >::operator= ( BRepGraph_MutGuard< T > && theOther)
inlinenoexcept

Move assignment: deregisters current guard (if active), then transfers ownership from the source. The source becomes inert.

◆ operator=() [2/2]

template<typename T>
BRepGraph_MutGuard & BRepGraph_MutGuard< T >::operator= ( const BRepGraph_MutGuard< T > & )
delete

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