Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
FeedPrototype< FUN, PAM > Class Template Reference

#include "steam/engine/feed-manifold.hpp"

Description

template<class FUN, class PAM>
class steam::engine::FeedPrototype< FUN, PAM >

Builder-Prototype to create FeedManifold instances.

This »Prototype« becomes part of the Turnout / WeavingPattern and holds processing- and parameter-functor instances as configuration. The Processing-Functor will be copied into the actual FeedManifold instance for each Node invocation.

Template Parameters
FUNtype of the data processing-functor
PAMtype of an optional parameter-setup functor (defaults to deactivated)

Usage

The Prototype is typically first built solely from a processing-functor. It can even be constructed as type only, by FeedManifold<FUN>::Prototype. In this form, any parameter handling will be disabled. However, by adding a parameter-functor with the cross-builder-API, a new instance of the prototype is created as a replacement of the old one (note: we move the processing functor). This adds a parameter-functor to the configuration, which will then be invoked whenever a new FeedManifold instance is created; the result of this parameter-functor invocation should be a parameter value, which can be passed into the constructor of FeedManifold, together with a copy of the proc-functor.

See also
NodeBase_test::verify_FeedPrototype()

Definition at line 548 of file feed-manifold.hpp.

Public Types

enum  {
  FAN_I = Feed::FAN_I ,
  FAN_O = Feed::FAN_O ,
  FAN_P = Feed::FAN_P
}
 
using Feed = FeedManifold< FUN >
 
using ElmsI = _Proc::ElmsI
 
using ElmsO = _Proc::ElmsO
 
using ElmsP = conditional_t< _Trait::hasParam(), typename _Proc::ArgP, Types<> >
 
using Param = _Proc::SigP
 
template<template< class > class META>
using OutTypesApply = ElmsO::template Apply< META >
 
using ProcFun = FUN
 
using ParamFun = PAM
 
template<typename PFX >
using Adapted = FeedPrototype< FUN, PFX >
 
template<typename TRA >
using DecoratedProcFun = decltype(std::declval< FeedPrototype >().decorateProcParam(std::declval< TRA >()))
 
template<typename TRA >
using Decorated = FeedPrototype< DecoratedProcFun< TRA >, PAM >
 

Static Public Member Functions

static constexpr bool hasParam ()
 
static constexpr bool hasParamFun ()
 
static constexpr bool canActivate ()
 
template<typename PFX >
static constexpr bool isSuitableParamFun ()
 is the given functor suitable as parameter functor for this Feed?
 
template<typename PFX >
static constexpr bool isSuitableParamAdaptor ()
 is the given functor suitable to adapt the parameter argument of the processing-functor to accept different input values?
 

Public Member Functions

 FeedPrototype (FUN &&proc)
 setup with processing-functor only
 
 FeedPrototype (FUN &&proc, PAM &&par)
 
bool isActivated () const
 
Feed buildFeed (TurnoutSystem &turnoutSys)
 create suitable Feed(Manifold) for processing a Node invocation
 
template<typename PFX >
auto moveAdaptedParam (PFX otherParamFun=PFX{})
 Cross-Builder to add configuration with a given parameter-functor.
 
enable_if< __and_< is_copy_constructible< FUN >, is_copy_constructible< PAM > >, FeedPrototypeclone () const
 build a clone-copy of this prototype, holding the same functors
 
template<typename PFX = PAM, typename = enable_if<std::is_assignable<PAM,PFX>>>
FeedPrototype && assignParamFun (PFX &&paramFunDef=PAM{})
 Change the current parameter-functor setup by assigning some value.
 
template<typename TRA >
auto decorateProcParam (TRA paramTransformer)
 
template<typename TRA >
auto moveTransformedParam (TRA paramTransformer)
 Adapt parameter handling of the processing-function by passing parameters through an adapter functor before feeding them into the processing-function.
 

Private Types

using _Proc = _ProcFun< FUN >
 
using _Trait = _ParamFun< FUN >
 

Private Attributes

FUN procFun_
 
PAM paramFun_
 

Additional Inherited Members

- Private Member Functions inherited from MoveOnly
 ~MoveOnly ()=default
 
 MoveOnly ()=default
 
 MoveOnly (MoveOnly &&)=default
 
 MoveOnly (MoveOnly const &)=delete
 
