iceoryx2
C++ Language Bindings
Loading...
Searching...
No Matches
iox2::Publisher< S, Payload, UserHeader > Class Template Reference

Sending endpoint of a publish-subscriber based communication. More...

#include <publisher.hpp>

Public Member Functions

 Publisher (Publisher &&rhs) noexcept
 
auto operator= (Publisher &&rhs) noexcept -> Publisher &
 
 ~Publisher ()
 
 Publisher (const Publisher &)=delete
 
auto operator= (const Publisher &) -> Publisher &=delete
 
auto id () const -> UniquePublisherId
 Returns the [UniquePublisherId] of the [Publisher].
 
auto backpressure_strategy () const -> BackpressureStrategy
 
template<typename T = Payload, typename = std::enable_if_t<bb::IsSlice<T>::VALUE, void>>
auto initial_max_slice_len () const -> uint64_t
 Returns the maximum number of elements that can be loaned in a slice.
 
template<typename T = Payload, typename = std::enable_if_t<!bb::IsSlice<T>::VALUE, void>>
auto send_copy (const Payload &payload) const -> bb::Expected< size_t, SendError >
 
template<typename T = Payload, typename = std::enable_if_t<bb::IsSlice<T>::VALUE, void>>
auto send_slice_copy (bb::ImmutableSlice< ValueType > &payload) const -> bb::Expected< size_t, SendError >
 
template<typename T = Payload, typename = std::enable_if_t<!bb::IsSlice<T>::VALUE, void>>
auto loan_uninit () -> bb::Expected< SampleMutUninit< S, Payload, UserHeader >, LoanError >
 
template<typename T = Payload, typename = std::enable_if_t<!bb::IsSlice<T>::VALUE, void>>
auto loan () -> bb::Expected< SampleMut< S, Payload, UserHeader >, LoanError >
 
template<typename T = Payload, typename = std::enable_if_t<bb::IsSlice<T>::VALUE, void>>
auto loan_slice (uint64_t number_of_elements) -> bb::Expected< SampleMut< S, T, UserHeader >, LoanError >
 
template<typename T = Payload, typename = std::enable_if_t<bb::IsSlice<T>::VALUE, void>>
auto loan_slice_uninit (uint64_t number_of_elements) -> bb::Expected< SampleMutUninit< S, T, UserHeader >, LoanError >
 
auto update_connections () -> bb::Expected< void, ConnectionFailure >
 

Friends

template<ServiceType , typename , typename >
class PortFactoryPublisher
 

Detailed Description

template<ServiceType S, typename Payload, typename UserHeader>
class iox2::Publisher< S, Payload, UserHeader >

Sending endpoint of a publish-subscriber based communication.

Definition at line 34 of file publisher.hpp.

Constructor & Destructor Documentation

◆ Publisher() [1/2]

template<ServiceType S, typename Payload , typename UserHeader >
iox2::Publisher< S, Payload, UserHeader >::Publisher ( Publisher< S, Payload, UserHeader > &&  rhs)
inlinenoexcept

Definition at line 128 of file publisher.hpp.

◆ ~Publisher()

template<ServiceType S, typename Payload , typename UserHeader >
iox2::Publisher< S, Payload, UserHeader >::~Publisher ( )
inline

Definition at line 144 of file publisher.hpp.

◆ Publisher() [2/2]

template<ServiceType S, typename Payload , typename UserHeader >
iox2::Publisher< S, Payload, UserHeader >::Publisher ( const Publisher< S, Payload, UserHeader > &  )
delete

Member Function Documentation

◆ backpressure_strategy()

template<ServiceType S, typename Payload , typename UserHeader >
auto iox2::Publisher< S, Payload, UserHeader >::backpressure_strategy ( ) const -> BackpressureStrategy
inline

Returns the strategy the [Publisher] follows when a [SampleMut] cannot be delivered since the [Subscriber]s buffer is full.

Definition at line 149 of file publisher.hpp.

◆ id()

template<ServiceType S, typename Payload , typename UserHeader >
auto iox2::Publisher< S, Payload, UserHeader >::id ( ) const -> UniquePublisherId
inline

Returns the [UniquePublisherId] of the [Publisher].

Definition at line 161 of file publisher.hpp.

◆ initial_max_slice_len()

template<ServiceType S, typename Payload , typename UserHeader >
template<typename T , typename >
auto iox2::Publisher< S, Payload, UserHeader >::initial_max_slice_len ( ) const -> uint64_t
inline

Returns the maximum number of elements that can be loaned in a slice.

Definition at line 156 of file publisher.hpp.

◆ loan()

template<ServiceType S, typename Payload , typename UserHeader >
template<typename T , typename >
auto iox2::Publisher< S, Payload, UserHeader >::loan ( ) -> bb::Expected<SampleMut<S, Payload, UserHeader>, LoanError>
inline

