Open CASCADE Technology Reference Manual 8.0.0
Loading...
Searching...
No Matches
Data Structures | Public Types | Public Member Functions
BRepGraph_ParentExplorer Class Reference

Upward occurrence-aware parent traversal for BRepGraph. More...

#include <BRepGraph_ParentExplorer.hxx>

Data Structures

struct  Config
 Consolidated configuration for the explorer. More...
 

Public Types

enum class  LinkKind { None , Reference , Structural }
 Relationship kind between Current() and CurrentChild(). More...
 
enum class  TraversalMode { Recursive , DirectParents }
 Upward traversal strategy. More...
 

Public Member Functions

 BRepGraph_ParentExplorer (const BRepGraph &theGraph, const BRepGraph_NodeId theNode, const Config &theConfig)
 Preferred long-term constructor: all tuning knobs in Config.
 
 BRepGraph_ParentExplorer (const BRepGraph &theGraph, const BRepGraph_NodeId theNode)
 Explore all parents of the starting node.
 
 BRepGraph_ParentExplorer (const BRepGraph &theGraph, const BRepGraph_NodeId theNode, TraversalMode theMode)
 Explore parents of the starting node using the given traversal mode.
 
 BRepGraph_ParentExplorer (const BRepGraph &theGraph, const BRepGraph_NodeId theNode, const std::optional< BRepGraph_NodeId::Kind > &theAvoidKind, bool theEmitAvoidKind, TraversalMode theMode=TraversalMode::Recursive)
 Explore all parents while pruning branches at the avoid kind.
 
 BRepGraph_ParentExplorer (const BRepGraph &theGraph, const BRepGraph_NodeId theNode, BRepGraph_NodeId::Kind theTargetKind)
 Explore only parents of the given kind.
 
 BRepGraph_ParentExplorer (const BRepGraph &theGraph, const BRepGraph_NodeId theNode, BRepGraph_NodeId::Kind theTargetKind, TraversalMode theMode)
 Explore only parents of the given kind using the given traversal mode.
 
 BRepGraph_ParentExplorer (const BRepGraph &theGraph, const BRepGraph_NodeId theNode, BRepGraph_NodeId::Kind theTargetKind, const std::optional< BRepGraph_NodeId::Kind > &theAvoidKind, bool theEmitAvoidKind, TraversalMode theMode=TraversalMode::Recursive)
 Explore parents of the given kind while pruning branches at the avoid kind.
 
const ConfigGetConfig () const
 Returns the traversal configuration this explorer was constructed with. Read-only - configuration is fixed for the lifetime of the explorer.
 
bool More () const
 True if another matching parent is available.
 
void Next ()
 Advance to the next matching parent.
 
BRepGraphInc::NodeInstance Current () const
 Current matching ancestor node with accumulated location and orientation.
 
BRepGraph_NodeId CurrentChild () const
 Returns the immediate child of Current() on the currently emitted branch. Returns invalid NodeId when no current ancestor is available.
 
LinkKind CurrentLinkKind () const
 Returns how Current() is linked to CurrentChild().
 
BRepGraph_RefId CurrentRef () const
 Returns the exact parent-owned RefId linking Current() to CurrentChild(), when that branch step is represented by a reference entry.
 
const TopLoc_LocationLeafLocation () const
 Accumulated location at the starting node of the current branch.
 
TopAbs_Orientation LeafOrientation () const
 Accumulated orientation at the starting node of the current branch.
 
bool IsCurrentBranchRoot () const
 True if Current() is the explicit root node of the current branch.
 
NCollection_ForwardRangeIterator< BRepGraph_ParentExplorerbegin ()
 Returns an STL-compatible iterator for range-based for loops.
 
NCollection_ForwardRangeSentinel end () const
 Returns a sentinel marking the end of iteration.
 

Detailed Description

Upward occurrence-aware parent traversal for BRepGraph.

See also
BRepGraph class comment "Iterator guide" for choosing between iterator types.

Enumerates all ancestor nodes reachable from a starting node. Traversal is path-aware: when the same definition is reached through multiple occurrence paths, each path contributes its own parent sequence with its own accumulated location and orientation.

The traversal follows the actual graph structure transparently - every node kind is visited as a distinct entity (no hidden collapses): Vertex -> Edge, Edge -> CoEdge, CoEdge -> Wire, Wire -> Face, Face -> Shell, Shell -> Solid, Solid -> CompSolid/Compound, Product -> Occurrence, Occurrence -> Product (parent assembly).

Traversal modes

Member Enumeration Documentation

◆ LinkKind

Relationship kind between Current() and CurrentChild().

Enumerator
None 

No current branch step.

Reference 

Current() owns CurrentChild() through a RefId.

Structural 

Current() reaches CurrentChild() through a structural non-ref link.

◆ TraversalMode

Upward traversal strategy.

Enumerator
Recursive 

Walk the full ancestor chain to the graph roots.

DirectParents 

Yields only the immediate parents of the starting node.

Constructor & Destructor Documentation

