GNodeIterator< NODE > Class Template Reference

#include <nodesystem.h>

Inheritance diagram for GNodeIterator< NODE >:

Detailed Description

template<typename NODE>
class maxon::nodes::GNodeIterator< NODE >

A GNodeIterator iterates over all children of a g-node. It is returned by NodeFunctions::GetChildren and PortListFunctions::GetPorts. Because both creation and iterator advance can return errors, the iteration doesn't provide the node of the current iteration directly, but wrapped in a Result. Therefore you have to write the loop as follows:

for (auto p : portlist.GetPorts())
{
const Port& port = p iferr_return;
...
}
unsigned char * p
Definition: floatobject.h:87
#define iferr_return
Definition: resultbase.h:1519
Template Parameters
NODEThe node class over which the iterator loops (e.g. Node or MutablePort).

Public Member Functions

 GNodeIterator ()=default
 
Result< void > operator++ ()
 
const NODE & operator* () const
 
const NODE * operator-> () const
 
- Public Member Functions inherited from GNodeIteratorBase
Result< void > Init (const NodeSystemInterface *nodeSystem, const GNodeHandle &node)
 
Result< void > Init (const NodeSystemInterface *nodeSystem, Result< GNodeHandle > &&node)
 
Result< void > Init (const NodeSystemInterface *nodeSystem, Result< const GNodeHandle & > &&node)
 
Result< void > MoveToNext ()
 
Bool HasEntry () const
 
 operator Bool () const
 
const GNodeHandleGetHandle () const
 
const MutableGNodeGetNode () const
 

Private Types

template<typename SUPER >
using ResultFunctions = ResultIteratorFunctions< SUPER >
 

Private Member Functions

Result< void > Init (const NodeSystemInterface *nodeSystem, const GNodeHandle &node)
 
Result< void > Filter ()
 

Additional Inherited Members

- Protected Attributes inherited from GNodeIteratorBase
const NodeSystemInterface_nodeSystem
 
NodePath _nodePath
 
const GNodeData * _nodeData
 
const GNodeData * _baseData
 
Int _childIndex
 
MutableGNode _child
 

Member Typedef Documentation

◆ ResultFunctions

using ResultFunctions = ResultIteratorFunctions<SUPER>
private

Constructor & Destructor Documentation

◆ GNodeIterator()

GNodeIterator ( )
default

Constructs a @CLASS object with default values.

Member Function Documentation

◆ operator++()

Result<void> operator++ ( )

Advances this iterator to the next child node.

Returns
OK on success, or an error. Advancing to the position one behind the last child is no error.

◆ operator*()

const NODE& operator* ( ) const

Returns the current child node. This function must not be called when this iterator doesn't point to a valid child node.

Returns
The current child node.

◆ operator->()

const NODE* operator-> ( ) const

Returns the current child node. This function must not be called when this iterator doesn't point to a valid child node.

Returns
The current child node.

◆ Init()

Result<void> Init ( const NodeSystemInterface nodeSystem,
const GNodeHandle node 
)
private

◆ Filter()

Result<void> Filter ( )
private