#include <InputPort.hpp>
InputPort provides methods to interact with a worker's input ports.
◆ ~InputPort()
Pothos::InputPort::~InputPort |
( |
void |
| ) |
|
◆ alias()
const std::string& Pothos::InputPort::alias |
( |
void |
| ) |
const |
Get a displayable name for this port.
◆ buffer()
Get access to the stream buffer. For non-stream ports, this returns an empty buffer chunk.
◆ clear()
void Pothos::InputPort::clear |
( |
void |
| ) |
|
Clear all memory on this input port. Clear buffers, labels, and messages.
◆ consume()
void Pothos::InputPort::consume |
( |
const size_t |
numElements | ) |
|
|
inline |
Consume elements on this port. The number of elements specified must be less than or equal to the number of elements available.
- Parameters
-
numElements | the number of elements to consume |
◆ domain()
const std::string & Pothos::InputPort::domain |
( |
void |
| ) |
const |
|
inline |
Get the domain information for this port.
◆ dtype()
Get the data type information for this port.
◆ elements()
size_t Pothos::InputPort::elements |
( |
void |
| ) |
const |
|
inline |
Get the number of elements available in the stream buffer. The number of elements is the available bytes/dtype size.
◆ hasMessage()
bool Pothos::InputPort::hasMessage |
( |
void |
| ) |
|
|
inline |
Does the specified input port have an asynchronous message available?
◆ index()
int Pothos::InputPort::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
◆ isSlot()
bool Pothos::InputPort::isSlot |
( |
void |
| ) |
const |
|
inline |
Is this port used for signal handling in a signals + slots paradigm?
◆ labels()
Get an iterator to all input labels for the specified port. Labels are sorted in order of oldest to newest by label index.
- Returns
- an iterable object with sorted labels
◆ name()
const std::string & Pothos::InputPort::name |
( |
void |
| ) |
const |
|
inline |
Get the string name identifier for this port.
◆ peekMessage()
Return an asynchronous message from the port without removing it. If there is no message available, a null Object() is returned.
- Returns
- an asynchronous message object
◆ popMessage()
Remove and return an asynchronous message from the port. If there is no message available, a null Object() is returned.
- Returns
- an asynchronous message object
◆ pushBuffer()
void Pothos::InputPort::pushBuffer |
( |
const BufferChunk & |
buffer | ) |
|
Push a buffer into the buffer queue of this input port. This is a thread-safe call, it can be made from any context. Use pushBuffer to preload an input port with elements, example: a window-sized history of elements for a filter block, or a preloaded number of elements for a feedback loop.
◆ pushLabel()
void Pothos::InputPort::pushLabel |
( |
const Label & |
label | ) |
|
Push a label into the label storage of this input port. This is a thread-safe call, it can be made from any context. When using this call, first push the buffer with the corresponding label index before pushing the label.
◆ pushMessage()
void Pothos::InputPort::pushMessage |
( |
const Object & |
message | ) |
|
Push a message into the message queue of this input port. This is a thread-safe call, it can be made from any context.
◆ removeLabel()
void Pothos::InputPort::removeLabel |
( |
const Label & |
label | ) |
|
|
inline |
Remove a label from the internal storage structure. This invalidates the iterator retrieved from labels(). Since labels are automatically removed by consume(), this call allows a users to simplify state tracking in their block implementations by removing labels, that might be iterated through on subsequent runs.
◆ setAlias()
void Pothos::InputPort::setAlias |
( |
const std::string & |
alias | ) |
|
Set the displayable alias for this port.
◆ setReserve()
void Pothos::InputPort::setReserve |
( |
const size_t |
numElements | ) |
|
|
inline |
Set a reserve requirement on this input 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 input port has a reserve of zero elements, which means that the input port's buffer may be any size, including 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 all ports fail to meet their respective reserve requirements.
- Parameters
-
numElements | the number of elements to require |
◆ takeBuffer()
Take buffer transfers ownership of the buffer to the caller. Use takeBuffer() to support perfect buffer forwarding with postBuffer() and postMessage() on an output port.
auto buff = inPort->takeBuffer();
outPort->postBuffer(std::move(buff));
- Note
- Note that takeBuffer() does not consume. The caller must also call consume() with the number of elements actually read from the buffer.
- Postcondition
- buffer() has undefined behavior after this call.
- Returns
- the buffer from this input port
◆ totalBuffers()
unsigned long long Pothos::InputPort::totalBuffers |
( |
void |
| ) |
const |
|
inline |
Get the total number of buffers posted to this port. Note that this call tracks incoming buffer count, and not total buffer consumption (which is harder).
◆ totalElements()
unsigned long long Pothos::InputPort::totalElements |
( |
void |
| ) |
const |
|
inline |
Get the total number of elements consumed on this port. The value returned by this method will not change until after execution of work() and propagateLabels().
◆ totalLabels()
unsigned long long Pothos::InputPort::totalLabels |
( |
void |
| ) |
const |
|
inline |
Get the total number of labels consumed from this port. This count updates immediately upon calling removeLabel(), and after after execution of work() and propagateLabels().
◆ totalMessages()
unsigned long long Pothos::InputPort::totalMessages |
( |
void |
| ) |
const |
|
inline |
Get the total number of messages popped from this port. The value returned by this method will be incremented immediately upon calling popMessage().
◆ OutputPort
◆ WorkerActor
The documentation for this class was generated from the following files: