LibraryLink Utilities  3.0.1
Modern C++ wrapper over LibraryLink and WSTP
LLU::NodeValueIterator< T > Struct Template Reference

Description

template<typename T>
struct LLU::NodeValueIterator< T >

Simple proxy input iterator that goes over a DataStore and returns node values of requested type when dereferenced.

Template Parameters
T- data node type, see LLU::NodeType namespace for supported node types

Inherits LLU::Detail::DataListIteratorPrimitive.

#include <DataList.hpp>

Public Types

using value_type = T
 This iterator iterates over node values of type T. More...
 
using reference = value_type
 NodeValueIterator is a proxy iterator and so the reference type is the same as value_type. More...
 
using iterator_category = std::input_iterator_tag
 
using pointer = void *
 
using difference_type = mint
 

Public Member Functions

 NodeValueIterator (const NodeIterator< T > &it)
 Create NodeValueIterator pointing to the same node as given NodeIterator<T> More...
 
reference operator* () const
 Get value of the currently pointed to node Generic node values will be converted to T if it is their actual type or an exception will be throws otherwise. More...
 
NodeValueIteratoroperator++ ()
 Pre-increment operator. More...
 
NodeValueIterator operator++ (int)
 Post-increment operator. More...
 
template<typename U >
as () const
 Get current node value if it actually is of type U. More...
 

Public Attributes

GenericDataNode node
 

Type aliases documentation

◆ reference

template<typename T >
using LLU::NodeValueIterator< T >::reference = value_type

NodeValueIterator is a proxy iterator and so the reference type is the same as value_type.

◆ value_type

template<typename T >
using LLU::NodeValueIterator< T >::value_type = T

This iterator iterates over node values of type T.

Constructor & Destructor Documentation

◆ NodeValueIterator()

template<typename T >
LLU::NodeValueIterator< T >::NodeValueIterator ( const NodeIterator< T > &  it)
inlineexplicit

Create NodeValueIterator pointing to the same node as given NodeIterator<T>

Parameters
it- NodeIterator<T> from which a new NodeValueIterator will be created

Member Function Documentation

◆ as()

template<typename T >
template<typename U >
U LLU::NodeValueIterator< T >::as ( ) const
inline

Get current node value if it actually is of type U.

Only makes sense for nodes of type LLU::NodeType::Any.

Template Parameters
U- any type from LLU::NodeType namespace
Returns
current node value of type U

◆ operator*()

template<typename T >
reference LLU::NodeValueIterator< T >::operator* ( ) const
inline

Get value of the currently pointed to node Generic node values will be converted to T if it is their actual type or an exception will be throws otherwise.

Returns
proxy object with the value of the currently pointed to node

◆ operator++() [1/2]

template<typename T >
NodeValueIterator& LLU::NodeValueIterator< T >::operator++ ( )
inline

Pre-increment operator.

Returns
this

◆ operator++() [2/2]

template<typename T >
NodeValueIterator LLU::NodeValueIterator< T >::operator++ ( int  )
inline

Post-increment operator.

Returns
"old" copy of the iterator object