entttree 0.1.0
Hierarchical entity management for EnTT
Loading...
Searching...
No Matches
entttree::Traversal< Node_, Successors_ > Struct Template Reference

A lazy description of a rooted graph traversal. More...

#include <traverse.h>

Public Types

using Node = Node_
 
using Successors = Successors_
 

Public Member Functions

Traversal && enable (bool enable) &&
 Conditionally disable the traversal.
 
Traversalenable (bool enable) &
 Conditionally disable the traversal.
 

Public Attributes

std::optional< Noderoot
 The starting point of the traversal, or empty to disable it.
 
Successors successors
 A function returning a generator of the successors of a node.
 

Detailed Description

template<typename Node_, typename Successors_>
struct entttree::Traversal< Node_, Successors_ >

A lazy description of a rooted graph traversal.

By keeping information about the structure of the tree (rather than a flat generator), we can more easily implement transformations and filters on the traversal. See the walk namespace for adaptors and walkers.

Template Parameters
Node_The type of each node in the traversal.
Successors_A callable (Node&) -> Generator<Node> that yields the children of a given node.

Definition at line 44 of file traverse.h.

Member Typedef Documentation

◆ Node

Definition at line 45 of file traverse.h.

◆ Successors

Definition at line 46 of file traverse.h.

Member Function Documentation

◆ enable() [1/2]

Traversal & entttree::Traversal< Node_, Successors_ >::enable ( bool  enable) &
inline

Conditionally disable the traversal.

If enable is false, the root is cleared, causing the traversal to produce no nodes. An already-disabled traversal remains disabled.

Definition at line 73 of file traverse.h.

References entttree::Traversal< Node_, Successors_ >::enable(), and entttree::Traversal< Node_, Successors_ >::root.

◆ enable() [2/2]

Traversal && entttree::Traversal< Node_, Successors_ >::enable ( bool  enable) &&
inline

Conditionally disable the traversal.

If enable is false, the root is cleared, causing the traversal to produce no nodes. An already-disabled traversal remains disabled.

Definition at line 67 of file traverse.h.

References entttree::Traversal< Node_, Successors_ >::enable(), and entttree::Traversal< Node_, Successors_ >::root.

Referenced by entttree::Traversal< Node_, Successors_ >::enable(), and entttree::Traversal< Node_, Successors_ >::enable().

Member Data Documentation

◆ root

The starting point of the traversal, or empty to disable it.

Definition at line 49 of file traverse.h.

Referenced by entttree::Traversal< Node_, Successors_ >::enable(), and entttree::Traversal< Node_, Successors_ >::enable().

◆ successors

A function returning a generator of the successors of a node.

Signature: Successors(Node&) -> GeneratorConcept<Node>

Any references within the values yielded by the generator must remain valid at least until the generator is destroyed.

Definition at line 59 of file traverse.h.


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