RTI Connext Traditional C++ API  Version 6.1.0
connext::WriteSample< T > Class Template Reference

A sample for writing data. More...

Inherits connext::details::SampleBase< T, I >.

Public Member Functions

 WriteSample ()
 Creates a sample with default data and info values. More...
 
 WriteSample (const WriteSample< T > &other)
 Creates a sample making a deep copy of another sample. More...
 
 WriteSample (const T &data)
 Creates a sample making a deep copy of another sample. More...
 
 WriteSample (WriteSampleRef< T > wsref)
 Creates a sample deep copying the data and info the source references. More...
 
T & data ()
 Gets the data this sample contains. More...
 
WriteParams_tinfo ()
 Gets the write parameters. More...
 
const T & data ()
 Gets the data this sample contains. More...
 
const WriteParams_tinfo ()
 Gets the write parameters. More...
 
SampleIdentity_t identity () const
 Gets the identity of this sample. More...
 

Detailed Description

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

A sample for writing data.

WriteSamples are value types containing data that can be sent and optional parameters that configure how the data is written.

The data is automatically initialized using the corresponding TypeSupport for type T, and the memory is released in the destructor.

When the data already exists and allocating a new instance is not required, connext::WriteSampleRef can be used instead.

Template Parameters
TThe data type that this sample contains

Constructor & Destructor Documentation

◆ WriteSample() [1/4]

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

Creates a sample with default data and info values.

The data is deeply initialized using the corresponding TypeSupport

See also
FooTypeSupport::initialize_data

◆ WriteSample() [2/4]

template<typename T>
connext::WriteSample< T >::WriteSample ( const WriteSample< T > &  other)
inline

Creates a sample making a deep copy of another sample.

◆ WriteSample() [3/4]

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

Creates a sample making a deep copy of another sample.

◆ WriteSample() [4/4]

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

Creates a sample deep copying the data and info the source references.

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

Member Function Documentation

◆ data() [1/2]

template<typename T>
T& connext::WriteSample< T >::data ( )

Gets the data this sample contains.

◆ info() [1/2]

template<typename T>
WriteParams_t& connext::WriteSample< T >::info ( )

Gets the write parameters.

The parameters are input and output to write operations. They can be set to configure the write operation (e.g. setting a specific publication timestamp) or they can be looked up afterward (e.g. what was the actual timestamp the sample was written with).

See also
connext::Requester::send_request(WriteSample<UReq>&)
connext::Replier::send_reply(WriteSample<URep>&, const SampleIdentity_t&)

◆ data() [2/2]

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

Gets the data this sample contains.

◆ info() [2/2]

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

Gets the write parameters.

The parameters are input and output to write operations. They can be set to configure the write operation (e.g. setting a specific publication timestamp) or they can be looked up afterward (e.g. what was the actual timestamp the sample was written with).

See also
connext::Requester::send_request(WriteSample<UReq>&)
connext::Replier::send_reply(WriteSample<URep>&, const SampleIdentity_t&)

◆ identity()

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

Gets the identity of this sample.

The identity is assigned by the middleware after writing.

See also
Correlating requests and replies

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