Skip to content

iox::popo::PublisherImpl🔗

More...

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) =default
PublisherImpl & operator=(PublisherImpl && rhs) =default
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

Public Functions inherited from iox::popo::PublisherInterface< T, mepoo::NoUserHeader >

Name
virtual ~PublisherInterface()

Protected Functions inherited from iox::popo::PublisherInterface< T, mepoo::NoUserHeader >

Name
PublisherInterface() =default

Detailed Description🔗

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

Public Functions Documentation🔗

function PublisherImpl🔗

inline 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
) =default

function operator=🔗

PublisherImpl & operator=(
    PublisherImpl && rhs
) =default

function ~PublisherImpl🔗

virtual ~PublisherImpl() =default

function loan🔗

template <typename... Args>
inline 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🔗

inline 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🔗

inline 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>
inline 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 26 April 2021 at 15:31:02 CEST