Skip to content

DIWNE::FilteredNodeIteratorImpl

Node iterator that returns only nodes that pass a specified condition. More...

#include "DIWNE/Core/diwne_iterators.h"

Inherits from DIWNE::BidirectionalNodeIterator< Iterator, NodeType, IsConst >, DIWNE::ForwardNodeIterator< Iterator, NodeType, IsConst >, DIWNE::ForwardIteratorBase< Iterator, NodeType, IsConst >

Inherited by DIWNE::FilteredNodeIterator< NodeType >

Public Types

Name
using typename Super::shared_pointershared_pointer

Protected Types

Name
using bool(*)(const Node *)Predicate
using BidirectionalNodeIterator< Iterator, NodeType, IsConst >Super

Public Functions

Name
FilteredNodeIteratorImpl()
FilteredNodeIteratorImpl(Predicate predicate, typename Super::Container nodes, std::size_t idx)
virtual voidback()<br>Move the iterator to the previous position.
voidnext()
boolvalid() const

Protected Attributes

Name
Predicate_predicate

Additional inherited members

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

Name
using std::bidirectional_iterator_tagiterator_category

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

Name
BidirectionalNodeIterator()
BidirectionalNodeIterator(Super::Container nodes, std::size_t idx)
Iterator &operator--()
Iteratoroperator--(int )

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

Name
using const NodeList *Container

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

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)
pointerptr() const
shared_pointersharedPtr() const

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

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)
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.

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 Iterator ,
typename NodeType ,
bool IsConst>
class DIWNE::FilteredNodeIteratorImpl;
template <typename Iterator ,
typename NodeType ,
bool IsConst>
class DIWNE::FilteredNodeIteratorImpl;

Node iterator that returns only nodes that pass a specified condition.

Template Parameters:

  • Iterator Type returned by begin()/end() (the CRTP derived iterator)

See: NodeIterator, FilteredRecursiveNodeIterator

Unlike the regular NodeIterator, it does not have random access, but it can move forwards and backwards.

Public Types Documentation

using shared_pointer

cpp
using DIWNE::FilteredNodeIteratorImpl< Iterator, NodeType, IsConst >::shared_pointer =  typename Super::shared_pointer;
using DIWNE::FilteredNodeIteratorImpl< Iterator, NodeType, IsConst >::shared_pointer =  typename Super::shared_pointer;

Protected Types Documentation

using Predicate

cpp
using DIWNE::FilteredNodeIteratorImpl< Iterator, NodeType, IsConst >::Predicate =  bool (*)(const Node*);
using DIWNE::FilteredNodeIteratorImpl< Iterator, NodeType, IsConst >::Predicate =  bool (*)(const Node*);

using Super

cpp
using DIWNE::FilteredNodeIteratorImpl< Iterator, NodeType, IsConst >::Super =  BidirectionalNodeIterator<Iterator, NodeType, IsConst>;
using DIWNE::FilteredNodeIteratorImpl< Iterator, NodeType, IsConst >::Super =  BidirectionalNodeIterator<Iterator, NodeType, IsConst>;

Public Functions Documentation

function FilteredNodeIteratorImpl

cpp
inline FilteredNodeIteratorImpl()
inline FilteredNodeIteratorImpl()

function FilteredNodeIteratorImpl

cpp
inline FilteredNodeIteratorImpl(
    Predicate predicate,
    typename Super::Container nodes,
    std::size_t idx
)
inline FilteredNodeIteratorImpl(
    Predicate predicate,
    typename Super::Container nodes,
    std::size_t idx
)

function back

cpp
inline virtual void back()
inline virtual void back()

Move the iterator to the previous position.

Reimplements: DIWNE::BidirectionalNodeIterator::back

function next

cpp
inline void next()
inline void next()

function valid

cpp
inline bool valid() const
inline bool valid() const

Protected Attributes Documentation

variable _predicate

cpp
Predicate _predicate {nullptr};
Predicate _predicate {nullptr};

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