Skip to content

DIWNE::RecursiveNodeIterator

A complex iterator that iterates over all top level nodes as well as any child nodes that individual nodes contain. More...

#include "DIWNE/Core/diwne_iterators.h"

Inherits from DIWNE::RecursiveNodeIteratorImpl< RecursiveNodeIterator< Node >, Node >, DIWNE::ForwardNodeIterator< Iterator, NodeType, false >, DIWNE::ForwardIteratorBase< Iterator, NodeType, IsConst >

Public Types

Name
using typename Super::shared_pointershared_pointer

Protected Types

Name
using RecursiveNodeIteratorImpl< RecursiveNodeIterator, NodeType >Super

Public Functions

Name
RecursiveNodeIterator()
RecursiveNodeIterator(typename Super::Container nodes, std::size_t idx)

Additional inherited members

Protected Types inherited from DIWNE::RecursiveNodeIteratorImpl< RecursiveNodeIterator< Node >, Node >

Name
using NodeIterator<>ChildNodeIterator
using NodeRange<>ChildNodeRange
using bool(*)(const Node *)Predicate

Public Functions inherited from DIWNE::RecursiveNodeIteratorImpl< RecursiveNodeIterator< Node >, Node >

Name
RecursiveNodeIteratorImpl()
RecursiveNodeIteratorImpl(Predicate divePredicate, typename Super::Container nodes, std::size_t idx)
RecursiveNodeIteratorImpl(typename Super::Container nodes, std::size_t idx)
Node *basePtr()<br>Returns the base Node* pointer that isn't casted to the derived NodeType.
referencedereference() const
boolequals(const Iterator & b) const
voidnext()
pointerptr() const
shared_pointersharedPtr() const

Protected Attributes inherited from DIWNE::RecursiveNodeIteratorImpl< RecursiveNodeIterator< Node >, Node >

Name
Predicate_divePredicate <br>Dive predicate, an additional condition required to consider diving inside node's children.
std::stack< ChildNodeIterator, std::vector< ChildNodeIterator > >_stack <br>A stack of child container node iterators, they store their own position at each depth level.

Public Types inherited from DIWNE::ForwardNodeIterator< Iterator, NodeType, false >

Name
using const NodeList *Container

Public Functions inherited from DIWNE::ForwardNodeIterator< Iterator, NodeType, false >

Name
ForwardNodeIterator()
ForwardNodeIterator(Container nodes, std::size_t idx)
referencedereference() const
boolequals(const Iterator & b) const<br>Determines whether this iterator is pointing to the same element as another one (used by the == operator)
voidnext()<br>Advance the iterator.
pointerptr() const
shared_pointersharedPtr() const
boolvalid() const<br>Check whether the iterator is pointing at a valid element (eg. not the end of a container)

Protected Attributes inherited from DIWNE::ForwardNodeIterator< Iterator, NodeType, false >

Name
std::size_t_idx <br>Current node index // TODO: Should probably be an int.
Container_nodes <br>Reference to the node list.

Public Types inherited from DIWNE::ForwardIteratorBase< Iterator, NodeType, IsConst >

Name
using std::ptrdiff_tdifference_type
using std::forward_iterator_tagiterator_category
using typename std::conditional< IsConst, const Value *, Value * >::typepointer
using typename std::conditional< IsConst, const Value &, Value & >::typereference
using typename std::conditional< IsConst, const Value, Value >::typevalue_type

Public Functions inherited from DIWNE::ForwardIteratorBase< Iterator, NodeType, IsConst >

Name
referenceoperator*()
Iterator &operator++()
Iteratoroperator++(int )
pointeroperator->()

Protected Functions inherited from DIWNE::ForwardIteratorBase< Iterator, NodeType, IsConst >

Name
ForwardIteratorBase()
virtual~ForwardIteratorBase() =default
referencedereference() const<br>Return a reference to the current element (reference to a value type, not a pointer).
boolequals(const Iterator & b) const<br>Determines whether this iterator is pointing to the same element as another one (used by the == operator)
voidnext()<br>Advance the iterator.
pointerptr() const<br>Return a raw pointer to the current element.
Iterator *self()<br>CRTP self pointer (pointer to the derived type)
const Iterator *self() const<br>CRTP const self pointer.
std::shared_ptr< Value >sharedPtr() const<br>Return the owning pointer to the current element. Creates a new shared pointer object.
boolvalid() const<br>Check whether the iterator is pointing at a valid element (eg. not the end of a container)

Friends inherited from DIWNE::ForwardIteratorBase< Iterator, NodeType, IsConst >

Name
booloperator!=(const Iterator & a, const Iterator & b)
booloperator==(const Iterator & a, const Iterator & b)

Detailed Description

cpp
template <typename NodeType  =Node>
class DIWNE::RecursiveNodeIterator;
template <typename NodeType  =Node>
class DIWNE::RecursiveNodeIterator;

A complex iterator that iterates over all top level nodes as well as any child nodes that individual nodes contain.

Template Parameters:

  • NodeType The node type returned nodes are casted to. It must be ensured that the passed node list only contains nodes of this subtype. Otherwise an incompatible node type gets downcasted and undefined behavior will occur (static cast is used).

See: RecursiveNodeRange

Child nodes of a node are specified by the INodeContainer::getNodes() method which container nodes must implement. For simplicity this iterator can only go forward and does not provide random access.

Public Types Documentation

using shared_pointer

cpp
using DIWNE::RecursiveNodeIterator< NodeType >::shared_pointer =  typename Super::shared_pointer;
using DIWNE::RecursiveNodeIterator< NodeType >::shared_pointer =  typename Super::shared_pointer;

Protected Types Documentation

using Super

cpp
using DIWNE::RecursiveNodeIterator< NodeType >::Super =  RecursiveNodeIteratorImpl<RecursiveNodeIterator, NodeType>;
using DIWNE::RecursiveNodeIterator< NodeType >::Super =  RecursiveNodeIteratorImpl<RecursiveNodeIterator, NodeType>;

Public Functions Documentation

function RecursiveNodeIterator

cpp
inline RecursiveNodeIterator()
inline RecursiveNodeIterator()

function RecursiveNodeIterator

cpp
inline RecursiveNodeIterator(
    typename Super::Container nodes,
    std::size_t idx
)
inline RecursiveNodeIterator(
    typename Super::Container nodes,
    std::size_t idx
)

Updated on 2025-05-31 at 12:55:31 +0000