◆ BRepGraph_ParentExplorer() [1/7]

BRepGraph_ParentExplorer::BRepGraph_ParentExplorer ( const BRepGraph & theGraph,
const BRepGraph_NodeId theNode,
const Config & theConfig )

Preferred long-term constructor: all tuning knobs in Config.

Parameters
[in]theGraphgraph to walk
[in]theNodestarting node whose ancestors are explored
[in]theConfigtraversal configuration

◆ BRepGraph_ParentExplorer() [2/7]

BRepGraph_ParentExplorer::BRepGraph_ParentExplorer ( const BRepGraph & theGraph,
const BRepGraph_NodeId theNode )

Explore all parents of the starting node.

◆ BRepGraph_ParentExplorer() [3/7]

BRepGraph_ParentExplorer::BRepGraph_ParentExplorer ( const BRepGraph & theGraph,
const BRepGraph_NodeId theNode,
TraversalMode theMode )

Explore parents of the starting node using the given traversal mode.

◆ BRepGraph_ParentExplorer() [4/7]

BRepGraph_ParentExplorer::BRepGraph_ParentExplorer ( const BRepGraph & theGraph,
const BRepGraph_NodeId theNode,
const std::optional< BRepGraph_NodeId::Kind > & theAvoidKind,
bool theEmitAvoidKind,
TraversalMode theMode = TraversalMode::Recursive )

Explore all parents while pruning branches at the avoid kind.

◆ BRepGraph_ParentExplorer() [5/7]

BRepGraph_ParentExplorer::BRepGraph_ParentExplorer ( const BRepGraph & theGraph,
const BRepGraph_NodeId theNode,
BRepGraph_NodeId::Kind theTargetKind )

Explore only parents of the given kind.

◆ BRepGraph_ParentExplorer() [6/7]

BRepGraph_ParentExplorer::BRepGraph_ParentExplorer ( const BRepGraph & theGraph,
const BRepGraph_NodeId theNode,
BRepGraph_NodeId::Kind theTargetKind,
TraversalMode theMode )

Explore only parents of the given kind using the given traversal mode.

◆ BRepGraph_ParentExplorer() [7/7]

BRepGraph_ParentExplorer::BRepGraph_ParentExplorer ( const BRepGraph & theGraph,
const BRepGraph_NodeId theNode,
BRepGraph_NodeId::Kind theTargetKind,
const std::optional< BRepGraph_NodeId::Kind > & theAvoidKind,
bool theEmitAvoidKind,
TraversalMode theMode = TraversalMode::Recursive )

Explore parents of the given kind while pruning branches at the avoid kind.

Member Function Documentation

◆ begin()

NCollection_ForwardRangeIterator< BRepGraph_ParentExplorer > BRepGraph_ParentExplorer::begin ( )
inline

Returns an STL-compatible iterator for range-based for loops.

◆ Current()

BRepGraphInc::NodeInstance BRepGraph_ParentExplorer::Current ( ) const
inline

Current matching ancestor node with accumulated location and orientation.

◆ CurrentChild()

BRepGraph_NodeId BRepGraph_ParentExplorer::CurrentChild ( ) const

Returns the immediate child of Current() on the currently emitted branch. Returns invalid NodeId when no current ancestor is available.

◆ CurrentLinkKind()

LinkKind BRepGraph_ParentExplorer::CurrentLinkKind ( ) const

Returns how Current() is linked to CurrentChild().

◆ CurrentRef()

BRepGraph_RefId BRepGraph_ParentExplorer::CurrentRef ( ) const

Returns the exact parent-owned RefId linking Current() to CurrentChild(), when that branch step is represented by a reference entry.

Some upward steps are structural and therefore have no parent-owned ref entry even though the parent itself is still emitted by the explorer. In those cases this method returns an invalid RefId, for example for CoEdge->Edge, Product(part)->ShapeRoot and Occurrence->Product.

◆ end()

NCollection_ForwardRangeSentinel BRepGraph_ParentExplorer::end ( ) const
inline

Returns a sentinel marking the end of iteration.

◆ GetConfig()

const Config & BRepGraph_ParentExplorer::GetConfig ( ) const
inline

Returns the traversal configuration this explorer was constructed with. Read-only - configuration is fixed for the lifetime of the explorer.

◆ IsCurrentBranchRoot()

bool BRepGraph_ParentExplorer::IsCurrentBranchRoot ( ) const

True if Current() is the explicit root node of the current branch.

◆ LeafLocation()

const TopLoc_Location & BRepGraph_ParentExplorer::LeafLocation ( ) const

Accumulated location at the starting node of the current branch.

◆ LeafOrientation()

TopAbs_Orientation BRepGraph_ParentExplorer::LeafOrientation ( ) const

Accumulated orientation at the starting node of the current branch.

◆ More()

bool BRepGraph_ParentExplorer::More ( ) const
inline

True if another matching parent is available.

◆ Next()

void BRepGraph_ParentExplorer::Next ( )

Advance to the next matching parent.


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