Open CASCADE Technology Reference Manual 8.0.2
Loading...
Searching...
No Matches
BRepGraph_LayerDeferred Class Reference

Base layer for postponed graph item loading. More...

#include <BRepGraph_LayerDeferred.hxx>

Inheritance diagram for BRepGraph_LayerDeferred:

Data Structures

struct  Entry
 Deferred ownership entry for one graph item. More...
struct  Representation
 One postponed representation attached to a graph item. More...

Public Types

enum class  RepresentationKind {
  Unknown , Geometry , Mesh , Topology ,
  Assembly , Parametric
}
 Representation category. More...
typedef void base_type
 Returns a type descriptor about this object.

Public Member Functions

 BRepGraph_LayerDeferred ()
 Constructor for generic deferred layers.
const Standard_GUID & ID () const override
 Return this layer type GUID.
const Entry * FindDeferred (const BRepGraph_ItemId theItem) const
 Return deferred entry for an item, or null if none exists.
const Entry * FindDeferred (const BRepGraph_NodeId theNode) const
 Return deferred entry for a node, or null if none exists.
const Entry * FindDeferred (const BRepGraph_RefId theRef) const
 Return deferred entry for a reference, or null if none exists.
bool HasDeferred (const BRepGraph_ItemId theItem) const
 Return true if an item has deferred representations.
bool HasDeferred (const BRepGraph_NodeId theNode) const
 Return true if a node has deferred representations.
bool HasDeferred (const BRepGraph_RefId theRef) const
 Return true if a reference has deferred representations.
void RegisterDeferred (const BRepGraph_ItemId theItem, const TCollection_AsciiString &theProvider, const TCollection_AsciiString &theSourceKey, const RepresentationKind theRepresentationKind, const TCollection_AsciiString &theRepresentationName, const uint32_t theSourceIndex)
 Register one postponed representation and lock the item.
void RegisterDeferredRepresentations (const BRepGraph_ItemId theItem, const TCollection_AsciiString &theProvider, const TCollection_AsciiString &theSourceKey, const Representation *theRepresentations, const size_t theNbRepresentations)
 Register postponed representations for one item and lock the item once.
void RegisterDeferredRepresentationsDirect (const BRepGraph_ItemId theItem, const TCollection_AsciiString &theProvider, const TCollection_AsciiString &theSourceKey, const Representation *theRepresentations, const size_t theNbRepresentations)
 Register postponed representations for a new item and lock it once.
void RegisterDeferred (const BRepGraph_NodeId theNode, const TCollection_AsciiString &theProvider, const TCollection_AsciiString &theSourceKey, const RepresentationKind theRepresentationKind, const TCollection_AsciiString &theRepresentationName, const uint32_t theSourceIndex)
 Register one postponed node representation and lock the node.
void RegisterDeferred (const BRepGraph_RefId theRef, const TCollection_AsciiString &theProvider, const TCollection_AsciiString &theSourceKey, const RepresentationKind theRepresentationKind, const TCollection_AsciiString &theRepresentationName, const uint32_t theSourceIndex)
 Register one postponed reference representation and lock the reference.
void UnregisterDeferred (const BRepGraph_ItemId theItem)
 Remove all deferred representations for an item and unlock it.
void UnregisterDeferred (const BRepGraph_NodeId theNode)
 Remove all deferred representations for a node and unlock it.
void UnregisterDeferred (const BRepGraph_RefId theRef)
 Remove all deferred representations for a reference and unlock it.
bool HasDeferredItems () const
 Return true if at least one item has deferred representations.
const Entry * FindFirstDeferred (const RepresentationKind theKind, BRepGraph_ItemId *theItem=nullptr) const
 Return first deferred entry with at least one representation of the requested kind, or null.
void ReserveDeferredItems (const size_t theNbItems)
 Reserve deferred and lock layer buckets for bulk registration.
void BeginBulkRegistration ()
 Begin bulk deferred registration. Revision updates are postponed until EndBulkRegistration().
void EndBulkRegistration ()
 Finish bulk deferred registration and publish one revision update if anything changed.
template<typename VisitorT>
void ForEachDeferred (VisitorT &&theVisitor) const
 Visit deferred entries. Callback receives item id and an entry copy; returning false stops.
