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

#include <sample_mut.hpp>

Public Member Functions

 SampleMut (SampleMut &&rhs) noexcept
auto operator= (SampleMut &&rhs) noexcept -> SampleMut &
 ~SampleMut () noexcept
 SampleMut (const SampleMut &)=delete
auto operator= (const SampleMut &) -> SampleMut &=delete
auto header () const -> HeaderPublishSubscribe
 Returns a reference to the [Header] of the [Sample].
template<typename T = UserHeader, typename = std::enable_if_t<!std::is_same<void, UserHeader>::value, T>>
auto user_header () const -> const T &
 Returns a reference to the user_header of the [Sample].
template<typename T = UserHeader, typename = std::enable_if_t<!std::is_same<void, UserHeader>::value, T>>
auto user_header_mut () -> T &
 Returns a mutable reference to the user_header of the [Sample].
template<typename T = Payload, typename = std::enable_if_t<!bb::IsSlice<T>::VALUE && !has_flatbuffer_marker<T>(), void>>
auto payload () const -> const ValueType &
 Returns a reference to the const payload of the sample.
template<typename T = Payload, typename = std::enable_if_t<!bb::IsSlice<T>::VALUE && !has_flatbuffer_marker<T>(), void>>
auto payload_mut () -> ValueType &
 Returns a reference to the payload of the sample.
template<typename T = Payload, typename = std::enable_if_t<has_flatbuffer_marker<T>(), void>>
auto payload_bytes () const -> bb::ImmutableSlice< uint8_t >
 Returns the serialized flatbuffer data as bytes.
template<typename T = Payload, typename = std::enable_if_t<has_flatbuffer_marker<T>(), void>>
auto payload_root () const -> const typename T::ValueType *
 Returns the root of the flatbuffer.
template<typename T = Payload, typename = std::enable_if_t<bb::IsSlice<T>::VALUE, void>>
auto payload () const -> bb::ImmutableSlice< ValueType >
 Returns an immutable slice to the payload of the sample.
template<typename T = Payload, typename = std::enable_if_t<bb::IsSlice<T>::VALUE, void>>
auto payload_mut () -> bb::MutableSlice< ValueType >
 Returns a mutable slice to the payload of the sample.
template<typename T = Payload, typename = std::enable_if_t<bb::IsSlice<T>::VALUE, void>>
void truncate (uint64_t number_of_elements)

Friends

template<ServiceType, typename, typename>
class Publisher
template<ServiceType, typename, typename>
class SampleMutUninit
template<ServiceType ST, typename PayloadT, typename UserHeaderT>
auto send (SampleMut< ST, PayloadT, UserHeaderT > &&sample) -> bb::Expected< size_t, SendError >

Detailed Description

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

Acquired by a [Publisher] via

It stores the payload that will be sent to all connected [Subscriber]s. If the [SampleMut] is not sent it will release the loaned memory when going out of scope.

Notes

Does not implement [Send] since it releases unsent samples in the [Publisher] and the [Publisher] is not thread-safe!

Important

DO NOT MOVE THE SAMPLE INTO ANOTHER THREAD!

Definition at line 54 of file sample_mut.hpp.

Constructor & Destructor Documentation

◆ SampleMut() [1/2]

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

Definition at line 138 of file sample_mut.hpp.

References SampleMut().

Referenced by operator=(), operator=(), SampleMut(), SampleMut(), and send.

◆ ~SampleMut()

template<ServiceType S, typename Payload, typename UserHeader>
iox2::SampleMut< S, Payload, UserHeader >::~SampleMut ( )
inlinenoexcept

Definition at line 161 of file sample_mut.hpp.

◆ SampleMut() [2/2]

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

References SampleMut().

Member Function Documentation

◆ header()

template<ServiceType S, typename Payload, typename UserHeader>
auto iox2::SampleMut< S, Payload, UserHeader >::header ( ) const->HeaderPublishSubscribe
inline

Returns a reference to the [Header] of the [Sample].

Definition at line 166 of file sample_mut.hpp.

Referenced by payload_bytes().

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