MoveOnlyoperator= (MoveOnly &&)=delete
 
MoveOnlyoperator= (MoveOnly const &)=delete
 

Constructor & Destructor Documentation

◆ FeedPrototype() [1/2]

template<class FUN , class PAM >
FeedPrototype ( FUN &&  proc)
inline

setup with processing-functor only

Definition at line 573 of file feed-manifold.hpp.

◆ FeedPrototype() [2/2]

template<class FUN , class PAM >
FeedPrototype ( FUN &&  proc,
PAM &&  par 
)
inline

Definition at line 578 of file feed-manifold.hpp.

Member Typedef Documentation

◆ _Proc

template<class FUN , class PAM >
using _Proc = _ProcFun<FUN>
private

Definition at line 551 of file feed-manifold.hpp.

◆ _Trait

template<class FUN , class PAM >
using _Trait = _ParamFun<FUN>
private

Definition at line 552 of file feed-manifold.hpp.

◆ Feed

template<class FUN , class PAM >
using Feed = FeedManifold<FUN>

Definition at line 558 of file feed-manifold.hpp.

◆ ElmsI

template<class FUN , class PAM >
using ElmsI = _Proc::ElmsI

Definition at line 563 of file feed-manifold.hpp.

◆ ElmsO

template<class FUN , class PAM >
using ElmsO = _Proc::ElmsO

Definition at line 564 of file feed-manifold.hpp.

◆ ElmsP

template<class FUN , class PAM >
using ElmsP = conditional_t<_Trait::hasParam(), typename _Proc::ArgP, Types<> >

Definition at line 565 of file feed-manifold.hpp.

◆ Param

template<class FUN , class PAM >
using Param = _Proc::SigP

Definition at line 566 of file feed-manifold.hpp.

◆ OutTypesApply

template<class FUN , class PAM >
template<template< class > class META>
using OutTypesApply = ElmsO::template Apply<META>

Definition at line 569 of file feed-manifold.hpp.

◆ ProcFun

template<class FUN , class PAM >
using ProcFun = FUN

Definition at line 609 of file feed-manifold.hpp.

◆ ParamFun

template<class FUN , class PAM >
using ParamFun = PAM

Definition at line 610 of file feed-manifold.hpp.

◆ Adapted

template<class FUN , class PAM >
template<typename PFX >
using Adapted = FeedPrototype<FUN,PFX>

Definition at line 613 of file feed-manifold.hpp.

◆ DecoratedProcFun

template<class FUN , class PAM >
template<typename TRA >
using DecoratedProcFun = decltype(std::declval<FeedPrototype>().decorateProcParam (std::declval<TRA>()))

Definition at line 708 of file feed-manifold.hpp.

◆ Decorated

template<class FUN , class PAM >
template<typename TRA >
using Decorated = FeedPrototype<DecoratedProcFun<TRA>,PAM>

Definition at line 711 of file feed-manifold.hpp.

Member Enumeration Documentation

◆ anonymous enum

template<class FUN , class PAM >
anonymous enum
Enumerator
FAN_I 
FAN_O 
FAN_P 

Definition at line 559 of file feed-manifold.hpp.

Member Function Documentation

◆ hasParam()

template<class FUN , class PAM >
static constexpr bool hasParam ( )
inlinestaticconstexpr

Definition at line 584 of file feed-manifold.hpp.

Referenced by FeedPrototype< FUN, PAM >::isSuitableParamAdaptor(), and FeedPrototype< FUN, PAM >::isSuitableParamFun().

+ Here is the caller graph for this function:

◆ hasParamFun()

template<class FUN , class PAM >
static constexpr bool hasParamFun ( )
inlinestaticconstexpr

Definition at line 585 of file feed-manifold.hpp.

Referenced by FeedPrototype< FUN, PAM >::buildFeed().

+ Here is the caller graph for this function:

◆ canActivate()

template<class FUN , class PAM >
static constexpr bool canActivate ( )
inlinestaticconstexpr

Definition at line 586 of file feed-manifold.hpp.

◆ isActivated()

template<class FUN , class PAM >
bool isActivated ( ) const
inline
Returns
runtime test: actually usable parameter-functor available to invoke?

Definition at line 589 of file feed-manifold.hpp.

References FeedPrototype< FUN, PAM >::paramFun_.

Referenced by FeedPrototype< FUN, PAM >::buildFeed().

