Pothos  0.7.0-gf7fbae99
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 popElements (const size_t numElements)
 
BufferChunk getBuffer (const size_t numElements)
 
BufferChunk getBuffer (const DType &dtype, const size_t numElements)
 
template<typename... ValueType>
void postLabel (ValueType &&... label)
 
template<typename ValueType >
void postMessage (ValueType &&message)
 
template<typename T , typename... Args>
void emplaceMessage (Args &&... args)
 
template<typename ValueType >
void postBuffer (ValueType &&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

◆ ~OutputPort()

Pothos::OutputPort::~OutputPort ( void  )

Destructor.

Member Function Documentation

◆ alias()

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

Get a displayable name for this port.

◆ buffer()

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.

◆ domain()

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

Get the domain information for this port.

◆ dtype()

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

Get the data type information for this port.

◆ elements()

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.

◆ emplaceMessage()

template<typename T , typename... Args>
void Pothos::OutputPort::emplaceMessage ( Args &&...  args)

Construct a message from arguments and post it to the subscribers on this port.

port->emplaceMessage<std::string>(ptr, len);
Template Parameters
Tthe type of the new message object
Parameters
argsthe constructor arguments for type T

◆ getBuffer() [1/2]

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

Get a buffer of a specified size in elements. The type of the buffer is specified by the port. 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.

Postcondition
buffer() has undefined behavior after this call.
Parameters
numElementsthe number of elements given the port's type
Returns
a buffer chunk with the port's type and the specified length

◆ getBuffer() [2/2]

BufferChunk Pothos::OutputPort::getBuffer ( const DType dtype,
const size_t  numElements 
)

Get a buffer of a specified size and type. This variant provides a user specified data type.

Postcondition
buffer() has undefined behavior after this call.
Parameters
dtypethe buffer's type (independent of port type)
numElementsthe number of elements of type dtype
Returns
a buffer chunk with the specified type and length

◆ index()

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

◆ isSignal()

bool Pothos::OutputPort::isSignal ( void  ) const
inline

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

◆ name()

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

Get the string name identifier for this port.

◆ popElements()

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

◆ postBuffer()

template<typename ValueType >
void Pothos::OutputPort::postBuffer ( ValueType &&  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

◆ postLabel()

template<typename... ValueType>
void Pothos::OutputPort::postLabel ( ValueType &&...  label)
inline

Post an output label to the subscribers on this port. postLabel also supports move and emplacement semantics.

port->postLabel(label);
port->postLabel(std::move(label));
port->postLabel(id, data, index);
Parameters
labelthe label to post

◆ postMessage()

template<typename ValueType >
void Pothos::OutputPort::postMessage ( ValueType &&  message)

Post an output message to the subscribers on this port.

Parameters
messagethe message to post

◆ produce()

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

◆ setAlias()

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

Set the displayable alias for this port.

◆ setReadBeforeWrite()

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

◆ setReserve()

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

◆ totalBuffers()

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.

◆ totalElements()

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().

◆ totalLabels()

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().

◆ totalMessages()

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

◆ InputPort

friend class InputPort
friend

◆ WorkerActor

friend class WorkerActor
friend

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