Open CASCADE Technology Reference Manual 8.0.0
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions
BRepGraph_UID Struct Reference

Unique node identifier within a BRepGraph. More...

#include <BRepGraph_UID.hxx>

Public Member Functions

 BRepGraph_UID ()
 Default: invalid UID (counter = 0 is the invalid sentinel).
 
 BRepGraph_UID (const BRepGraph_NodeId::Kind theKind, const size_t theCounter, const uint32_t theGeneration)
 Construct a valid UID. Called internally by BRepGraph::allocateUID().
 
bool IsValid () const
 
BRepGraph_NodeId::Kind Kind () const
 
size_t Counter () const
 
uint32_t Generation () const
 
bool IsTopology () const
 
bool IsAssembly () const
 
bool operator== (const BRepGraph_UID &theOther) const
 Equality: Identity = (Kind, Counter). Generation excluded. Two invalid UIDs are equal.
 
bool operator!= (const BRepGraph_UID &theOther) const
 
bool operator< (const BRepGraph_UID &theOther) const
 
size_t HashValue () const
 Hash value: f(Kind, Counter).
 

Static Public Member Functions

static BRepGraph_UID Invalid ()
 Factory: returns an explicitly invalid UID.
 

Detailed Description

Unique node identifier within a BRepGraph.

Identity = (Kind, Counter). Two nodes of different kinds may share a counter value but their UIDs are distinct. Within one kind, counter values never repeat (monotonic, never resets).

Generation is NOT part of identity; it indicates which BRepGraph::Clear() cycle produced this UID (for stale-reference detection).

Trivially copyable, cheap to pass by value.

Serialization Contract

Entity UIDs (BRepGraph_UID) and reference UIDs (BRepGraph_RefUID) share a single monotonic counter (BRepGraph_Data::myNextUIDCounter). To persist a BRepGraph across sessions:

  1. Write: for each entity, serialize (Kind, Counter, OwnGen).
  2. Read: reconstruct entities, populate UID vectors with deserialized (Kind, Counter) values, set myNextUIDCounter to max(all_entity_counters, all_ref_counters) + 1.
  3. myGeneration resets to 0 on load (session-scoped).
  4. VersionStamps from a previous session will correctly detect staleness via Generation mismatch.

Constructor & Destructor Documentation

◆ BRepGraph_UID() [1/2]

BRepGraph_UID::BRepGraph_UID ( )
inline

Default: invalid UID (counter = 0 is the invalid sentinel).

◆ BRepGraph_UID() [2/2]

BRepGraph_UID::BRepGraph_UID ( const BRepGraph_NodeId::Kind theKind,
const size_t theCounter,
const uint32_t theGeneration )
inline

Construct a valid UID. Called internally by BRepGraph::allocateUID().

Precondition
theCounter > 0 (counter = 0 is reserved as the invalid sentinel)

Member Function Documentation

◆ Counter()

size_t BRepGraph_UID::Counter ( ) const
inline

◆ Generation()

uint32_t BRepGraph_UID::Generation ( ) const
inline

◆ HashValue()

size_t BRepGraph_UID::HashValue ( ) const
inline

Hash value: f(Kind, Counter).

◆ Invalid()

static BRepGraph_UID BRepGraph_UID::Invalid ( )
inlinestatic

Factory: returns an explicitly invalid UID.

◆ IsAssembly()

bool BRepGraph_UID::IsAssembly ( ) const
inline

◆ IsTopology()

bool BRepGraph_UID::IsTopology ( ) const
inline

◆ IsValid()

bool BRepGraph_UID::IsValid ( ) const
inline

◆ Kind()

BRepGraph_NodeId::Kind BRepGraph_UID::Kind ( ) const
inline

◆ operator!=()

bool BRepGraph_UID::operator!= ( const BRepGraph_UID & theOther) const
inline

◆ operator<()

bool BRepGraph_UID::operator< ( const BRepGraph_UID & theOther) const
inline

◆ operator==()

bool BRepGraph_UID::operator== ( const BRepGraph_UID & theOther) const
inline

Equality: Identity = (Kind, Counter). Generation excluded. Two invalid UIDs are equal.


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