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

#include <sample.hpp>

Public Member Functions

 Sample (Sample &&rhs) noexcept
auto operator= (Sample &&rhs) noexcept -> Sample &
 ~Sample ()
 Sample (const Sample &)=delete
auto operator= (const Sample &) -> Sample &=delete
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 payload of the [Sample].
template<typename T = Payload, typename = std::enable_if_t<bb::IsSlice<T>::VALUE, void>>
auto payload () const -> bb::ImmutableSlice< ValueType >
 Returns a slice to navigate 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 = 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].
auto header () const -> HeaderPublishSubscribe
 Returns a reference to the [Header] of the [Sample].
auto origin () const -> UniquePublisherId
 Returns the [UniquePublisherId] of the [Publisher](crate::port::publisher::Publisher).

Friends

template<ServiceType, typename, typename>
class Subscriber

Detailed Description

template<ServiceType, typename Payload, typename UserHeader>
class iox2::Sample< ServiceType, Payload, UserHeader >

It stores the payload and is acquired by the [Subscriber] whenever it receives new data from a [Publisher] via [Subscriber::receive()].

Notes

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

Important

DO NOT MOVE THE SAMPLE INTO ANOTHER THREAD!

Definition at line 47 of file sample.hpp.

Constructor & Destructor Documentation

◆ Sample() [1/2]

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

Definition at line 109 of file sample.hpp.

References Sample().

Referenced by operator=(), operator=(), Sample(), Sample(), and Subscriber.

◆ ~Sample()

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

Definition at line 132 of file sample.hpp.

◆ Sample() [2/2]

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

References Sample().

Member Function Documentation

◆ header()

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

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

Definition at line 198 of file sample.hpp.

Referenced by operator=(), origin(), and payload_bytes().

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

Definition at line 120 of file sample.hpp.

References iox2::internal::iox2_sample_move(), and Sample().

◆ origin()

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

Returns the [UniquePublisherId] of the [Publisher](crate::port::publisher::Publisher).

Definition at line 206 of file sample.hpp.

References header().

Referenced by operator=().

◆ payload() [1/2]

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

Returns a slice to navigate the payload of the [Sample].

Definition at line 148 of file sample.hpp.

◆ payload() [2/2]

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

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

Definition at line 138 of file sample.hpp.

Referenced by operator=().

◆ payload_bytes()

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

Returns the serialized flatbuffer data as bytes.

Definition at line 168 of file sample.hpp.

References header().

Referenced by payload_root().

◆ payload_root()

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

Returns the root of the flatbuffer.

Definition at line 181 of file sample.hpp.

References payload_bytes().

Referenced by operator=().

◆ user_header()

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

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

Definition at line 189 of file sample.hpp.

◆ Subscriber

template<ServiceType, typename Payload, typename UserHeader>
template<ServiceType, typename, typename>
friend class Subscriber
friend

Definition at line 89 of file sample.hpp.

References Sample(), and Subscriber.

Referenced by Subscriber.


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