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::producer< T > Class Template Referenceabstract

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

#include <node.h>

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

Public Member Functions

 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.
 
virtual void produce ()=0
 Producing 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 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.
 

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

Base class from which concrete pure producers derive.

Concrete transformers should derive from flow::transformer.

Template Parameters
TThe type of data this node produces.

Constructor & Destructor Documentation

template<typename T>
flow::producer< T >::producer ( const std::string &  name_r,
const size_t  outs 
)
inline
Parameters
name_rThe name to give this node.
outsNumbers of output pins.

Member Function Documentation

template<typename T>
virtual void flow::producer< T >::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 
)
inlineprotectedvirtual

Connect this producer to a consumer.

Parameters
p_pinThe index of this node's output pin.
consumer_pPointer to the consumer node to conenct to.
c_pinThe index of the consumer node's input pin.
max_lengthThe maximum length to give the pipe. Do not set or set to 0 for uncapped length.
max_weightThe maximum weight to give the pipe. Do not set or set to 0 for uncapped weight.
template<typename T>
virtual void flow::producer< T >::disconnect ( size_t  pin)
inlineprotectedvirtual

Disconnect an outpin of this producer.

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

The node's execution function.

This is the implementation of node::operator()(). Nodes that are pure producers 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 outpin<T>& flow::producer< T >::output ( const size_t  n)
inlinevirtual

Returns a reference to an outpin pin.

Parameters
nThe index of the output pin.
template<typename T>
virtual const outpin<T>& flow::producer< T >::output ( const size_t  n) const
inlinevirtual

Returns a const reference to an outpin pin.

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

Overrides named::rename.

Ensure pins are also renamed.

Parameters
name_rNew name to give this node.
Returns
The node's previous name.

Reimplemented from flow::named.

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

template<typename T>
virtual void flow::producer< T >::produce ( )
pure virtual

Producing function.

This function is called from the operator()() execution function. It is the function that the concrete classes of producing nodes implement. The body of this function should push packets on its outpins.

Implemented in flow::samples::generic::generator< T >.


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