template<typename VisitorT>
void ForEachDeferred (const RepresentationKind theKind, VisitorT &&theVisitor) const
 Visit deferred entries with at least one representation of the requested kind. Callback receives item id and an entry copy; returning false stops.
const TCollection_AsciiString & Name () const override
 Layer identity (unique within a graph).
void OnNodeRemoved (const BRepGraph_NodeId theNode) noexcept override
 Called when a node is soft-removed without a replacement.
void OnNodeReplaced (const BRepGraph_NodeId theOldNode, const BRepGraph_NodeId theNewNode) noexcept override
 Called when a node is soft-removed and replaced by another node.
void CopyTo (const BRepGraph_CopyRemap &theCopy) const override
 Copy this source layer data into another graph. The source graph is the graph this layer is attached to (Graph()).
void OnRefRemoved (const BRepGraph_RefId theRef) noexcept override
 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.
void InvalidateAll () noexcept override
 Mark all cached values dirty (bulk invalidation).
void Clear () noexcept override
 Clear all stored data.
Public Member Functions inherited from BRepGraph_Layer
void OnItemRemoved (const BRepGraph_ItemId theItem) noexcept
 Dispatch a generic item removal to the matching typed removal callback. This is a non-virtual convenience entry point; typed callbacks remain the extension points for derived layers.
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.
void OnItemModified (const BRepGraph_ItemId theItem) noexcept
 Dispatch a generic item modification to the matching typed modification callback. This is a non-virtual convenience entry point; typed callbacks remain the extension points for derived layers.
virtual void OnNodesModified (const NCollection_Array1< 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 array 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 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_Array1< BRepGraph_RefId > &theModifiedRefs) 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 array 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.
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 const Standard_GUID & GetID ()
 Return fixed layer type GUID.
Static Public Member Functions inherited from BRepGraph_Layer
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 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.

Additional Inherited Members

Protected Member Functions inherited from BRepGraph_Layer
 BRepGraph_Layer ()
void touch () noexcept
 Bump the revision counter.
bool IsAttached () const noexcept
 True while this layer is registered in a live graph registry.
const BRepGraph & Graph () const
 Attached graph for read-only layer services. Raises Standard_ProgramError if detached.
BRepGraph * AttachedGraph () const noexcept
 Attached mutable graph for graph-owned service layers. Returns null if detached.
virtual void OnAttached () noexcept
 Called after the layer is attached to a graph registry.
virtual void OnDetached () noexcept
 Called before the layer is detached from a graph registry.
Static Protected Member Functions inherited from BRepGraph_Layer
template<BRepGraph_NodeId::Kind TheKind>
static BRepGraph_NodeId::Typed< TheKind > RemappedItem (const BRepGraph_CopyRemap &theCopy, const BRepGraph_NodeId::Typed< TheKind > theId)
template<BRepGraph_RefId::Kind TheKind>
static BRepGraph_RefId::Typed< TheKind > RemappedItem (const BRepGraph_CopyRemap &theCopy, const BRepGraph_RefId::Typed< TheKind > theId)

Detailed Description

Base layer for postponed graph item loading.

The layer stores provider-neutral deferred representation records and owns the lock state through BRepGraph_LayerLock. Format-specific loaders, such as ODE or STEP, should derive from this class or use the same representation contract rather than storing deferred ownership in topology definitions.

Member Enumeration Documentation

◆ RepresentationKind

Representation category.

Enumerator
Unknown 
Geometry 
Mesh 
Topology 
Assembly 
Parametric 

Constructor & Destructor Documentation

◆ BRepGraph_LayerDeferred()

BRepGraph_LayerDeferred::BRepGraph_LayerDeferred ( )

Constructor for generic deferred layers.

Member Function Documentation

◆ BeginBulkRegistration()

void BRepGraph_LayerDeferred::BeginBulkRegistration ( )

Begin bulk deferred registration. Revision updates are postponed until EndBulkRegistration().

◆ Clear()

void BRepGraph_LayerDeferred::Clear ( )
overridevirtualnoexcept

Clear all stored data.

Implements BRepGraph_Layer.

◆ CopyTo()

