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

The PublisherPortUser provides the API for accessing a publisher port from the user side. The publisher port is divided in the three parts PublisherPortData, PublisherPortRouDi and PublisherPortUser. The PublisherPortUser uses the functionality of a ChunkSender for sending shared memory chunks. Additionally it provides the offer / stopOffer API which controls whether the publisher port is discoverable for subscriber ports. More...

#include <publisher_port_user.hpp>

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

Public Types

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

Public Member Functions

 PublisherPortUser (cxx::not_null< MemberType_t *const > publisherPortDataPtr) noexcept
 
 PublisherPortUser (const PublisherPortUser &other)=delete
 
PublisherPortUseroperator= (const PublisherPortUser &)=delete
 
 PublisherPortUser (PublisherPortUser &&rhs)=default
 
PublisherPortUseroperator= (PublisherPortUser &&rhs)=default
 
cxx::expected< mepoo::ChunkHeader *, AllocationError > tryAllocateChunk (const uint32_t userPayloadSize, const uint32_t userPayloadAlignment, const uint32_t userHeaderSize=0U, const uint32_t userHeaderAlignment=1U) noexcept
 Allocate a chunk, the ownership of the SharedChunk remains in the PublisherPortUser for being able to cleanup if the user process disappears. More...
 
void releaseChunk (mepoo::ChunkHeader *const chunkHeader) noexcept
 Free an allocated chunk without sending it. More...
 
void sendChunk (mepoo::ChunkHeader *const chunkHeader) noexcept
 Send an allocated chunk to all connected subscriber ports. More...
 
cxx::optional< const mepoo::ChunkHeader * > tryGetPreviousChunk () const noexcept
 Returns the last sent chunk if there is one. More...
 
void offer () noexcept
 offer this publiher port in the system
 
void stopOffer () noexcept
 stop offering this publisher port, all subscribers will be removed from this publisher
 
bool isOffered () const noexcept
 Checks whether the publisher port is currently offered. More...
 
bool hasSubscribers () const noexcept
 Checks whether there are currently subscribers connected to this publisher. 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 PublisherPortUser provides the API for accessing a publisher port from the user side. The publisher port is divided in the three parts PublisherPortData, PublisherPortRouDi and PublisherPortUser. The PublisherPortUser uses the functionality of a ChunkSender for sending shared memory chunks. Additionally it provides the offer / stopOffer API which controls whether the publisher port is discoverable for subscriber ports.

Member Function Documentation

◆ hasSubscribers()

bool iox::popo::PublisherPortUser::hasSubscribers ( ) const
noexcept

Checks whether there are currently subscribers connected to this publisher.

Returns
true if there are subscribers otherwise false

◆ isOffered()

bool iox::popo::PublisherPortUser::isOffered ( ) const
noexcept

Checks whether the publisher port is currently offered.

Returns
true if currently offered otherwise false

◆ releaseChunk()

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

Free an allocated chunk without sending it.

Parameters
[in]chunkHeader,pointerto the ChunkHeader to free

◆ sendChunk()

void iox::popo::PublisherPortUser::sendChunk ( mepoo::ChunkHeader *const  chunkHeader)
noexcept

Send an allocated chunk to all connected subscriber ports.

Parameters
[in]chunkHeader,pointerto the ChunkHeader to send

◆ tryAllocateChunk()

cxx::expected<mepoo::ChunkHeader*, AllocationError> iox::popo::PublisherPortUser::tryAllocateChunk ( const uint32_t  userPayloadSize,
const uint32_t  userPayloadAlignment,
const uint32_t  userHeaderSize = 0U,
const uint32_t  userHeaderAlignment = 1U 
)
noexcept

Allocate a chunk, the ownership of the SharedChunk remains in the PublisherPortUser for being able to cleanup if the user process disappears.

Parameters
[in]userPayloadSize,sizeof the user-payload without additional headers
[in]userPayloadAlignment,alignmentof the user-payload
[in]userHeaderSize,sizeof the user-header; use iox::CHUNK_NO_USER_HEADER_SIZE to omit a user-header
[in]userHeaderAlignment,alignmentof the user-header; use iox::CHUNK_NO_USER_HEADER_ALIGNMENT to omit a user-header
Returns
on success pointer to a ChunkHeader which can be used to access the chunk-header, user-header and user-payload fields, error if not

◆ tryGetPreviousChunk()

cxx::optional<const mepoo::ChunkHeader*> iox::popo::PublisherPortUser::tryGetPreviousChunk ( ) const
noexcept

Returns the last sent chunk if there is one.

Returns
pointer to the ChunkHeader of the last sent Chunk if there is one, empty optional if not

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