Carries packets from one node to another node on a FIFO basis. More...
#include <pipe.h>
Public Member Functions | |
pipe (const std::string &name_r, outpin< T > *output_p, inpin< T > *input_p, const size_t max_length=0, const size_t max_weight=0) | |
Constructor for a new pipe. | |
pipe (pipe &&pipe_rr) | |
Move constructor. | |
virtual outpin< T > * | input () const |
Pointer to the producing node's output pin. | |
virtual inpin< T > * | output () const |
Pointer to the consuming node's input pin. | |
virtual size_t | length () const |
The pipe's current length. The number of packets in the pipe. | |
virtual size_t | max_length () const |
The maximum number of packets this pipe will carry. | |
virtual size_t | weight () const |
The pipe's current weight. The sum of all bytes of all packets in the pipe. | |
virtual size_t | max_weight () const |
The maximum number of bytes this pipe will carry. | |
virtual size_t | cap_length (const size_t max_length) |
Sets the maximum length. | |
virtual size_t | cap_weight (const size_t max_weight) |
Sets the maximum weight. | |
virtual size_t | flush () |
Discards all packets. | |
virtual bool | push (std::unique_ptr< packet< T >> packet_p) |
Queues a packet in the pipe. | |
virtual std::unique_ptr < packet< T > > | pop () |
Extracts a packet from the pipe. | |
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. | |
virtual std::string | rename (const std::string &name_r) |
Sets this object's name to a new name. | |
Carries packets from one node to another node on a FIFO basis.
Packets will accumulate in pipes if the node at the consuming end does not consume them fast enough. If packet accumulation is expected but memory usage is a concern, length and weight can be specified. If a pipe has reached it's length and weight limit, pushed packets will instead be discarded. A graph that produces more data than it consumes is unbalanced and should be adjusted.
|
inline |
Constructor for a new pipe.
name_r | Name of this pipe. This will be typically generated from the names of the producing and consuming nodes. |
output_p | The output pin of the producing node. |
input_p | The input pin of the consuming node. |
max_length | The maximum number of nodes this pipe will carry. Do not set or set to 0 for uncapped length. |
max_weight | The maximum number of bytes this pipe will carry. Do not set or set to 0 for uncapped weight. |
|
inlinevirtual |
The maximum number of packets this pipe will carry.
If 0, then uncapped.
|
inlinevirtual |
The maximum number of bytes this pipe will carry.
If 0, then uncapped.
|
inlinevirtual |
Queues a packet in the pipe.
Used by the producer node to move a packet it produced to the pipe. If the packet does not fit in the pipe, it will not be moved.
packet_p | A pointer to the packet. If this call is unsuccessful, packet_p will still point to the packet after the call. |
|
inlinevirtual |
Extracts a packet from the pipe.
Used by the consuming node to move a packet from the pipe to consume.