RTI Connext Traditional C++ API  Version 6.0.0
 All Classes Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
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.
 
 WriteSampleRef (T &data, WriteParams_t &wparams)
 Creates an object with a reference to a data object.
 
 WriteSampleRef (WriteSample< T > &ws)
 Copies the references to data and params.
 
T & data () const
 Gets the data this sample contains.
 
WriteParams_tinfo () const
 Gets the write parameters.
 
void set_data (T &data)
 Sets a reference to the data to be written.
 
void set_info (WriteParams_t &info)
 Copies the new parameters, overwriting the existing ones.
 
bool is_nil_data () const
 Indicates if this WriteSampleRef contains a reference to data or not.
 
SampleIdentity_t identity () const
 Gets the identity of this sample.
 

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

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

Creates an object with no data.

See Also
set_data
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
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

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()

Referenced by connext::WriteSampleRef< T >::set_data().

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()

Referenced by connext::WriteSampleRef< T >::identity(), and connext::WriteSampleRef< T >::set_info().

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::WriteSampleRef< T >::data().

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

Copies the new parameters, overwriting the existing ones.

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

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
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 DDS_WriteParams_t::identity, and connext::WriteSampleRef< T >::info().


RTI Connext Traditional C++ API Version 6.0.0 Copyright © Sun Mar 3 2019 Real-Time Innovations, Inc