Skip to content

iox::popo::SubscriberPortUser🔗

The SubscriberPortUser provides the API for accessing a subscriber port from the user side. The subscriber port is divided in the parts SubscriberPortData, SubscriberPortUser and different classes for RouDi side access. The SubscriberPortUser uses the functionality of a ChunkReceiver for receiving shared memory chunks. Additionally it provides the subscribe / unsubscribe API which controls whether the subscriber ports shall try to subscribe to matching publisher ports.

#include <subscriber_port_user.hpp>

Inherits from iox::popo::BasePort

Public Types🔗

Name
using SubscriberPortData MemberType_t

Public Functions🔗

Name
SubscriberPortUser(cxx::not_null< MemberType_t *const > subscriberPortDataPtr)
SubscriberPortUser(const SubscriberPortUser & other)
SubscriberPortUser & operator=(const SubscriberPortUser & )
SubscriberPortUser(SubscriberPortUser && rhs) =default
SubscriberPortUser & operator=(SubscriberPortUser && rhs) =default
~SubscriberPortUser() =default
void subscribe()
try to subscribe to all matching publishers
void unsubscribe()
unsubscribe from publishers, if there are any to which we are currently subscribed
SubscribeState getSubscriptionState() const
get the current subscription state. Caution: There can be delays between calling subscribe and a change in the subscription state. The subscription state can also change without user interaction if publishers come and go
cxx::expected< const mepoo::ChunkHeader *, ChunkReceiveResult > tryGetChunk()
Tries to get the next chunk from the queue. If there is a new one, the ChunkHeader of the oldest chunk in the queue is returned (FiFo queue)
void releaseChunk(const mepoo::ChunkHeader *const chunkHeader)
Release a chunk that was obtained with tryGetChunk.
void releaseQueuedChunks()
Release all the chunks that are currently queued up.
bool hasNewChunks() const
check if there are chunks in the queue
bool hasLostChunksSinceLastCall()
check if there was a queue overflow since the last call of hasLostChunksSinceLastCall
void setConditionVariable(ConditionVariableData & conditionVariableData, const uint64_t notificationIndex)
attach a condition variable (via its pointer) to subscriber
void unsetConditionVariable()
detach a condition variable from subscriber
bool isConditionVariableSet()
check if there's a condition variable attached

Additional inherited members🔗

Public Functions inherited from iox::popo::BasePort

Name
BasePort(MemberType_t *const basePortDataPtr)
BasePort(const BasePort & other)
BasePort(BasePort && )
virtual ~BasePort() =default
operator bool() const
a port can be constructed from a nullptr, additionally it also can be moved and in these cases the member methods would work on a nullptr. to circumvent this problem
capro::ServiceDescription getCaProServiceDescription() const
Reads Type of actual CaPro Port (publisher/subscriber...)
RuntimeName_t getRuntimeName() const
Gets name of the application's runtime for the active port.
UniquePortId getUniqueID() const
Gets Id of the active port.
NodeName_t getNodeName() const
returns node name for the active port
void destroy()
Indicate that this port can be destroyed.
bool toBeDestroyed() const
Checks whether port can be destroyed.

Public Types Documentation🔗

using MemberType_t🔗

using iox::popo::SubscriberPortUser::MemberType_t =  SubscriberPortData;

Public Functions Documentation🔗

function SubscriberPortUser🔗

explicit SubscriberPortUser(
    cxx::not_null< MemberType_t *const > subscriberPortDataPtr
)

function SubscriberPortUser🔗

SubscriberPortUser(
    const SubscriberPortUser & other
)

function operator=🔗

SubscriberPortUser & operator=(
    const SubscriberPortUser & 
)

function SubscriberPortUser🔗

SubscriberPortUser(
    SubscriberPortUser && rhs
) =default

function operator=🔗

SubscriberPortUser & operator=(
    SubscriberPortUser && rhs
) =default

function ~SubscriberPortUser🔗

~SubscriberPortUser() =default

function subscribe🔗

void subscribe()

try to subscribe to all matching publishers

function unsubscribe🔗

void unsubscribe()

unsubscribe from publishers, if there are any to which we are currently subscribed

function getSubscriptionState🔗

SubscribeState getSubscriptionState() const

get the current subscription state. Caution: There can be delays between calling subscribe and a change in the subscription state. The subscription state can also change without user interaction if publishers come and go

Return: SubscribeState

function tryGetChunk🔗

cxx::expected< const mepoo::ChunkHeader *, ChunkReceiveResult > tryGetChunk()

Tries to get the next chunk from the queue. If there is a new one, the ChunkHeader of the oldest chunk in the queue is returned (FiFo queue)

Return: New chunk header, ChunkReceiveResult on error or if there are no new chunks in the underlying queue

function releaseChunk🔗

void releaseChunk(
    const mepoo::ChunkHeader *const chunkHeader
)

Release a chunk that was obtained with tryGetChunk.

Parameters:

  • chunkHeaderpointer to the ChunkHeader to release

function releaseQueuedChunks🔗

void releaseQueuedChunks()

Release all the chunks that are currently queued up.

function hasNewChunks🔗

bool hasNewChunks() const

check if there are chunks in the queue

Return: if there are chunks in the queue return true, otherwise false

function hasLostChunksSinceLastCall🔗

bool hasLostChunksSinceLastCall()

check if there was a queue overflow since the last call of hasLostChunksSinceLastCall

Return: true if the underlying queue overflowed since last call of this method, otherwise false

function setConditionVariable🔗

void setConditionVariable(
    ConditionVariableData & conditionVariableData,
    const uint64_t notificationIndex
)

attach a condition variable (via its pointer) to subscriber

function unsetConditionVariable🔗

void unsetConditionVariable()

detach a condition variable from subscriber

function isConditionVariableSet🔗

bool isConditionVariableSet()

check if there's a condition variable attached

Return: true if a condition variable attached, otherwise false


Updated on 26 April 2021 at 15:31:02 CEST