Loans/allocates a [SampleMut] from the underlying data segment of the [Publisher] and initialize it with the default value. This can be a performance hit and [Publisher::loan_uninit] can be used to loan an uninitalized [SampleMut].

On failure it returns [LoanError] describing the failure.

Definition at line 222 of file publisher.hpp.

References iox2::assume_init(), iox2::bb::err(), and iox2::Publisher< S, Payload, UserHeader >::loan_uninit().

◆ loan_slice()

template<ServiceType S, typename Payload , typename UserHeader >
template<typename T , typename >
auto iox2::Publisher< S, Payload, UserHeader >::loan_slice ( uint64_t  number_of_elements) -> bb::Expected<SampleMut<S, T, UserHeader>, LoanError>
inline

Loans/allocates a [SampleMut] from the underlying data segment of the [Publisher] and initializes all slice elements with the default value. This can be a performance hit and [Publisher::loan_slice_uninit()] can be used to loan a slice of uninitialized [Payload].

On failure it returns [LoanError] describing the failure.

Definition at line 236 of file publisher.hpp.

References iox2::assume_init(), iox2::bb::err(), and iox2::Publisher< S, Payload, UserHeader >::loan_slice_uninit().

◆ loan_slice_uninit()

template<ServiceType S, typename Payload , typename UserHeader >
template<typename T , typename >
auto iox2::Publisher< S, Payload, UserHeader >::loan_slice_uninit ( uint64_t  number_of_elements) -> bb::Expected<SampleMutUninit<S, T, UserHeader>, LoanError>
inline

Loans/allocates a [SampleMutUninit] from the underlying data segment of the [Publisher]. The user has to initialize the payload before it can be sent.

On failure it returns [LoanError] describing the failure.

Definition at line 254 of file publisher.hpp.

References iox2::bb::err(), and iox2::internal::PlacementDefault< T >::placement_default().

Referenced by iox2::Publisher< S, Payload, UserHeader >::loan_slice().

◆ loan_uninit()

template<ServiceType S, typename Payload , typename UserHeader >
template<typename T , typename >
auto iox2::Publisher< S, Payload, UserHeader >::loan_uninit ( ) -> bb::Expected<SampleMutUninit<S, Payload, UserHeader>, LoanError>
inline

Loans/allocates a [SampleMutUninit] from the underlying data segment of the [Publisher]. The user has to initialize the payload before it can be sent.

On failure it returns [LoanError] describing the failure.

Definition at line 206 of file publisher.hpp.

References iox2::bb::err(), and iox2::internal::PlacementDefault< T >::placement_default().

Referenced by iox2::Publisher< S, Payload, UserHeader >::loan().

◆ operator=() [1/2]

template<ServiceType S, typename Payload , typename UserHeader >
auto iox2::Publisher< S, Payload, UserHeader >::operator= ( const Publisher< S, Payload, UserHeader > &  ) -> Publisher &=delete
delete

◆ operator=() [2/2]

template<ServiceType S, typename Payload , typename UserHeader >
auto iox2::Publisher< S, Payload, UserHeader >::operator= ( Publisher< S, Payload, UserHeader > &&  rhs) -> Publisher&
inlinenoexcept

Definition at line 133 of file publisher.hpp.

◆ send_copy()

template<ServiceType S, typename Payload , typename UserHeader >
template<typename T , typename >
auto iox2::Publisher< S, Payload, UserHeader >::send_copy ( const Payload &  payload) const -> bb::Expected<size_t, SendError>
inline

Copies the input value into a [SampleMut] and delivers it. On success it returns the number of [Subscriber]s that received the data, otherwise a [SendError] describing the failure.

Definition at line 170 of file publisher.hpp.

References iox2::bb::err().

◆ send_slice_copy()

template<ServiceType S, typename Payload , typename UserHeader >
template<typename T , typename >
auto iox2::Publisher< S, Payload, UserHeader >::send_slice_copy ( bb::ImmutableSlice< ValueType > &  payload) const -> bb::Expected<size_t, SendError>
inline

Definition at line 188 of file publisher.hpp.

References iox2::bb::err().

◆ update_connections()

template<ServiceType S, typename Payload , typename UserHeader >
auto iox2::Publisher< S, Payload, UserHeader >::update_connections ( ) -> bb::Expected<void, ConnectionFailure>
inline

Explicitly updates all connections to the [Subscriber]s. This is required to be called whenever a new [Subscriber] is connected to the service. It is called implicitly whenever [SampleMut::send()] or [Publisher::send_copy()] is called. When a [Subscriber] is connected that requires a history this call will deliver it.

Definition at line 270 of file publisher.hpp.

References iox2::bb::err().

Friends And Related Symbol Documentation

◆ PortFactoryPublisher

template<ServiceType S, typename Payload , typename UserHeader >
template<ServiceType , typename , typename >
friend class PortFactoryPublisher
friend

Definition at line 106 of file publisher.hpp.


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