Skip to content

iox::popo::PublisherPortUser🔗

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.

#include <publisher_port_user.hpp>

Inherits from iox::popo::BasePort

Public Types🔗

Name
using PublisherPortData MemberType_t

Public Functions🔗

Name
PublisherPortUser(cxx::not_null< MemberType_t *const > publisherPortDataPtr)
PublisherPortUser(const PublisherPortUser & other)
PublisherPortUser & operator=(const PublisherPortUser & )
PublisherPortUser(PublisherPortUser && rhs) =default
PublisherPortUser & operator=(PublisherPortUser && rhs) =default
~PublisherPortUser() =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)
Allocate a chunk, the ownership of the SharedChunk remains in the PublisherPortUser for being able to cleanup if the user process disappears.
void releaseChunk(mepoo::ChunkHeader *const chunkHeader)
Free an allocated chunk without sending it.
void sendChunk(mepoo::ChunkHeader *const chunkHeader)
Send an allocated chunk to all connected subscriber ports.
cxx::optional< const mepoo::ChunkHeader * > tryGetPreviousChunk() const
Returns the last sent chunk if there is one.
void offer()
offer this publiher port in the system
void stopOffer()
stop offering this publisher port, all subscribers will be removed from this publisher
bool isOffered() const
Checks whether the publisher port is currently offered.
bool hasSubscribers() const
Checks whether there are currently subscribers connected to this publisher.

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::PublisherPortUser::MemberType_t =  PublisherPortData;

Public Functions Documentation🔗

function PublisherPortUser🔗

explicit PublisherPortUser(
    cxx::not_null< MemberType_t *const > publisherPortDataPtr
)

function PublisherPortUser🔗

PublisherPortUser(
    const PublisherPortUser & other
)

function operator=🔗

PublisherPortUser & operator=(
    const PublisherPortUser & 
)

function PublisherPortUser🔗

PublisherPortUser(
    PublisherPortUser && rhs
) =default

function operator=🔗

PublisherPortUser & operator=(
    PublisherPortUser && rhs
) =default

function ~PublisherPortUser🔗

~PublisherPortUser() =default

function tryAllocateChunk🔗

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

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

Parameters:

  • userPayloadSizesize of the user-payload without additional headers
  • userPayloadAlignmentalignment of the user-payload
  • userHeaderSizesize of the user-header; use iox::CHUNK_NO_USER_HEADER_SIZE to omit a user-header
  • userHeaderAlignmentalignment of the user-header; use iox::CHUNK_NO_USER_HEADER_ALIGNMENT to omit a user-header

Return: on success pointer to a ChunkHeader which can be used to access the chunk-header, user-header and user-payload fields, error if not

function releaseChunk🔗

void releaseChunk(
    mepoo::ChunkHeader *const chunkHeader
)

Free an allocated chunk without sending it.

Parameters:

  • chunkHeaderpointer to the ChunkHeader to free

function sendChunk🔗

void sendChunk(
    mepoo::ChunkHeader *const chunkHeader
)

Send an allocated chunk to all connected subscriber ports.

Parameters:

  • chunkHeaderpointer to the ChunkHeader to send

function tryGetPreviousChunk🔗

cxx::optional< const mepoo::ChunkHeader * > tryGetPreviousChunk() const

Returns the last sent chunk if there is one.

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

function offer🔗

void offer()

offer this publiher port in the system

function stopOffer🔗

void stopOffer()

stop offering this publisher port, all subscribers will be removed from this publisher

function isOffered🔗

bool isOffered() const

Checks whether the publisher port is currently offered.

Return: true if currently offered otherwise false

function hasSubscribers🔗

bool hasSubscribers() const

Checks whether there are currently subscribers connected to this publisher.

Return: true if there are subscribers otherwise false


Updated on 17 June 2021 at 11:15:27 CEST