flow  3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
Public Member Functions | Protected Member Functions | Friends | List of all members
flow::consumer< T > Class Template Referenceabstract

Base class from which concrete pure consumers derive. More...

#include <node.h>

Inheritance diagram for flow::consumer< T >:
Inheritance graph
[legend]
Collaboration diagram for flow::consumer< T >:
Collaboration graph
[legend]

Public Member Functions

 consumer (const std::string &name_r, const size_t ins)
 
virtual size_t ins () const
 Returns the number of input pins.
 
virtual inpin< T > & input (const size_t n)
 Returns a reference to an input pin.
 
virtual const inpin< T > & input (const size_t n) const
 Returns a const reference to an input pin.
 
virtual inputs_t & inputs ()
 Returns a reference to the container of input pins.
 
virtual const inputs_t & inputs () const
 Returns a const reference to the container of input pins.
 
virtual std::string rename (const std::string &name_r)
 Overrides named::rename.
 
virtual void ready (size_t n)=0
 Consuming function.
 
- 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.
 
virtual void stopped ()
 Indicates the node has been stopped.
 
- 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.
 

Protected Member Functions

virtual void disconnect (size_t pin)
 Disconnect an inpin of this consumer.
 
virtual void sever ()
 Disconnect all pins.
 
virtual bool incoming ()
 Tests whether there are any packets at any of the inpins.
 
virtual void operator() ()
 The node's execution function.
 

Friends

class graph
 

Additional Inherited Members

- 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::consumer< T >

Base class from which concrete pure consumers derive.

Concrete transformers should derive from flow::transformer.

Template Parameters
TThe type of data this node consumes.

Constructor & Destructor Documentation

template<typename T>
flow::consumer< T >::consumer ( const std::string &  name_r,
const size_t  ins 
)
inline
Parameters
name_rThe name to give this node.
insNumbers of input pins.

Member Function Documentation

template<typename T>
virtual void flow::consumer< T >::disconnect ( size_t  pin)
inlineprotectedvirtual

Disconnect an inpin of this consumer.

Parameters
pinIndex of the pin to disconnect.
template<typename T>
virtual void flow::consumer< T >::operator() ( )
inlineprotectedvirtual

The node's execution function.

This is the implementation of node::operator()(). Nodes that are consumers should use this function as their execution function.

Implements flow::node.

Reimplemented in flow::transformer< C, P >, and flow::transformer< T, T >.

template<typename T>
virtual inpin<T>& flow::consumer< T >::input ( const size_t  n)
inlinevirtual

Returns a reference to an input pin.

Parameters
nThe index of the input pin.
template<typename T>
virtual const inpin<T>& flow::consumer< T >::input ( const size_t  n) const
inlinevirtual

Returns a const reference to an input pin.

Parameters
nThe index of the input pin.
template<typename T>
virtual std::string flow::consumer< T >::rename ( const std::string &  name_r)
inlinevirtual

Overrides named::rename.

Ensure pins are also renamed.

Parameters
name_rNew name to give this node.

Reimplemented from flow::named.

Reimplemented in flow::transformer< C, P >, and flow::transformer< T, T >.

template<typename T>
virtual void flow::consumer< T >::ready ( size_t  n)
pure virtual

Consuming function.

This function is called from the operator()() execution function. It is the function that the concrete classes of consuming nodes implement. This function signals that a packet is ready at an input node.

param n The index of the input pin at which a packet has arrived.

Implemented in flow::transformer< C, P >, flow::transformer< T, T >, flow::samples::generic::delay< T >, flow::samples::generic::tee< T >, flow::samples::generic::ostreamer< T >, flow::samples::math::const_adder< T >, and flow::samples::math::adder< T >.


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