Skip to content

iox::popo::PublisherImpl🔗

The PublisherImpl class implements the typed publisher API. More...

#include <iceoryx_posh/internal/popo/publisher_impl.hpp>

Inherits from iox::popo::BasePublisher<>, iox::popo::PublisherInterface< T, mepoo::NoUserHeader >

Public Functions🔗

Name
PublisherImpl(const capro::ServiceDescription & service, const PublisherOptions & publisherOptions =PublisherOptions())
PublisherImpl(const PublisherImpl & other)
PublisherImpl & operator=(const PublisherImpl & )
PublisherImpl(PublisherImpl && rhs)
PublisherImpl & operator=(PublisherImpl && rhs)
virtual ~PublisherImpl() =default
template <typename... Args>
cxx::expected< Sample< T, H >, AllocationError >
loan(Args &&... args)
loan Get a sample from loaned shared memory and consctruct the data with the given arguments.
void publish(Sample< T, H > && sample) override
publish Publishes the given sample and then releases its loan.
cxx::expected< AllocationError > publishCopyOf(const T & val)
publishCopyOf Copy the provided value into a loaned shared memory chunk and publish it.
template <typename Callable ,typename... ArgTypes>
cxx::expected< AllocationError >
publishResultOf(Callable c, ArgTypes... args)
publishResultOf Loan a sample from memory, execute the provided callable to write to it, then publish it.

Additional inherited members🔗

Public Types inherited from iox::popo::BasePublisher<>

Name
using port_t PortType

Public Functions inherited from iox::popo::BasePublisher<>

Name
BasePublisher(const BasePublisher & other)
BasePublisher(BasePublisher && rhs)
virtual ~BasePublisher()
uid_t getUid() const
uid Get the UID of the publisher.
capro::ServiceDescription getServiceDescription() const
getServiceDescription Get the service description of the publisher.
void offer()
offer Offer the service to be subscribed to.
void stopOffer()
stopOffer Stop offering the service.
bool isOffered() const
isOffered
bool hasSubscribers() const
hasSubscribers

Protected Functions inherited from iox::popo::BasePublisher<>

Name
BasePublisher() =default
BasePublisher(const capro::ServiceDescription & service, const PublisherOptions & publisherOptions)
const port_t & port() const
port
port_t & port()
port

Protected Attributes inherited from iox::popo::BasePublisher<>

Name
port_t m_port

Detailed Description🔗

template <typename T ,
typename H  =mepoo::NoUserHeader,
typename BasePublisherType  =BasePublisher<>>
class iox::popo::PublisherImpl;

The PublisherImpl class implements the typed publisher API.

Note: Not intended for public usage! Use the [Publisher](/v2.0.2/API-reference/posh/Classes/classiox_1_1popo_1_1Publisher/) instead!

Public Functions Documentation🔗

function PublisherImpl🔗

explicit PublisherImpl(
    const capro::ServiceDescription & service,
    const PublisherOptions & publisherOptions =PublisherOptions()
)

function PublisherImpl🔗

PublisherImpl(
    const PublisherImpl & other
)

function operator=🔗

PublisherImpl & operator=(
    const PublisherImpl & 
)

function PublisherImpl🔗

PublisherImpl(
    PublisherImpl && rhs
)

function operator=🔗

PublisherImpl & operator=(
    PublisherImpl && rhs
)

function ~PublisherImpl🔗

virtual ~PublisherImpl() =default

function loan🔗

template <typename... Args>
cxx::expected< Sample< T, H >, AllocationError > loan(
    Args &&... args
)

loan Get a sample from loaned shared memory and consctruct the data with the given arguments.

Parameters:

  • args Arguments used to construct the data.

Return: An instance of the sample that resides in shared memory or an error if unable ot allocate memory to loan.

The loaned sample is automatically released when it goes out of scope.

function publish🔗

void publish(
    Sample< T, H > && sample
) override

publish Publishes the given sample and then releases its loan.

Parameters:

  • sample The sample to publish.

function publishCopyOf🔗

cxx::expected< AllocationError > publishCopyOf(
    const T & val
)

publishCopyOf Copy the provided value into a loaned shared memory chunk and publish it.

Parameters:

  • val Value to copy.

Return: Error if unable to allocate memory to loan.

function publishResultOf🔗

template <typename Callable ,
typename... ArgTypes>
cxx::expected< AllocationError > publishResultOf(
    Callable c,
    ArgTypes... args
)

publishResultOf Loan a sample from memory, execute the provided callable to write to it, then publish it.

Parameters:

  • c Callable with the signature void(T, ArgTypes...) that write's it's result to T.
  • args The arguments of the callable.

Return: Error if unable to allocate memory to loan.


Updated on 31 May 2022 at 11:34:55 CEST