CAD Exchanger SDK
cadex::ModelData_SceneGraphElementUniqueVisitor Class Reference

Defines a visitor that visits each unique element only once. More...

Inheritance diagram for cadex::ModelData_SceneGraphElementUniqueVisitor:
cadex::ModelData_Model::ElementVisitor

Public Member Functions

 ModelData_SceneGraphElementUniqueVisitor (ModelData_Model::ElementVisitor &theRef)
 Constructor. More...
 
virtual void operator() (const ModelData_Part &thePart) override
 
virtual bool VisitEnter (const ModelData_Assembly &theAssembly) override
 Enters an assembly. More...
 
virtual void VisitLeave (const ModelData_Assembly &theAssembly) override
 Leaves an assembly. More...
 
virtual bool VisitEnter (const ModelData_Instance &theInstance) override
 Enters an instance. More...
 
virtual void VisitLeave (const ModelData_Instance &theInstance) override
 Leaves an instance. More...
 

Detailed Description

Defines a visitor that visits each unique element only once.

Children of already visited assemblies or referred element of already visited instances, or already visited parts will never be visited again.

Already visited instances or assemblies will be entered with Ref() visitor VisitEnter() as well as left with VisitLeave().

Uses the associated visitor (Reference()) to really visit an element.

Examples:
meshing/main.cxx.

Constructor & Destructor Documentation

◆ ModelData_SceneGraphElementUniqueVisitor()

cadex::ModelData_SceneGraphElementUniqueVisitor::ModelData_SceneGraphElementUniqueVisitor ( ModelData_Model::ElementVisitor theRef)

Constructor.

theRef is a referred visitor which will be used to visit the elements.

Member Function Documentation

◆ operator()()

void cadex::ModelData_SceneGraphElementUniqueVisitor::operator() ( const ModelData_Part thePart)
overridevirtual

Invokes opeator() for the Ref() visitor if the part has not been already visited.

Implements cadex::ModelData_Model::ElementVisitor.

◆ VisitEnter() [1/2]

bool cadex::ModelData_SceneGraphElementUniqueVisitor::VisitEnter ( const ModelData_Assembly theAssembly)
overridevirtual

Enters an assembly.

Always invokes VisitEnter() for the Ref() visitor but returns true only if the assembly is being visited for the first time and Ref() visitor returned true. Thus children of already visited assembly won't be visited again.

Implements cadex::ModelData_Model::ElementVisitor.

◆ VisitEnter() [2/2]

bool cadex::ModelData_SceneGraphElementUniqueVisitor::VisitEnter ( const ModelData_Instance theInstance)
overridevirtual

Enters an instance.

Always invokes VisitEnter() for the Ref() visitor but returns true only if the instance is being visited for the first time and Ref() visitor returned true. Thus referred element of already visited instance won't be visited again.

Implements cadex::ModelData_Model::ElementVisitor.

◆ VisitLeave() [1/2]

void cadex::ModelData_SceneGraphElementUniqueVisitor::VisitLeave ( const ModelData_Assembly theAssembly)
overridevirtual

Leaves an assembly.

Always invokes VisitLeave() of the Ref() visitor.

Implements cadex::ModelData_Model::ElementVisitor.

◆ VisitLeave() [2/2]

void cadex::ModelData_SceneGraphElementUniqueVisitor::VisitLeave ( const ModelData_Instance theInstance)
overridevirtual

Leaves an instance.

Always invokes VisitLeave() of the Ref() visitor.

Implements cadex::ModelData_Model::ElementVisitor.