iceoryx_doc  1.0.1
Public Types | Public Member Functions | List of all members
iox::popo::SubscriberPortUser Class Reference

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. More...

#include <subscriber_port_user.hpp>

Inheritance diagram for iox::popo::SubscriberPortUser:
Inheritance graph
[legend]
Collaboration diagram for iox::popo::SubscriberPortUser:
Collaboration graph
[legend]

Public Types

using MemberType_t = SubscriberPortData
 
- Public Types inherited from iox::popo::BasePort
using MemberType_t = BasePortData
 

Public Member Functions

 SubscriberPortUser (cxx::not_null< MemberType_t *const > subscriberPortDataPtr) noexcept
 
 SubscriberPortUser (const SubscriberPortUser &other)=delete
 
SubscriberPortUseroperator= (const SubscriberPortUser &)=delete
 
 SubscriberPortUser (SubscriberPortUser &&rhs)=default
 
SubscriberPortUseroperator= (SubscriberPortUser &&rhs)=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 More...
 
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) More...
 
void releaseChunk (const mepoo::ChunkHeader *const chunkHeader) noexcept
 Release a chunk that was obtained with tryGetChunk. More...
 
void releaseQueuedChunks () noexcept
 Release all the chunks that are currently queued up.
 
bool hasNewChunks () const noexcept
 check if there are chunks in the queue More...
 
bool hasLostChunksSinceLastCall () noexcept
 check if there was a queue overflow since the last call of hasLostChunksSinceLastCall More...
 
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 More...
 
- Public Member Functions inherited from iox::popo::BasePort
 BasePort (MemberType_t *const basePortDataPtr) noexcept
 
 BasePort (const BasePort &other)=delete
 
BasePortoperator= (const BasePort &)=delete
 
 BasePort (BasePort &&) noexcept
 
BasePortoperator= (BasePort &&) noexcept
 
 operator bool () const noexcept
 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 More...
 
capro::ServiceDescription getCaProServiceDescription () const noexcept
 Reads Type of actual CaPro Port (publisher/subscriber...) More...
 
RuntimeName_t getRuntimeName () const noexcept
 Gets name of the application's runtime for the active port. More...
 
UniquePortId getUniqueID () const noexcept
 Gets Id of the active port. More...
 
NodeName_t getNodeName () const noexcept
 returns node name for the active port More...
 
void destroy () noexcept
 Indicate that this port can be destroyed.
 
bool toBeDestroyed () const noexcept
 Checks whether port can be destroyed. More...
 

Additional Inherited Members

- Protected Member Functions inherited from iox::popo::BasePort
const MemberType_tgetMembers () const noexcept
 
MemberType_tgetMembers () noexcept
 

Detailed Description

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.

Member Function Documentation

◆ getSubscriptionState()

SubscribeState iox::popo::SubscriberPortUser::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

◆ hasLostChunksSinceLastCall()

bool iox::popo::SubscriberPortUser::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

◆ hasNewChunks()

bool iox::popo::SubscriberPortUser::hasNewChunks ( ) const
noexcept

check if there are chunks in the queue

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

◆ isConditionVariableSet()

bool iox::popo::SubscriberPortUser::isConditionVariableSet ( )
noexcept

check if there's a condition variable attached

Returns
true if a condition variable attached, otherwise false

◆ releaseChunk()

void iox::popo::SubscriberPortUser::releaseChunk ( const mepoo::ChunkHeader *const  chunkHeader)
noexcept

Release a chunk that was obtained with tryGetChunk.

Parameters
[in]chunkHeader,pointerto the ChunkHeader to release

◆ tryGetChunk()

cxx::expected<const mepoo::ChunkHeader*, ChunkReceiveResult> iox::popo::SubscriberPortUser::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

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