+ Here is the caller graph for this function:

◆ buildFeed()

template<class FUN , class PAM >
Feed buildFeed ( TurnoutSystem turnoutSys)
inline

create suitable Feed(Manifold) for processing a Node invocation

Definition at line 597 of file feed-manifold.hpp.

References FeedPrototype< FUN, PAM >::hasParamFun(), FeedPrototype< FUN, PAM >::isActivated(), FeedPrototype< FUN, PAM >::paramFun_, and FeedPrototype< FUN, PAM >::procFun_.

+ Here is the call graph for this function:

◆ isSuitableParamFun()

template<class FUN , class PAM >
template<typename PFX >
static constexpr bool isSuitableParamFun ( )
inlinestaticconstexpr

is the given functor suitable as parameter functor for this Feed?

Definition at line 617 of file feed-manifold.hpp.

References FeedPrototype< FUN, PAM >::hasParam().

+ Here is the call graph for this function:

◆ isSuitableParamAdaptor()

template<class FUN , class PAM >
template<typename PFX >
static constexpr bool isSuitableParamAdaptor ( )
inlinestaticconstexpr

is the given functor suitable to adapt the parameter argument of the processing-functor to accept different input values?

Definition at line 624 of file feed-manifold.hpp.

References FeedPrototype< FUN, PAM >::hasParam().

+ Here is the call graph for this function:

◆ moveAdaptedParam()

template<class FUN , class PAM >
template<typename PFX >
auto moveAdaptedParam ( PFX  otherParamFun = PFX{})
inline

Cross-Builder to add configuration with a given parameter-functor.

Returns
new FeedPrototype instance outfitted with the current processing-functor and the given other param-functor
Warning
the current instance is likely defunct after this call, and should not be used any more, due to the move-construct.
Remarks
together with the move-ctor of FeedPrototype this helper can be used to configure a Prototype in several steps.

Definition at line 640 of file feed-manifold.hpp.

◆ clone()

template<class FUN , class PAM >
enable_if< __and_< is_copy_constructible< FUN >,is_copy_constructible< PAM > >, FeedPrototype > clone ( ) const
inline

build a clone-copy of this prototype, holding the same functors

Note
possible only if both proc-functor and param-functor are copyable

Definition at line 652 of file feed-manifold.hpp.

References FeedPrototype< FUN, PAM >::paramFun_, and FeedPrototype< FUN, PAM >::procFun_.

◆ assignParamFun()

template<class FUN , class PAM >
template<typename PFX = PAM, typename = enable_if<std::is_assignable<PAM,PFX>>>
FeedPrototype && assignParamFun ( PFX &&  paramFunDef = PAM{})
inline

Change the current parameter-functor setup by assigning some value.

Parameters
paramFunDefsomething that is assignable to PAM
Note
possible only if the param-functor accepts this kind of assignment; especially when PAM was defined to be a std::function, then the param-functor can not only be reconfigured, but also disabled.

Definition at line 666 of file feed-manifold.hpp.

◆ decorateProcParam()

template<class FUN , class PAM >
template<typename TRA >
auto decorateProcParam ( TRA  paramTransformer)
inline

build an adapted version of the processing-functor, thereby attaching the parameter-transformer.

Definition at line 677 of file feed-manifold.hpp.

References FeedPrototype< FUN, PAM >::procFun_.

Referenced by FeedPrototype< FUN, PAM >::moveTransformedParam().

+ Here is the caller graph for this function:

◆ moveTransformedParam()

template<class FUN , class PAM >
template<typename TRA >
auto moveTransformedParam ( TRA  paramTransformer)
inline

Adapt parameter handling of the processing-function by passing parameters through an adapter functor before feeding them into the processing-function.

Remarks
notably this allows to partially close some parameters, i.e. supply some value from the adaptor, thereby removing them as visible parameters.

Definition at line 721 of file feed-manifold.hpp.

References FeedPrototype< FUN, PAM >::decorateProcParam(), and FeedPrototype< FUN, PAM >::paramFun_.

+ Here is the call graph for this function:

Member Data Documentation

◆ procFun_

template<class FUN , class PAM >
FUN procFun_
private

◆ paramFun_

+ Inheritance diagram for FeedPrototype< FUN, PAM >:
+ Collaboration diagram for FeedPrototype< FUN, PAM >:

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