flow  3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
Public Member Functions | List of all members
flow::samples::generic::generator< T > Class Template Reference

Concrete producer that generates packets by calling a parameter functor. More...

#include <generic.h>

Inheritance diagram for flow::samples::generic::generator< T >:
Inheritance graph
[legend]
Collaboration diagram for flow::samples::generic::generator< T >:
Collaboration graph
[legend]

Public Member Functions

 generator (timer &timer_r, const std::function< T()> &gen_f, const std::string &name_r="generator")
 
virtual void stopped ()
 implementation of node::stopped().
 
virtual void timer_fired ()
 The function to pass to the timer as the listener.
 
virtual void produce ()
 Implementation of producer::produce().
 
- Public Member Functions inherited from flow::producer< T >
 producer (const std::string &name_r, const size_t outs)
 
virtual size_t outs () const
 Returns the number of output pins.
 
virtual outpin< T > & output (const size_t n)
 Returns a reference to an outpin pin.
 
virtual const outpin< T > & output (const size_t n) const
 Returns a const reference to an outpin pin.
 
virtual outputs_t & outputs ()
 Returns a reference to the container of output pins.
 
virtual const outputs_t & outputs () const
 Returns a const reference to the container of output pins.
 
virtual std::string rename (const std::string &name_r)
 Overrides named::rename.
 
- Public Member Functions inherited from flow::node
 node (const std::string &name_r)
 
 node (node &&node_rr)
 Move constructor.
 
virtual state::type state () const
 Returns the node's state.
 
virtual void started ()
 Indicates the node has been started.
 
virtual void paused ()
 Indicates the node has been paused.
 
- Public Member Functions inherited from flow::named
 named (const std::string &name_r)
 Constructor the takes a name.
 
 named (named &&name_rr)
 Move constructor.
 
 named (const named &name_r)
 Copy constructor.
 
virtual const std::string & name () const
 A const reference to this object's name.
 

Additional Inherited Members

- Protected Member Functions inherited from flow::producer< T >
virtual void connect (size_t p_pin, consumer< T > *consumer_p, size_t c_pin, const size_t max_length=0, const size_t max_weight=0)
 Connect this producer to a consumer.
 
virtual void disconnect (size_t pin)
 Disconnect an outpin of this producer.
 
virtual void sever ()
 Disconnect all pins.
 
virtual void operator() ()
 The node's execution function.
 
- Protected Attributes inherited from flow::node
std::condition_variable d_transition_cv
 The condition variable to monitor the node's state.
 
std::mutex d_transition_m
 The mutex to lock when waiting on d_transition_cv.
 

Detailed Description

template<typename T>
class flow::samples::generic::generator< T >

Concrete producer that generates packets by calling a parameter functor.

Constructor & Destructor Documentation

template<typename T >
flow::samples::generic::generator< T >::generator ( timer timer_r,
const std::function< T()> &  gen_f,
const std::string &  name_r = "generator< T >" 
)
inline
Parameters
timer_rTimer that will signal when to produce a packet.
gen_fThe functor to be called. The return value of this functor will be considered a packet.
name_rThe name to give this node.

Member Function Documentation

template<typename T >
virtual void flow::samples::generic::generator< T >::produce ( )
inlinevirtual

Implementation of producer::produce().

This function waits until the node is stopped or the timer has fired. When the timer fires, the generator functor is called and its return value is moved to the pipe.

Implements flow::producer< T >.


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