Embedded Multicore Building Blocks V1.0.0
Public Types | Public Member Functions | List of all members
embb::dataflow::Network::Switch< Type > Class Template Reference

Switch process template. More...

#include <network.h>

Public Types

typedef embb::base::Function< void, bool, Type, Type & > FunctionType
 Function type to use when processing tokens. More...
 
typedef Inputs< bool, Type > InputsType
 Input port type list. More...
 
typedef Outputs< Type > OutputsType
 Output port type list. More...
 

Public Member Functions

 Select (Network &network)
 Constructs a Switch process. More...
 
 Select (Network &network, embb::mtapi::ExecutionPolicy const &policy)
 Constructs a Switch process. More...
 
virtual bool HasInputs () const
 
InputsTypeGetInputs ()
 
template<int Index>
InputsType::Types< Index >::Result & GetInput ()
 
virtual bool HasOutputs () const
 
OutputsTypeGetOutputs ()
 
template<int Index>
OutputsType::Types< Index >::Result & GetOutput ()
 
template<typename T >
void operator>> (T &target)
 Connects output port 0 to input port 0 of target. More...
 

Detailed Description

template<typename Type>
class embb::dataflow::Network::Switch< Type >

Switch process template.

A switch has 2 inputs and 2 outputs. Input port 0 is of type boolean and selects to which output port the value of input port 1 of type Type is sent. If input port 0 is set to true the value goes to output port 0 and to output port 1 otherwise. Tokens are processed as soon as all inputs for that token are complete.

See also
Select
Template Parameters
TypeThe type of input port 1 and output port 0 and 1.

Member Typedef Documentation

template<typename Type >
typedef embb::base::Function<void, bool, Type, Type &> embb::dataflow::Network::Switch< Type >::FunctionType

Function type to use when processing tokens.

template<typename Type >
typedef Inputs<bool, Type> embb::dataflow::Network::Switch< Type >::InputsType

Input port type list.

template<typename Type >
typedef Outputs<Type> embb::dataflow::Network::Switch< Type >::OutputsType

Output port type list.

Member Function Documentation

template<typename Type >
embb::dataflow::Network::Switch< Type >::Select ( Network network)
explicit

Constructs a Switch process.

Parameters
networkThe network this node is going to be part of.
template<typename Type >
embb::dataflow::Network::Switch< Type >::Select ( Network network,
embb::mtapi::ExecutionPolicy const &  policy 
)

Constructs a Switch process.

Parameters
networkThe network this node is going to be part of.
policyThe execution policy of the process.
template<typename Type >
virtual bool embb::dataflow::Network::Switch< Type >::HasInputs ( ) const
virtual
Returns
Always true.
template<typename Type >
InputsType& embb::dataflow::Network::Switch< Type >::GetInputs ( )
Returns
Reference to a list of all input ports.
template<typename Type >
template<int Index>
InputsType::Types<Index>::Result& embb::dataflow::Network::Switch< Type >::GetInput ( )
Returns
Input port at Index.
template<typename Type >
virtual bool embb::dataflow::Network::Switch< Type >::HasOutputs ( ) const
virtual
Returns
Always true.
template<typename Type >
OutputsType& embb::dataflow::Network::Switch< Type >::GetOutputs ( )
Returns
Reference to a list of all output ports.
template<typename Type >
template<int Index>
OutputsType::Types<Index>::Result& embb::dataflow::Network::Switch< Type >::GetOutput ( )
Returns
Output port at Index.
template<typename Type >
template<typename T >
void embb::dataflow::Network::Switch< Type >::operator>> ( T &  target)

Connects output port 0 to input port 0 of target.

Parameters
targetProcess to connect to.
Template Parameters
TType of target process.