Definition at line 149 of file sample_mut.hpp.

References iox2::internal::iox2_sample_mut_move(), and SampleMut().

◆ payload() [1/2]

template<ServiceType S, typename Payload, typename UserHeader>
template<typename T, typename>
auto iox2::SampleMut< S, Payload, UserHeader >::payload ( ) const->bb::ImmutableSlice< ValueType >
inline

Returns an immutable slice to the payload of the sample.

Definition at line 215 of file sample_mut.hpp.

◆ payload() [2/2]

template<ServiceType S, typename Payload, typename UserHeader>
template<typename T, typename>
auto iox2::SampleMut< S, Payload, UserHeader >::payload ( ) const->constValueType &
inline

Returns a reference to the const payload of the sample.

Definition at line 195 of file sample_mut.hpp.

Referenced by operator=().

◆ payload_bytes()

template<ServiceType S, typename Payload, typename UserHeader>
template<typename T, typename>
auto iox2::SampleMut< S, Payload, UserHeader >::payload_bytes ( ) const->bb::ImmutableSlice< uint8_t >
inline

Returns the serialized flatbuffer data as bytes.

Definition at line 257 of file sample_mut.hpp.

References header().

Referenced by payload_root().

◆ payload_mut() [1/2]

template<ServiceType S, typename Payload, typename UserHeader>
template<typename T, typename>
auto iox2::SampleMut< S, Payload, UserHeader >::payload_mut ( ) ->bb::MutableSlice< ValueType >
inline

Returns a mutable slice to the payload of the sample.

Definition at line 233 of file sample_mut.hpp.

◆ payload_mut() [2/2]

template<ServiceType S, typename Payload, typename UserHeader>
template<typename T, typename>
auto iox2::SampleMut< S, Payload, UserHeader >::payload_mut ( ) ->ValueType &
inline

Returns a reference to the payload of the sample.

Definition at line 205 of file sample_mut.hpp.

Referenced by operator=().

◆ payload_root()

template<ServiceType S, typename Payload, typename UserHeader>
template<typename T, typename>
auto iox2::SampleMut< S, Payload, UserHeader >::payload_root ( ) const->consttypenameT::ValueType *

Returns the root of the flatbuffer.

Definition at line 270 of file sample_mut.hpp.

References payload_bytes().

Referenced by operator=().

◆ truncate()

template<ServiceType S, typename Payload, typename UserHeader>
template<typename T, typename>
void iox2::SampleMut< S, Payload, UserHeader >::truncate ( uint64_t number_of_elements)
inline

Shortens the payload to its first number_of_elements elements, so that only those are sent. It has no effect when number_of_elements is not smaller than the current number of elements.

Definition at line 249 of file sample_mut.hpp.

Referenced by operator=().

◆ user_header()

template<ServiceType S, typename Payload, typename UserHeader>
template<typename T, typename>
auto iox2::SampleMut< S, Payload, UserHeader >::user_header ( ) const->constT &
inline

Returns a reference to the user_header of the [Sample].

Definition at line 175 of file sample_mut.hpp.

Referenced by operator=().

◆ user_header_mut()

template<ServiceType S, typename Payload, typename UserHeader>
template<typename T, typename>
auto iox2::SampleMut< S, Payload, UserHeader >::user_header_mut ( ) ->T &
inline

Returns a mutable reference to the user_header of the [Sample].

Definition at line 185 of file sample_mut.hpp.

Referenced by operator=().

◆ Publisher

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

Definition at line 111 of file sample_mut.hpp.

References Publisher.

Referenced by Publisher.

◆ SampleMutUninit

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

Definition at line 113 of file sample_mut.hpp.

References SampleMutUninit.

Referenced by SampleMutUninit.

◆ send

template<ServiceType S, typename Payload, typename UserHeader>
template<ServiceType ST, typename PayloadT, typename UserHeaderT>
auto send ( SampleMut< ST, PayloadT, UserHeaderT > && sample) ->bb::Expected< size_t, SendError >
friend

References SampleMut(), and send.

Referenced by send.


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