void BRepGraph_LayerDeferred::CopyTo ( const BRepGraph_CopyRemap & theCopy) const
overridevirtual

Copy this source layer data into another graph. The source graph is the graph this layer is attached to (Graph()).

Parameters
[in]theCopysource graph, target graph, and source item id -> target item id remap
Note
Missing source items were not copied; persistent layers should skip dependent records.
For BRepGraph_CopyRemap::Mode::Compact, the layer is being migrated in-place after structural compaction. UID/ItemUID records and ref/rep entries should be remapped through the item map. Stale entries (absent from the remap) should be dropped.
Warning
This callback may allocate and is intentionally not noexcept.

Implements BRepGraph_Layer.

◆ EndBulkRegistration()

void BRepGraph_LayerDeferred::EndBulkRegistration ( )

Finish bulk deferred registration and publish one revision update if anything changed.

◆ FindDeferred() [1/3]

const Entry * BRepGraph_LayerDeferred::FindDeferred ( const BRepGraph_ItemId theItem) const
nodiscard

Return deferred entry for an item, or null if none exists.

◆ FindDeferred() [2/3]

const Entry * BRepGraph_LayerDeferred::FindDeferred ( const BRepGraph_NodeId theNode) const
inlinenodiscard

Return deferred entry for a node, or null if none exists.

◆ FindDeferred() [3/3]

const Entry * BRepGraph_LayerDeferred::FindDeferred ( const BRepGraph_RefId theRef) const
inlinenodiscard

Return deferred entry for a reference, or null if none exists.

◆ FindFirstDeferred()

const Entry * BRepGraph_LayerDeferred::FindFirstDeferred ( const RepresentationKind theKind,
BRepGraph_ItemId * theItem = nullptr ) const
nodiscard

Return first deferred entry with at least one representation of the requested kind, or null.

◆ ForEachDeferred() [1/2]

template<typename VisitorT>
void BRepGraph_LayerDeferred::ForEachDeferred ( const RepresentationKind theKind,
VisitorT && theVisitor ) const
inline

Visit deferred entries with at least one representation of the requested kind. Callback receives item id and an entry copy; returning false stops.

◆ ForEachDeferred() [2/2]

template<typename VisitorT>
void BRepGraph_LayerDeferred::ForEachDeferred ( VisitorT && theVisitor) const
inline

Visit deferred entries. Callback receives item id and an entry copy; returning false stops.

◆ GetID()

const Standard_GUID & BRepGraph_LayerDeferred::GetID ( )
staticnodiscard

Return fixed layer type GUID.

◆ HasDeferred() [1/3]

bool BRepGraph_LayerDeferred::HasDeferred ( const BRepGraph_ItemId theItem) const
nodiscard

Return true if an item has deferred representations.

◆ HasDeferred() [2/3]

bool BRepGraph_LayerDeferred::HasDeferred ( const BRepGraph_NodeId theNode) const
inlinenodiscard

Return true if a node has deferred representations.

◆ HasDeferred() [3/3]

bool BRepGraph_LayerDeferred::HasDeferred ( const BRepGraph_RefId theRef) const
inlinenodiscard

Return true if a reference has deferred representations.

◆ HasDeferredItems()

bool BRepGraph_LayerDeferred::HasDeferredItems ( ) const
inlinenodiscard

Return true if at least one item has deferred representations.

◆ ID()

const Standard_GUID & BRepGraph_LayerDeferred::ID ( ) const
nodiscardoverridevirtual

Return this layer type GUID.

Implements BRepGraph_Layer.

◆ InvalidateAll()

void BRepGraph_LayerDeferred::InvalidateAll ( )
overridevirtualnoexcept

Mark all cached values dirty (bulk invalidation).

Implements BRepGraph_Layer.

◆ Name()

const TCollection_AsciiString & BRepGraph_LayerDeferred::Name ( ) const
overridevirtual

Layer identity (unique within a graph).

Implements BRepGraph_Layer.

◆ OnNodeRemoved()

void BRepGraph_LayerDeferred::OnNodeRemoved ( const BRepGraph_NodeId theNode)
overridevirtualnoexcept

Called when a node is soft-removed without a replacement.

