iceoryx_doc  1.0.1
Public Types | Public Member Functions | Friends | List of all members
iox::popo::Sample< T, H > Class Template Reference

The Sample class is a mutable abstraction over types which are written to loaned shared memory. These samples are publishable to the iceoryx system. More...

#include <sample.hpp>

Public Types

using ConditionalConstChunkHeader_t = cxx::add_const_conditionally_t< mepoo::ChunkHeader, T >
 Helper type to ensure the access to the ChunkHeader has the same const qualifier as the access to the sample data.
 

Public Member Functions

template<typename S = T, typename = ForPublisherOnly<S, T>>
 Sample (cxx::unique_ptr< T > &&sampleUniquePtr, PublisherInterface< T, H > &publisher) noexcept
 Constructor for a Sample used by the Publisher. More...
 
template<typename S = T, typename = ForSubscriberOnly<S, T>>
 Sample (cxx::unique_ptr< T > &&sampleUniquePtr) noexcept
 Constructor for a Sample used by the Subscriber. More...
 
Sample< T, H > & operator= (Sample< T, H > &&rhs) noexcept=default
 
 Sample (Sample< T, H > &&rhs) noexcept=default
 
 Sample (const Sample< T, H > &)=delete
 
Sample< T, H > & operator= (const Sample< T, H > &)=delete
 
T * operator-> () noexcept
 Transparent access to the encapsulated type. More...
 
const T * operator-> () const noexcept
 Transparent read-only access to the encapsulated type. More...
 
T & operator* () noexcept
 Provides a reference to the encapsulated type. More...
 
const T & operator* () const noexcept
 Provides a const reference to the encapsulated type. More...
 
 operator bool () const noexcept
 Indicates whether the sample is valid, i.e. refers to allocated memory. More...
 
T * get () noexcept
 Mutable access to the encapsulated type loaned to the sample. More...
 
const T * get () const noexcept
 Read-only access to the encapsulated type loaned to the sample. More...
 
ConditionalConstChunkHeader_tgetChunkHeader () noexcept
 Retrieve the ChunkHeader of the underlying memory chunk loaned to the sample. More...
 
const mepoo::ChunkHeadergetChunkHeader () const noexcept
 Retrieve the ChunkHeader of the underlying memory chunk loaned to the sample. More...
 
template<typename R = H, typename = HasUserHeader<R, H>>
R & getUserHeader () noexcept
 Retrieve the user-header of the underlying memory chunk loaned to the sample. More...
 
template<typename R = H, typename = HasUserHeader<R, H>>
const R & getUserHeader () const noexcept
 Retrieve the user-header of the underlying memory chunk loaned to the sample. More...
 
template<typename S = T, typename = ForPublisherOnly<S, T>>
void publish () noexcept
 Publish the sample via the publisher from which it was loaned and automatically release ownership to it. More...
 

Friends

template<typename , typename , typename >
class PublisherImpl
 

Detailed Description

template<typename T, typename H = cxx::add_const_conditionally_t<mepoo::NoUserHeader, T>>
class iox::popo::Sample< T, H >

The Sample class is a mutable abstraction over types which are written to loaned shared memory. These samples are publishable to the iceoryx system.

Constructor & Destructor Documentation

◆ Sample() [1/2]

template<typename T , typename H >
template<typename S , typename >
iox::popo::Sample< T, H >::Sample ( cxx::unique_ptr< T > &&  sampleUniquePtr,
PublisherInterface< T, H > &  publisher 
)
inlinenoexcept

Constructor for a Sample used by the Publisher.

Template Parameters
Sis a dummy template parameter to enable the constructor only for non-const T
Parameters
sampleUniquePtris a rvalue to a cxx::unique_ptr<T> with to the data of the encapsulated type T
publisheris a reference to the publisher to be able to use the publish and release methods

◆ Sample() [2/2]

template<typename T , typename H >
template<typename S , typename >
iox::popo::Sample< T, H >::Sample ( cxx::unique_ptr< T > &&  sampleUniquePtr)
inlinenoexcept

Constructor for a Sample used by the Subscriber.

Template Parameters
Sis a dummy template parameter to enable the constructor only for const T
Parameters
sampleUniquePtris a rvalue to a cxx::unique_ptr<T> with to the data of the encapsulated type T

Member Function Documentation

◆ get() [1/2]

template<typename T , typename H >
const T * iox::popo::Sample< T, H >::get
inlinenoexcept

Read-only access to the encapsulated type loaned to the sample.

Returns
a const pointer to the encapsulated type.

◆ get() [2/2]

template<typename T , typename H >
T * iox::popo::Sample< T, H >::get
inlinenoexcept

Mutable access to the encapsulated type loaned to the sample.

Returns
a pointer to the encapsulated type.

◆ getChunkHeader() [1/2]

template<typename T , typename H >
const mepoo::ChunkHeader * iox::popo::Sample< T, H >::getChunkHeader
inlinenoexcept

Retrieve the ChunkHeader of the underlying memory chunk loaned to the sample.

Returns
The const ChunkHeader of the underlying memory chunk.

◆ getChunkHeader() [2/2]

template<typename T , typename H >
Sample< T, H >::ConditionalConstChunkHeader_t * iox::popo::Sample< T, H >::getChunkHeader
inlinenoexcept

Retrieve the ChunkHeader of the underlying memory chunk loaned to the sample.

Returns
The ChunkHeader of the underlying memory chunk.

◆ getUserHeader() [1/2]

template<typename T , typename H >
template<typename R , typename >
const R & iox::popo::Sample< T, H >::getUserHeader
inlinenoexcept

Retrieve the user-header of the underlying memory chunk loaned to the sample.

Returns
The user-header of the underlying memory chunk.

◆ getUserHeader() [2/2]

template<typename T , typename H >
template<typename R , typename >
R & iox::popo::Sample< T, H >::getUserHeader
inlinenoexcept

Retrieve the user-header of the underlying memory chunk loaned to the sample.

Returns
The user-header of the underlying memory chunk.

◆ operator bool()

template<typename T , typename H >
iox::popo::Sample< T, H >::operator bool
inlinenoexcept

Indicates whether the sample is valid, i.e. refers to allocated memory.

Returns
true if the sample is valid, false otherwise.

◆ operator*() [1/2]

template<typename T , typename H >
const T & iox::popo::Sample< T, H >::operator*
inlinenoexcept

Provides a const reference to the encapsulated type.

Returns
A const T& to the encapsulated type.

◆ operator*() [2/2]

template<typename T , typename H >
T & iox::popo::Sample< T, H >::operator*
inlinenoexcept

Provides a reference to the encapsulated type.

Returns
A T& to the encapsulated type.

◆ operator->() [1/2]

template<typename T , typename H >
const T * iox::popo::Sample< T, H >::operator->
inlinenoexcept

Transparent read-only access to the encapsulated type.

Returns
a const pointer to the encapsulated type.

◆ operator->() [2/2]

template<typename T , typename H >
T * iox::popo::Sample< T, H >::operator->
inlinenoexcept

Transparent access to the encapsulated type.

Returns
a pointer to the encapsulated type.

◆ publish()

template<typename T , typename H >
template<typename S , typename >
void iox::popo::Sample< T, H >::publish
inlinenoexcept

Publish the sample via the publisher from which it was loaned and automatically release ownership to it.

Only available for non-const type T.


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