Inviwo 0.9.12-pre
Inviwo documentation
Loading...
Searching...
No Matches
inviwo::LambdaNetworkVisitor< Funcs > Struct Template Reference

A Helper class to construct a NetworkVisitor from a set of lambda functions. More...

#include <lambdanetworkvisitor.h>

+ Inheritance diagram for inviwo::LambdaNetworkVisitor< Funcs >:

Public Types

template<typename T >
using ProcessorOverload = decltype(std::declval<T>()(std::declval<Processor&>()))
 
template<typename T >
using ProcessorEnter
 
template<typename T >
using ProcessorExit
 
template<typename T >
using CompositeOverload = decltype(std::declval<T>()(std::declval<CompositeProperty&>()))
 
template<typename T >
using CompositeEnter
 
template<typename T >
using CompositeExit
 
template<typename T >
using PropertyOverload = decltype(std::declval<T>()(std::declval<Property&>()))
 

Public Member Functions

 LambdaNetworkVisitor (Funcs &&... args)
 
virtual bool enter (Processor &processor) override
 Visit a Processor Adding or removing processors while visiting is not supported Called before visiting children.
 
virtual void exit (Processor &processor) override
 Visit a Processor Adding and removing processors while visiting are not supported Called after visiting children.
 
virtual bool enter (CompositeProperty &compositeProperty) override
 Visit a CompositeProperty Adding or removing properties while visiting is not supported Called before visiting children.
 
virtual void exit (CompositeProperty &compositeProperty) override
 Visit a CompositeProperty Adding and removing properties while visiting are not supported Called after visiting children.
 
virtual void visit (Property &property) override
 Visit a Property Adding and removing properties while visiting are not supported.
 
- Public Member Functions inherited from inviwo::NetworkVisitor

Static Public Attributes

template<typename T >
static constexpr auto isOverloadCalled
 

Detailed Description

template<typename... Funcs>
struct inviwo::LambdaNetworkVisitor< Funcs >

A Helper class to construct a NetworkVisitor from a set of lambda functions.

A number of different overloads can be given. Processors will be visited before children in order of priority:

Processors will be visited after children:

CompositeProperties will be visited before children in order of priority:

CompositeProperties will be visited after children:

Properties will be visited by:

LambdaNetworkVisitor visitor{[](Property& property) {
// Do something for all properties
return true; // visit all children
},
// Do something for a processor before properties
return true; // Visit children
},
[](Processor&, NetworkVisitorExit) {
// Do something for a processor after properties
}};
processorNetwork->accept(visitor);
Definition lambdanetworkvisitor.h:43
A processor generally performs operation on input data and outputs the new result.
Definition processor.h:170
A Property represents a parameter to a processor.
Definition property.h:131
A Helper class to construct a NetworkVisitor from a set of lambda functions.
Definition lambdanetworkvisitor.h:89

Member Typedef Documentation

◆ CompositeEnter

template<typename... Funcs>
template<typename T >
using inviwo::LambdaNetworkVisitor< Funcs >::CompositeEnter
Initial value:
decltype(std::declval<T>()(std::declval<CompositeProperty&>(),
std::declval<NetworkVisitorEnter>()))

◆ CompositeExit

template<typename... Funcs>
template<typename T >
using inviwo::LambdaNetworkVisitor< Funcs >::CompositeExit
Initial value:
decltype(std::declval<T>()(std::declval<CompositeProperty&>(),
std::declval<NetworkVisitorExit>()))

◆ ProcessorEnter

template<typename... Funcs>
template<typename T >
using inviwo::LambdaNetworkVisitor< Funcs >::ProcessorEnter
Initial value:
decltype(std::declval<T>()(std::declval<Processor&>(),
std::declval<NetworkVisitorEnter>()))

◆ ProcessorExit

template<typename... Funcs>
template<typename T >
using inviwo::LambdaNetworkVisitor< Funcs >::ProcessorExit
Initial value:
decltype(std::declval<T>()(std::declval<Processor&>(), std::declval<NetworkVisitorExit>()))

Member Function Documentation

◆ enter() [1/2]

template<typename... Funcs>
virtual bool inviwo::LambdaNetworkVisitor< Funcs >::enter ( CompositeProperty & )
inlineoverridevirtual

Visit a CompositeProperty Adding or removing properties while visiting is not supported Called before visiting children.

Returns
visit all child properties if true else go to next CompositeProperty

Reimplemented from inviwo::NetworkVisitor.

◆ enter() [2/2]

template<typename... Funcs>
virtual bool inviwo::LambdaNetworkVisitor< Funcs >::enter ( Processor & )
inlineoverridevirtual

Visit a Processor Adding or removing processors while visiting is not supported Called before visiting children.

Returns
visit all child properties if true else go to next processor

Reimplemented from inviwo::NetworkVisitor.

◆ exit() [1/2]

template<typename... Funcs>
virtual void inviwo::LambdaNetworkVisitor< Funcs >::exit ( CompositeProperty & )
inlineoverridevirtual

Visit a CompositeProperty Adding and removing properties while visiting are not supported Called after visiting children.

Reimplemented from inviwo::NetworkVisitor.

◆ exit() [2/2]

template<typename... Funcs>
virtual void inviwo::LambdaNetworkVisitor< Funcs >::exit ( Processor & )
inlineoverridevirtual

Visit a Processor Adding and removing processors while visiting are not supported Called after visiting children.

Reimplemented from inviwo::NetworkVisitor.

◆ visit()

template<typename... Funcs>
virtual void inviwo::LambdaNetworkVisitor< Funcs >::visit ( Property & )
inlineoverridevirtual

Visit a Property Adding and removing properties while visiting are not supported.

Reimplemented from inviwo::NetworkVisitor.

Member Data Documentation

◆ isOverloadCalled

template<typename... Funcs>
template<typename T >
auto inviwo::LambdaNetworkVisitor< Funcs >::isOverloadCalled
staticconstexpr
Initial value:
=
util::is_detected_v<ProcessorOverload, T> || util::is_detected_v<ProcessorEnter, T> ||
util::is_detected_v<ProcessorExit, T> || util::is_detected_v<CompositeOverload, T> ||
util::is_detected_v<CompositeEnter, T> || util::is_detected_v<CompositeExit, T> ||
util::is_detected_v<PropertyOverload, T>

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