Class SubscriberPortUser
Defined in File subscriber_port_user.hpp
Inheritance Relationships
Base Type
public iox::popo::BasePort(Class BasePort)
Class Documentation
-
class SubscriberPortUser : public iox::popo::BasePort
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.
Public Types
-
using MemberType_t = SubscriberPortData
Public Functions
-
explicit SubscriberPortUser(cxx::not_null<MemberType_t*const> subscriberPortDataPtr) noexcept
-
SubscriberPortUser(const SubscriberPortUser &other) = delete
-
SubscriberPortUser &operator=(const SubscriberPortUser&) = delete
-
SubscriberPortUser(SubscriberPortUser &&rhs) noexcept = default
-
SubscriberPortUser &operator=(SubscriberPortUser &&rhs) noexcept = default
-
~SubscriberPortUser() = default
-
void subscribe() noexcept
try to subscribe to all matching publishers
-
void unsubscribe() noexcept
unsubscribe from publishers, if there are any to which we are currently subscribed
-
SubscribeState getSubscriptionState() const noexcept
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
- Returns:
SubscribeState
-
cxx::expected<const mepoo::ChunkHeader*, ChunkReceiveResult> tryGetChunk() noexcept
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)
- Returns:
New chunk header, ChunkReceiveResult on error or if there are no new chunks in the underlying queue
-
void releaseChunk(const mepoo::ChunkHeader *const chunkHeader) noexcept
Release a chunk that was obtained with tryGetChunk.
- Parameters:
chunkHeader, pointer – [in] to the ChunkHeader to release
-
void releaseQueuedChunks() noexcept
Release all the chunks that are currently queued up.
-
bool hasNewChunks() const noexcept
check if there are chunks in the queue
- Returns:
if there are chunks in the queue return true, otherwise false
-
bool hasLostChunksSinceLastCall() noexcept
check if there was a queue overflow since the last call of hasLostChunksSinceLastCall
- Returns:
true if the underlying queue overflowed since last call of this method, otherwise false
-
void setConditionVariable(ConditionVariableData &conditionVariableData, const uint64_t notificationIndex) noexcept
attach a condition variable (via its pointer) to subscriber
-
void unsetConditionVariable() noexcept
detach a condition variable from subscriber
-
bool isConditionVariableSet() noexcept
check if there’s a condition variable attached
- Returns:
true if a condition variable attached, otherwise false
-
using MemberType_t = SubscriberPortData