iceoryx2
C++ 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 name () const -> PortNameView
 Returns the [PortNameView] 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.
auto max_loaned_samples () const -> uint64_t
 Returns the maximum number of [SampleMut] that can be loaned in parallel.
template<typename T = Payload, typename = std::enable_if_t<bb::IsSlice<T>::VALUE, void>>
auto allocation_strategy () const -> AllocationStrategy
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<has_flatbuffer_marker<T>(), void>>
auto loan_flatbuffer () -> bb::Expected< SampleMutUninit< S, Payload, UserHeader >, LoanError >
 Acquires a [SampleMutUninit] with an integrated flatbuffer builder.
template<typename T = Payload, typename = std::enable_if_t<!bb::IsSlice<T>::VALUE && !has_flatbuffer_marker<T>(), void>>
auto loan_uninit () -> bb::Expected< SampleMutUninit< S, Payload, UserHeader >, LoanError >
template<typename T = Payload, typename = std::enable_if_t<!bb::IsSlice<T>::VALUE && !has_flatbuffer_marker<T>(), 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 40 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 156 of file publisher.hpp.

References Publisher().

Referenced by operator=(), operator=(), Publisher(), and Publisher().

◆ ~Publisher()

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

Definition at line 172 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

References Publisher().

Member Function Documentation

◆ allocation_strategy()

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

Returns the [AllocationStrategy] that is used when the provided [Publisher] loans a slice bigger than the initial maximum slice length.

Definition at line 195 of file publisher.hpp.

References iox2::bb::into().

Referenced by operator=().

◆ 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 177 of file publisher.hpp.

References iox2::bb::into().

Referenced by operator=().

◆ 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 200 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 184 of file publisher.hpp.

Referenced by operator=().

◆ 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 uninitialized [SampleMut].

On failure it returns [LoanError] describing the failure.

Definition at line 295 of file publisher.hpp.

References iox2::assume_init(), iox2::bb::err(), and iox2::loan_uninit().

◆ loan_flatbuffer()

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

Acquires a [SampleMutUninit] with an integrated flatbuffer builder.

Definition at line 253 of file publisher.hpp.

References iox2::bb::err(), iox2::bb::into(), and iox2::internal::ResizableMemoryPublishSubscribe< Service >::len().

◆ 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 309 of file publisher.hpp.

References iox2::assume_init(), iox2::bb::err(), and 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 327 of file publisher.hpp.

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

Referenced by 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 279 of file publisher.hpp.

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

◆ max_loaned_samples()

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

Returns the maximum number of [SampleMut] that can be loaned in parallel.

Definition at line 189 of file publisher.hpp.

Referenced by operator=().

◆ name()

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

Returns the [PortNameView] of the [Publisher].

Definition at line 208 of file publisher.hpp.

References iox2::PortNameView::from_native_ptr().

Referenced by operator=().

◆ 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 161 of file publisher.hpp.

References Publisher().

◆ 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 215 of file publisher.hpp.

References iox2::bb::err(), and iox2::bb::into().

Referenced by operator=().

◆ 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

Copies the input payload slice 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 233 of file publisher.hpp.

References iox2::bb::err(), and iox2::bb::into().

Referenced by operator=().

◆ 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 343 of file publisher.hpp.

References iox2::bb::err(), and iox2::bb::into().

◆ PortFactoryPublisher

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

Definition at line 134 of file publisher.hpp.

References PortFactoryPublisher.

Referenced by PortFactoryPublisher.


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