Parameters
[in]theNodethe removed node Layers should discard or archive data associated with it.
Warning
Layer callbacks must not throw. They are called from noexcept notification paths (MutGuard destructors, deferred invalidation flush).

Reimplemented from BRepGraph_Layer.

◆ OnNodeReplaced()

void BRepGraph_LayerDeferred::OnNodeReplaced ( const BRepGraph_NodeId theOldNode,
const BRepGraph_NodeId theNewNode )
overridevirtualnoexcept

Called when a node is soft-removed and replaced by another node.

Parameters
[in]theOldNodethe removed node
[in]theNewNodethe node that replaces theOldNode Layers that store node-keyed data should migrate from theOldNode to theNewNode when the replacement kind is compatible. This is a structural lifecycle event, not an algorithmic history record.
Warning
Layer callbacks must not throw. They are called from noexcept notification paths (MutGuard destructors, deferred invalidation flush).

Reimplemented from BRepGraph_Layer.

◆ OnRefRemoved()

void BRepGraph_LayerDeferred::OnRefRemoved ( const BRepGraph_RefId theRef)
overridevirtualnoexcept

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.

Parameters
[in]theRefthe removed reference

Reimplemented from BRepGraph_Layer.

◆ RegisterDeferred() [1/3]

void BRepGraph_LayerDeferred::RegisterDeferred ( const BRepGraph_ItemId theItem,
const TCollection_AsciiString & theProvider,
const TCollection_AsciiString & theSourceKey,
const RepresentationKind theRepresentationKind,
const TCollection_AsciiString & theRepresentationName,
const uint32_t theSourceIndex )

Register one postponed representation and lock the item.

◆ RegisterDeferred() [2/3]

void BRepGraph_LayerDeferred::RegisterDeferred ( const BRepGraph_NodeId theNode,
const TCollection_AsciiString & theProvider,
const TCollection_AsciiString & theSourceKey,
const RepresentationKind theRepresentationKind,
const TCollection_AsciiString & theRepresentationName,
const uint32_t theSourceIndex )
inline

Register one postponed node representation and lock the node.

◆ RegisterDeferred() [3/3]

void BRepGraph_LayerDeferred::RegisterDeferred ( const BRepGraph_RefId theRef,
const TCollection_AsciiString & theProvider,
const TCollection_AsciiString & theSourceKey,
const RepresentationKind theRepresentationKind,
const TCollection_AsciiString & theRepresentationName,
const uint32_t theSourceIndex )
inline

Register one postponed reference representation and lock the reference.

◆ RegisterDeferredRepresentations()

void BRepGraph_LayerDeferred::RegisterDeferredRepresentations ( const BRepGraph_ItemId theItem,
const TCollection_AsciiString & theProvider,
const TCollection_AsciiString & theSourceKey,
const Representation * theRepresentations,
const size_t theNbRepresentations )

Register postponed representations for one item and lock the item once.

◆ RegisterDeferredRepresentationsDirect()

void BRepGraph_LayerDeferred::RegisterDeferredRepresentationsDirect ( const BRepGraph_ItemId theItem,
const TCollection_AsciiString & theProvider,
const TCollection_AsciiString & theSourceKey,
const Representation * theRepresentations,
const size_t theNbRepresentations )

Register postponed representations for a new item and lock it once.

This is a trusted bulk-load fast path: the caller must ensure the item is valid, has no existing deferred entry, and theRepresentations contains no duplicates.

◆ ReserveDeferredItems()

void BRepGraph_LayerDeferred::ReserveDeferredItems ( const size_t theNbItems)

Reserve deferred and lock layer buckets for bulk registration.

◆ UnregisterDeferred() [1/3]

void BRepGraph_LayerDeferred::UnregisterDeferred ( const BRepGraph_ItemId theItem)

Remove all deferred representations for an item and unlock it.

◆ UnregisterDeferred() [2/3]

void BRepGraph_LayerDeferred::UnregisterDeferred ( const BRepGraph_NodeId theNode)
inline

Remove all deferred representations for a node and unlock it.

◆ UnregisterDeferred() [3/3]

void BRepGraph_LayerDeferred::UnregisterDeferred ( const BRepGraph_RefId theRef)
inline

Remove all deferred representations for a reference and unlock it.


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