Syntalos::InputPortInfo
Syntalos::InputPortInfo
Reference for an input port.
#include <syntaloslink.h>
Public Functions
| Name | |
|---|---|
| std::string | id() const |
| int | dataTypeId() const The data type ID of data returned by this port. |
| int | sourceTypeId() const The native data type id of the connected source output port. |
| std::string | title() const |
| MetaStringMap | metadata() const |
| InputPortInfo(const InputPortInfo & ) =delete | |
| InputPortInfo & | operator=(const InputPortInfo & ) =delete |
| void | setNewDataRawCallback(NewDataRawFn callback) Set a low-level callback invoked with raw wire bytes on every sample. |
| void | setNewDataCallback(NewDataFn callback) Set a typed-data callback that receives an already-deserialized BaseDataType. |
| void | setThrottleItemsPerSec(uint itemsPerSec) |
| std::optional< MetaValue > | metadataValue(const std::string & key) const Retrieves the metadata value associated with a given key. |
| MetaValue | metadataValueOr(const std::string & key, const MetaValue & defaultVal) const |
| template <typename T > T | metadataValueOr(const std::string & key, T fallback) const |
Friends
| Name | |
|---|---|
| void | resolveTypedNewDataCallback(InputPortInfo * iport) |
Public Functions Documentation
function id
std::string id() constfunction dataTypeId
int dataTypeId() constThe data type ID of data returned by this port.
function sourceTypeId
int sourceTypeId() constThe native data type id of the connected source output port.
May differ from dataTypeId() when the source is a compatible (constructible-from) type rather than an exact match. Returns 0 if the port is not (yet) connected, in which case callers should treat the wire type as identical to dataTypeId().
function title
std::string title() constfunction metadata
MetaStringMap metadata() constfunction InputPortInfo
InputPortInfo(
const InputPortInfo &
) =deletefunction operator=
InputPortInfo & operator=(
const InputPortInfo &
) =deletefunction setNewDataRawCallback
void setNewDataRawCallback(
NewDataRawFn callback
)Set a low-level callback invoked with raw wire bytes on every sample.
The memory block passed to this function is only valid during the call. The bytes are in the source output port’s native serialization format, which may differ from this input port’s declared type if the source is a compatible-but-different type - the callback is responsible for deserialization and any conversion.
Most consumers should use setNewDataCallback() instead: it has deserialization already resolved. The raw callback is meant for advanced cases that need to inspect the wire format directly.
If both this and setNewDataCallback() are set, the variant callback wins.
function setNewDataCallback
void setNewDataCallback(
NewDataFn callback
)Set a typed-data callback that receives an already-deserialized BaseDataType.
The value passed to the callback is always of this port’s declared input type (with any compatible-type conversion from the source already applied). The callback can therefore static_cast<const T&>(data) to its known declared type without per-sample type-id dispatch.
Setting a non-null callback here causes the connect handler to install a resolved raw callback at connect time, overriding any setNewDataRawCallback() set earlier. Passing nullptr clears both this callback and any resolved raw callback derived from it.
function setThrottleItemsPerSec
void setThrottleItemsPerSec(
uint itemsPerSec
)function metadataValue
std::optional< MetaValue > metadataValue(
const std::string & key
) constRetrieves the metadata value associated with a given key.
Parameters:
- key The key to look up in the metadata.
Return: An optional MetaValue containing the value associated with the key, or std::nullopt if the key does not exist.
function metadataValueOr
MetaValue metadataValueOr(
const std::string & key,
const MetaValue & defaultVal
) constfunction metadataValueOr
template <typename T >
inline T metadataValueOr(
const std::string & key,
T fallback
) constFriends
friend resolveTypedNewDataCallback
friend void resolveTypedNewDataCallback(
InputPortInfo * iport
);Resolve the variant (typed) callback into a per-sample raw callback once, using the recorded source-on-wire type ID and the declared input type ID. Compatible stream type castings are applied here.
Port has to be connected (sourceTypeId != 0) and d.newDataCb should be set.
Updated on 2026-05-24 at 18:43:38 +0000