Pothos  0.4.1-gb758ed46
The Pothos dataflow programming software suite
Public Member Functions | Friends | List of all members
Pothos::OutputPort Class Reference

#include <OutputPort.hpp>

Public Member Functions

 ~OutputPort (void)
 Destructor. More...
 
int index (void) const
 
const std::string & name (void) const
 Get the string name identifier for this port. More...
 
const std::string & alias (void) const
 Get a displayable name for this port. More...
 
void setAlias (const std::string &alias)
 Set the displayable alias for this port. More...
 
const DTypedtype (void) const
 Get the data type information for this port. More...
 
const std::string & domain (void) const
 Get the domain information for this port. More...
 
const BufferChunkbuffer (void) const
 
size_t elements (void) const
 
unsigned long long totalElements (void) const
 
unsigned long long totalBuffers (void) const
 
unsigned long long totalLabels (void) const
 
unsigned long long totalMessages (void) const
 
void produce (const size_t numElements)
 
void popBuffer (const size_t numBytes)
 
void popElements (const size_t numElements)
 
BufferChunk getBuffer (const size_t numElements)
 
void postLabel (const Label &label)
 
template<typename ValueType >
void postMessage (ValueType &&message)
 
void postBuffer (const BufferChunk &buffer)
 
void setReserve (const size_t numElements)
 
bool isSignal (void) const
 
void setReadBeforeWrite (InputPort *port)
 

Friends

class WorkerActor
 
class InputPort
 

Detailed Description

OutputPort provides methods to interact with a worker's output ports.

Constructor & Destructor Documentation

Pothos::OutputPort::~OutputPort ( void  )

Destructor.

Member Function Documentation

const std::string& Pothos::OutputPort::alias ( void  ) const

Get a displayable name for this port.

const Pothos::BufferChunk & Pothos::OutputPort::buffer ( void  ) const
inline

Get access to the stream buffer. For non-stream ports, this returns an empty buffer chunk.

const std::string & Pothos::OutputPort::domain ( void  ) const
inline

Get the domain information for this port.

const Pothos::DType & Pothos::OutputPort::dtype ( void  ) const
inline

Get the data type information for this port.

size_t Pothos::OutputPort::elements ( void  ) const
inline

Get the number of elements available in the stream buffer. The number of elements is the available bytes/dtype size.

BufferChunk Pothos::OutputPort::getBuffer ( const size_t  numElements)

Get a buffer of a specified size in elements. Some blocks may require buffers of arbitrary size for use with postBuffer() and postMessage() calls. The call will attempt to use the front buffer from this output port and will fall-back to a reusable pool.

Parameters
numElementsthe minimum buffer size
Returns
a buffer chunk with at least numElements
int Pothos::OutputPort::index ( void  ) const
inline

Get the index number of this port. An index of -1 means the port cannot be represented by an integer.

Returns
the index or -1
bool Pothos::OutputPort::isSignal ( void  ) const
inline

Is this port used for signaling in a signals + slots paradigm?

const std::string & Pothos::OutputPort::name ( void  ) const
inline

Get the string name identifier for this port.

void Pothos::OutputPort::popBuffer ( const size_t  numBytes)
inline

Remove all or part of an output buffer from the port; without producing elements for downstream consumers. This call allows the user to use the output buffer for non-streaming purposes, such as an async message. The number of bytes should be less than or equal to the bytes available and a multiple of the element size.

Deprecated:
replaced by popElements(numElements)
Parameters
numBytesthe number of bytes to remove
void Pothos::OutputPort::popElements ( const size_t  numElements)
inline

Remove all or part of an output buffer from the port; without producing elements for downstream consumers. This call allows the user to use the output buffer for non-streaming purposes, such as an async message. The number of elements specified should be less than or equal to the available number elements on this port.

Parameters
numElementsthe number of elements to remove
void Pothos::OutputPort::postBuffer ( const BufferChunk buffer)
inline

Post an output buffer to the subscribers on this port. This call allows external user-provided buffers to be used in place of the normal stream buffer provided by buffer(). The number of elements to produce is determined from the buffer's length field divided by the dtype size. Do not call produce() when using postBuffer().

Parameters
bufferthe buffer to post
void Pothos::OutputPort::postLabel ( const Label label)
inline

Post an output label to the subscribers on this port.

Parameters
labelthe label to post
template<typename ValueType >
void Pothos::OutputPort::postMessage ( ValueType &&  message)

Post an output message to the subscribers on this port.

Parameters
messagethe message to post
void Pothos::OutputPort::produce ( const size_t  numElements)
inline

Produce elements from this port. The number of elements specified must be less than or equal to the number of elements available.

Parameters
numElementsthe number of elements to produce
void Pothos::OutputPort::setAlias ( const std::string &  alias)

Set the displayable alias for this port.

void Pothos::OutputPort::setReadBeforeWrite ( InputPort port)
inline

Set read before write on this output port. Read before write indicates that an element will be read from the input before a corresponding element is written to an element from this output.

This property implies that the input buffer can be used as an output buffer duing a call to the work operation. Also referred to as buffer inlining, the intention is to keep more memory in cache by using the same buffer for both reading and writing operations when possible.

When this "read before write" property is enabled, and the only reference to the buffer is held by the input port, and the size of the input elements is the same as the output. then the input buffer may be substituted for an output buffer.

Parameters
portthe input port to borrow the buffer from
void Pothos::OutputPort::setReserve ( const size_t  numElements)
inline

Set a reserve requirement on this output port. The reserve size ensures that when sufficient resources are available, the buffer will contain at least the specified number of elements. By default, each output port has a reserve of zero elements, which means that the output port's buffer may be any size, but not empty, depending upon the available resources. Note that work() may still be called when the reserve is not met, because the scheduler will only prevent work() from being called when any given port has no available output elements.

Parameters
numElementsthe number of elements to require
unsigned long long Pothos::OutputPort::totalBuffers ( void  ) const
inline

Get the total number of buffers produced from this port. This value will increment immediately after postBuffer(). This call will also increment after every work execution where elements are produced using the produce() method.

unsigned long long Pothos::OutputPort::totalElements ( void  ) const
inline

Get the total number of elements produced from this port. The value returned by this method will not change until after execution of work() and propagateLabels().

unsigned long long Pothos::OutputPort::totalLabels ( void  ) const
inline

Get the total number of labels produced from this port. This value will increment immediately after postLabel().

unsigned long long Pothos::OutputPort::totalMessages ( void  ) const
inline

Get the total number of messages posted to this port. The value returned by this method will be incremented immediately upon calling postMessage().

Friends And Related Function Documentation

friend class InputPort
friend
friend class WorkerActor
friend

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