Open CASCADE Technology 7.8.0
Static Public Member Functions
XCAFDoc_AssemblyTool Class Reference

Provides generic methods for traversing assembly tree and graph. More...

#include <XCAFDoc_AssemblyTool.hxx>

Static Public Member Functions

template<typename Func >
static void Traverse (XCAFDoc_AssemblyIterator theIterator, Func theFunc)
 Generic method for traversing assembly tree. Performs in-depth traversing of the assembly tree and calls user defined function for each assembly tree node. User function takes single argument of XCAFDoc_AssemblyItemId type and returns true/false to continue/break.
 
template<typename Func , typename Filter >
static void Traverse (const Handle< XCAFDoc_AssemblyGraph > &theGraph, Filter theFilter, Func theFunc, const Standard_Integer theNode=1)
 Generic method for traversing assembly graph. Performs in-depth traversing of the assembly graph beginning from root nodes and calls user defined function for each assembly graph node accepted by the user defined filtering function. Filtering function takes the assembly graph passed for traversing, current graph node ID and returns true/false to accept/reject node.
 

Detailed Description

Provides generic methods for traversing assembly tree and graph.

Member Function Documentation

◆ Traverse() [1/2]

template<typename Func , typename Filter >
static void XCAFDoc_AssemblyTool::Traverse ( const Handle< XCAFDoc_AssemblyGraph > &  theGraph,
Filter  theFilter,
Func  theFunc,
const Standard_Integer  theNode = 1 
)
inlinestatic

Generic method for traversing assembly graph. Performs in-depth traversing of the assembly graph beginning from root nodes and calls user defined function for each assembly graph node accepted by the user defined filtering function. Filtering function takes the assembly graph passed for traversing, current graph node ID and returns true/false to accept/reject node.

const Standard_Integer theNode)
{
return (theGraph->GetNodeType(theNode) == XCAFDoc_AssemblyGraph::NodeType_Part);
}
#define Handle(Class)
Define Handle() macro.
Definition Standard_Handle.hxx:399
Definition NCollection_UBTree.hxx:64
Definition XCAFDoc_AssemblyGraph.hxx:35
NodeType GetNodeType(const Standard_Integer theNode) const
Returns the node type from NodeType enum.
@ NodeType_Part
Leaf node to represent parts.
Definition XCAFDoc_AssemblyGraph.hxx:45

User function theFunc takes the assembly graph passed for traversing, current graph node ID and returns true/false to continue/break.

Parameters
[in]theGraph- assembly graph.
[in]theFilter- user filtering function called for each assembly graph node.
[in]theFunc- user function called for accepted assembly graph node.
[in]theNode- starting positive one-based graph node ID.

◆ Traverse() [2/2]

template<typename Func >
static void XCAFDoc_AssemblyTool::Traverse ( XCAFDoc_AssemblyIterator  theIterator,
Func  theFunc 
)
inlinestatic

Generic method for traversing assembly tree. Performs in-depth traversing of the assembly tree and calls user defined function for each assembly tree node. User function takes single argument of XCAFDoc_AssemblyItemId type and returns true/false to continue/break.

{
std::cout << theItem.ToString() << std::endl;
return Standard_True;
}
#define Standard_True
Definition Standard_TypeDef.hxx:57
Unique item identifier in the hierarchical product structure. A full path to an assembly component in...
Definition XCAFDoc_AssemblyItemId.hxx:26
TCollection_AsciiString ToString() const
Returns the full pass as a formatted string.
Parameters
[in]theIterator- starting position in the assembly tree.
[in]theFunc- user function called for each assembly tree node.

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