Open CASCADE Technology Reference Manual 8.0.0
Loading...
Searching...
No Matches
Public Member Functions
BRepGraph_History Class Reference

Extracted history subsystem for BRepGraph. More...

#include <BRepGraph_History.hxx>

Public Member Functions

void Record (const TCollection_AsciiString &theOpLabel, const BRepGraph_NodeId theOriginal, const NCollection_DynamicArray< BRepGraph_NodeId > &theReplacements)
 Record a modification: theOriginal was replaced by theReplacements.
 
void RecordBatch (const TCollection_AsciiString &theOpLabel, const NCollection_DynamicArray< BRepGraph_NodeId > &theOriginals, const NCollection_DynamicArray< BRepGraph_NodeId > &theReplacements, const TCollection_AsciiString &theExtraInfo=TCollection_AsciiString())
 Record a batch of 1-to-1 modifications in a single history event. theOriginals[i] was replaced by theReplacements[i]. More efficient than calling Record() in a loop: creates one HistoryRecord and updates the bidirectional maps with minimal overhead.
 
BRepGraph_NodeId FindOriginal (const BRepGraph_NodeId theModified) const
 Walk backwards from a modified node to its original. Follows the reverse map recursively until a root is reached.
 
NCollection_DynamicArray< BRepGraph_NodeIdFindDerived (const BRepGraph_NodeId theOriginal) const
 Walk forwards from an original node to all derived nodes. Follows the forward map recursively, collecting all leaves.
 
size_t NbRecords () const
 Number of recorded history events.
 
const BRepGraph_HistoryRecordRecord (const size_t theRecordIdx) const
 Access a record by index (0-based).
 
void SetEnabled (const bool theVal)
 Enable or disable history recording.
 
bool IsEnabled () const
 Query whether history recording is enabled.
 
void Clear ()
 Clear all records and lookup maps.
 
void SetAllocator (const occ::handle< NCollection_BaseAllocator > &theAlloc)
 Set the allocator for internal containers. Must be called before any Record/RecordBatch calls.
 

Detailed Description

Extracted history subsystem for BRepGraph.

BRepGraph_History maintains an append-only log of modification events and bidirectional lookup maps (original <-> derived) for efficient history queries. Recording can be toggled on/off at runtime.

Member Function Documentation

◆ Clear()

void BRepGraph_History::Clear ( )

Clear all records and lookup maps.

◆ FindDerived()

NCollection_DynamicArray< BRepGraph_NodeId > BRepGraph_History::FindDerived ( const BRepGraph_NodeId theOriginal) const

Walk forwards from an original node to all derived nodes. Follows the forward map recursively, collecting all leaves.

Parameters
[in]theOriginalnode id to trace forward
Returns
all transitively derived node ids

◆ FindOriginal()

BRepGraph_NodeId BRepGraph_History::FindOriginal ( const BRepGraph_NodeId theModified) const

Walk backwards from a modified node to its original. Follows the reverse map recursively until a root is reached.

Parameters
[in]theModifiednode id to trace back
Returns
the root original node id, or theModified itself if not found

◆ IsEnabled()

bool BRepGraph_History::IsEnabled ( ) const

Query whether history recording is enabled.

Returns
true if recording is active

◆ NbRecords()

size_t BRepGraph_History::NbRecords ( ) const

Number of recorded history events.

Returns
record count

◆ Record() [1/2]

const BRepGraph_HistoryRecord & BRepGraph_History::Record ( const size_t theRecordIdx) const

Access a record by index (0-based).

Parameters
[in]theRecordIdxzero-based index into the records vector
Returns
the history record at the given index

◆ Record() [2/2]

void BRepGraph_History::Record ( const TCollection_AsciiString & theOpLabel,
const BRepGraph_NodeId theOriginal,
const NCollection_DynamicArray< BRepGraph_NodeId > & theReplacements )

Record a modification: theOriginal was replaced by theReplacements.

Parameters
[in]theOpLabelhuman-readable operation name
[in]theOriginalnode id before the operation
[in]theReplacementsnode ids after the operation

◆ RecordBatch()

void BRepGraph_History::RecordBatch ( const TCollection_AsciiString & theOpLabel,
const NCollection_DynamicArray< BRepGraph_NodeId > & theOriginals,
const NCollection_DynamicArray< BRepGraph_NodeId > & theReplacements,
const TCollection_AsciiString & theExtraInfo = TCollection_AsciiString() )

Record a batch of 1-to-1 modifications in a single history event. theOriginals[i] was replaced by theReplacements[i]. More efficient than calling Record() in a loop: creates one HistoryRecord and updates the bidirectional maps with minimal overhead.

Parameters
[in]theOpLabelhuman-readable operation name
[in]theOriginalsnode ids before the operation
[in]theReplacementsnode ids after the operation (same length)
[in]theExtraInfooptional diagnostic info stored on the record

◆ SetAllocator()

void BRepGraph_History::SetAllocator ( const occ::handle< NCollection_BaseAllocator > & theAlloc)

Set the allocator for internal containers. Must be called before any Record/RecordBatch calls.

Parameters
[in]theAllocallocator to use for internal maps

◆ SetEnabled()

void BRepGraph_History::SetEnabled ( const bool theVal)

Enable or disable history recording.

Parameters
[in]theValtrue to enable, false to disable

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