iox::popo::Sample🔗
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🔗
| Name | |
|---|---|
| using cxx::add_const_conditionally_t< mepoo::ChunkHeader, T > | ConditionalConstChunkHeader_t Helper type to ensure the access to the ChunkHeader has the same const qualifier as the access to the sample data. | 
Public Functions🔗
| Name | |
|---|---|
| template \<typename S  =T,typename  =ForPublisherOnly | Sample(cxx::unique_ptr< T > && sampleUniquePtr, PublisherInterface< T, H > & publisher) Constructor for a Sample used by the Publisher. | 
| template \<typename S  =T,typename  =ForSubscriberOnly | Sample(cxx::unique_ptr< T > && sampleUniquePtr) Constructor for a Sample used by the Subscriber. | 
| ~Sample() =default | |
| Sample< T, H > & | operator=(Sample< T, H > && rhs) =default | 
| Sample(Sample< T, H > && rhs) =default | |
| Sample(const Sample< T, H > & ) | |
| Sample< T, H > & | operator=(const Sample< T, H > & ) | 
| T * | operator->() Transparent access to the encapsulated type. | 
| const T * | operator->() const Transparent read-only access to the encapsulated type. | 
| T & | operator*() Provides a reference to the encapsulated type. | 
| const T & | operator*() const Provides a const reference to the encapsulated type. | 
| operator bool() const Indicates whether the sample is valid, i.e. refers to allocated memory. | |
| T * | get() Mutable access to the encapsulated type loaned to the sample. | 
| const T * | get() const Read-only access to the encapsulated type loaned to the sample. | 
| ConditionalConstChunkHeader_t * | getChunkHeader() Retrieve the ChunkHeader of the underlying memory chunk loaned to the sample. | 
| const mepoo::ChunkHeader * | getChunkHeader() const Retrieve the ChunkHeader of the underlying memory chunk loaned to the sample. | 
| template \<typename R  =H,typename  =HasUserHeader R & | getUserHeader() Retrieve the user-header of the underlying memory chunk loaned to the sample. | 
| template \<typename R  =H,typename  =HasUserHeader const R & | getUserHeader() const Retrieve the user-header of the underlying memory chunk loaned to the sample. | 
| template \<typename S  =T,typename  =ForPublisherOnly void | publish() Publish the sample via the publisher from which it was loaned and automatically release ownership to it. | 
Friends🔗
| Name | |
|---|---|
| class | PublisherImpl | 
Detailed Description🔗
template <typename T ,
typename H  =cxx::add_const_conditionally_t<mepoo::NoUserHeader, T>>
class iox::popo::Sample;
The Sample class is a mutable abstraction over types which are written to loaned shared memory. These samples are publishable to the iceoryx system.
Public Types Documentation🔗
using ConditionalConstChunkHeader_t🔗
using iox::popo::Sample< T, H >::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 Functions Documentation🔗
function Sample🔗
template <typename S  =T,
typename  =ForPublisherOnly<S, T>>
inline Sample(
    cxx::unique_ptr< T > && sampleUniquePtr,
    PublisherInterface< T, H > & publisher
)
Constructor for a Sample used by the Publisher.
Parameters:
- sampleUniquePtr is a rvalueto acxx::unique_ptr<T>with to the data of the encapsulated type T
- publisher is a reference to the publisher to be able to use the publishandreleasemethods
Template Parameters:
- S is a dummy template parameter to enable the constructor only for non-const T
function Sample🔗
template <typename S  =T,
typename  =ForSubscriberOnly<S, T>>
inline Sample(
    cxx::unique_ptr< T > && sampleUniquePtr
)
Constructor for a Sample used by the Subscriber.
Parameters:
- sampleUniquePtr is a rvalueto acxx::unique_ptr<T>with to the data of the encapsulated type T
Template Parameters:
- S is a dummy template parameter to enable the constructor only for const T
function ~Sample🔗
~Sample() =default
function operator=🔗
Sample< T, H > & operator=(
    Sample< T, H > && rhs
) =default
function Sample🔗
Sample(
    Sample< T, H > && rhs
) =default
function Sample🔗
Sample(
    const Sample< T, H > & 
)
function operator=🔗
Sample< T, H > & operator=(
    const Sample< T, H > & 
)
function operator->🔗
inline T * operator->()
Transparent access to the encapsulated type.
Return: a pointer to the encapsulated type.
function operator->🔗
const T * operator->() const
Transparent read-only access to the encapsulated type.
Return: a const pointer to the encapsulated type.
function operator*🔗
inline T & operator*()
Provides a reference to the encapsulated type.
Return: A T& to the encapsulated type.
function operator*🔗
const T & operator*() const
Provides a const reference to the encapsulated type.
Return: A const T& to the encapsulated type.
function operator bool🔗
inline operator bool() const
Indicates whether the sample is valid, i.e. refers to allocated memory.
Return: true if the sample is valid, false otherwise.
function get🔗
inline T * get()
Mutable access to the encapsulated type loaned to the sample.
Return: a pointer to the encapsulated type.
function get🔗
const T * get() const
Read-only access to the encapsulated type loaned to the sample.
Return: a const pointer to the encapsulated type.
function getChunkHeader🔗
inline ConditionalConstChunkHeader_t * getChunkHeader()
Retrieve the ChunkHeader of the underlying memory chunk loaned to the sample.
Return: The ChunkHeader of the underlying memory chunk.
function getChunkHeader🔗
const mepoo::ChunkHeader * getChunkHeader() const
Retrieve the ChunkHeader of the underlying memory chunk loaned to the sample.
Return: The const ChunkHeader of the underlying memory chunk.
function getUserHeader🔗
template <typename R  =H,
typename  =HasUserHeader<R, H>>
inline R & getUserHeader()
Retrieve the user-header of the underlying memory chunk loaned to the sample.
Return: The user-header of the underlying memory chunk.
function getUserHeader🔗
template <typename R  =H,
typename  =HasUserHeader<R, H>>
inline const R & getUserHeader() const
Retrieve the user-header of the underlying memory chunk loaned to the sample.
Return: The user-header of the underlying memory chunk.
function publish🔗
template <typename S  =T,
typename  =ForPublisherOnly<S, T>>
inline void publish()
Publish the sample via the publisher from which it was loaned and automatically release ownership to it.
Only available for non-const type T.
Friends🔗
friend PublisherImpl🔗
friend class PublisherImpl;
Updated on 31 May 2022 at 15:29:16 CEST