SPARK  0.1.0
A general purpose game engine written in C++.
Loading...
Searching...
No Matches
spark::patterns::details::TreeTraverserCaller< NodeType, FnArgsTypes > Class Template Reference

A generic tree traverser caller that can be used to traverse any Composite. More...

#include <Traverser.h>

Static Public Member Functions

template<typename Traverser >
static void exec (NodeType *container, Traverser &traverser, FnArgsTypes &&... args)
 Traverses the given tree using the given traverser.
 

Detailed Description

template<typename NodeType, typename... FnArgsTypes>
class spark::patterns::details::TreeTraverserCaller< NodeType, FnArgsTypes >

A generic tree traverser caller that can be used to traverse any Composite.

This traverser operates on a Composite data structure by recursively traversing its elements and performing designated operations. To use this, you need to provide a Traverser implementation that defines the pre/post/apply functions.

The apply function is called on every element of the tree except the root, while the pre/post functions are called only on the elements that can have children.

Template Parameters
NodeTypeType of the nodes of the tree.
FnArgsTypesThe types of arguments that will be passed to the pre/post/apply functions.

Member Function Documentation

◆ exec()

template<typename NodeType , typename... FnArgsTypes>
template<typename Traverser >
static void spark::patterns::details::TreeTraverserCaller< NodeType, FnArgsTypes >::exec ( NodeType * container,
Traverser & traverser,
FnArgsTypes &&... args )
inlinestatic

Traverses the given tree using the given traverser.

Parameters
containerThe tree to visit.
traverserThe traverser implementation with the pre/post/apply functions.
argsThe arguments to pass to the pre/post/apply functions.