RTI Connext Modern C++ API  Version 6.0.1
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
dds::sub::Sample< T > Class Template Reference

<<value-type>> This class encapsulate the data and meta-data associated with DDS samples. More...

#include "dds/sub/Sample.hpp"

Public Member Functions

 Sample ()
 Create a sample.
 
 Sample (const T &the_data, const SampleInfo &the_info)
 Create a Sample with the provided data and SampleInfo.
 
 Sample (const rti::sub::LoanedSample< T > &loaned_sample)
 <<extension>> Construct a Sample from a LoanedSample
 
 Sample (const Sample &other)
 Copy Constructor.
 
const DataType & data () const
 Get the data of type T associated with this Sample.
 
void data (const DataType &the_data)
 Set the data of type T associated with this Sample.
 
const SampleInfoinfo () const
 Get the SampleInfo associated with this Sample.
 
void info (const SampleInfo &the_info)
 Set the SampleInfo associated with this Sample.
 
Sampleoperator= (const rti::sub::LoanedSample< T > &loaned_sample)
 <<extension>> Assignment operator from an rti::sub::LoanedSample
 

Detailed Description

template<typename T>
class dds::sub::Sample< T >

<<value-type>> This class encapsulate the data and meta-data associated with DDS samples.

Template Parameters
Thetype of the data that Sample represents

Constructor & Destructor Documentation

template<typename T >
dds::sub::Sample< T >::Sample ( )
inline

Create a sample.

Postcondition
The value of data() is default-constructed, and info().valid() is false.
template<typename T >
dds::sub::Sample< T >::Sample ( const T &  the_data,
const SampleInfo the_info 
)
inline

Create a Sample with the provided data and SampleInfo.

Parameters
the_dataThe data to create the Sample with
the_infoThe SampleInfo to create the Sample with
template<typename T >
dds::sub::Sample< T >::Sample ( const rti::sub::LoanedSample< T > &  loaned_sample)
inlineexplicit

<<extension>> Construct a Sample from a LoanedSample

If loaned_sample.info().valid() is false, this sample's data value is default-constructed.

template<typename T >
dds::sub::Sample< T >::Sample ( const Sample< T > &  other)
inline

Copy Constructor.

Member Function Documentation

template<typename T >
const DataType& dds::sub::Sample< T >::data ( ) const
inline

Get the data of type T associated with this Sample.

This function returns the current value of the data even if info().valid() is false.

template<typename T >
void dds::sub::Sample< T >::data ( const DataType &  the_data)
inline

Set the data of type T associated with this Sample.

template<typename T >
const SampleInfo& dds::sub::Sample< T >::info ( ) const
inline

Get the SampleInfo associated with this Sample.

template<typename T >
void dds::sub::Sample< T >::info ( const SampleInfo the_info)
inline

Set the SampleInfo associated with this Sample.

template<typename T >
Sample& dds::sub::Sample< T >::operator= ( const rti::sub::LoanedSample< T > &  loaned_sample)
inline

<<extension>> Assignment operator from an rti::sub::LoanedSample

This operator allows obtaining a copy of both the data and the info from a LoanedSample.

Postcondition
If loaned_sample.info().valid() is false, this sample's data() value is not modified, but info().valid() is false.

RTI Connext Modern C++ API Version 6.0.1 Copyright © Sat Nov 23 2019 Real-Time Innovations, Inc