RTI Connext Traditional C++ API  Version 6.1.2
connext::WriteSampleRef< T > Class Template Reference

A reference to a data sample for writing. More...

Public Member Functions

 WriteSampleRef ()
 Creates an object with no data. More...
 
 WriteSampleRef (T &data, WriteParams_t &wparams)
 Creates an object with a reference to a data object. More...
 
 WriteSampleRef (WriteSample< T > &ws)
 Copies the references to data and params. More...
 
T & data () const
 Gets the data this sample contains. More...
 
WriteParams_tinfo () const
 Gets the write parameters. More...
 
void set_data (T &data)
 Sets a reference to the data to be written. More...
 
void set_info (WriteParams_t &info)
 Copies the new parameters, overwriting the existing ones. More...
 
bool is_nil_data () const
 Indicates if this WriteSampleRef contains a reference to data or not. More...
 
SampleIdentity_t identity () const
 Gets the identity of this sample. More...
 

Detailed Description

template<typename T>
class connext::WriteSampleRef< T >

A reference to a data sample for writing.

A WriteSampleRef can be used much like a connext::WriteSample, but it's different in that it holds references to data and write parameters, which need to be explicitly set to existing objects, whereas WriteSample is a value type and it owns its data and info.

Template Parameters
TThe data type that this sample can contain

Constructor & Destructor Documentation

◆ WriteSampleRef() [1/3]

template<typename T>
connext::WriteSampleRef< T >::WriteSampleRef ( )
inline

Creates an object with no data.

See also
set_data

◆ WriteSampleRef() [2/3]

template<typename T>
connext::WriteSampleRef< T >::WriteSampleRef ( T &  data,
WriteParams_t wparams 
)
inline

Creates an object with a reference to a data object.

See also
set_data

◆ WriteSampleRef() [3/3]

template<typename T>
connext::WriteSampleRef< T >::WriteSampleRef ( WriteSample< T > &  ws)
inline

Copies the references to data and params.

After this operation, this object contains a reference to the same data and WriteParams instances as the source.

Member Function Documentation

◆ data()

template<typename T>
T& connext::WriteSampleRef< T >::data ( ) const
inline

Gets the data this sample contains.

Precondition
Data must have been set before
See also
set_data
connext::WriteSample::data()

◆ info()

template<typename T>
WriteParams_t& connext::WriteSampleRef< T >::info ( ) const
inline

Gets the write parameters.

Precondition
The info object must have been set
See also
set_info()
connext::WriteSample::identity()

◆ set_data()

template<typename T>
void connext::WriteSampleRef< T >::set_data ( T &  data)
inline

Sets a reference to the data to be written.

Assigns a reference to the

Parameters
dataThe data this sample will hold a reference to

References connext::Sample< T >::data().

◆ set_info()

template<typename T>
void connext::WriteSampleRef< T >::set_info ( WriteParams_t info)
inline

Copies the new parameters, overwriting the existing ones.

References connext::Sample< T >::info().

◆ is_nil_data()

template<typename T>
bool connext::WriteSampleRef< T >::is_nil_data ( ) const
inline

Indicates if this WriteSampleRef contains a reference to data or not.

Returns
True if this sample does not contain a reference to data.
See also
data()
set_data

◆ identity()

template<typename T>
SampleIdentity_t connext::WriteSampleRef< T >::identity ( ) const
inline

Gets the identity of this sample.

Precondition
The info object must have been set
See also
set_info()
connext::WriteSample::identity()

References connext::Sample< T >::data(), connext::Sample< T >::identity(), and connext::Sample< T >::info().