RTI Connext C++ API  Version 5.0.0
connext::Sample< T > Class Template Reference

A data sample and related info received from the middleware. More...

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

Public Member Functions

 Sample ()
 Creates a sample with default data and info values.
 
 Sample (const Sample< T > &other)
 Creates a sample making a deep copy of another sample.
 
 Sample (SampleRef< T > sample_ref)
 Creates a sample as a deep copy of the contents referenced by a WriteSampleRef.
 
SampleIdentity_t identity () const
 Gets the identity of this sample.
 
SampleIdentity_t related_identity () const
 Gets the identity of a sample that is related to this one.
 
T & data ()
 Gets the data this sample contains.
 
SampleInfoinfo ()
 Gets the sample information.
 
const T & data ()
 Gets the data this sample contains.
 
const SampleInfoinfo ()
 Gets the sample information.
 

Detailed Description

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

A data sample and related info received from the middleware.

Samples contain data received from the middleware and information associated to the data.

Template Parameters
TThe data type that this sample contains
See Also
connext::Requester::receive_reply(Sample<TRep>&, const Duration_t&)
connext::Requester::take_reply(Sample<TRep>&)
connext::Replier::receive_request(Sample<TReq>&, const Duration_t&)

Constructor & Destructor Documentation

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

Creates a sample with default data and info values.

The data is deeply initialized using the corresponding TypeSupport

See Also
FooTypeSupport::initialize_data
template<typename T >
connext::Sample< T >::Sample ( const Sample< T > &  other)
inline

Creates a sample making a deep copy of another sample.

template<typename T >
Sample< T >::Sample ( SampleRef< T >  sample_ref)

Creates a sample as a deep copy of the contents referenced by a WriteSampleRef.

Member Function Documentation

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

Gets the identity of this sample.

The identity is assigned by the middleware upon reception.

See Also
Correlating requests and replies
template<typename T >
SampleIdentity_t connext::Sample< T >::related_identity ( ) const
inline

Gets the identity of a sample that is related to this one.

When a connext::Requester receives a reply, the reply Sample contains the identity of the related request.

Returns
The identity of another sample that is related to this one, or DDS_UNKNOWN_SAMPLE_IDENTITY if there is not a related sample.
See Also
connext::Requester::receive_reply(Sample<TRep>&, const Duration_t&)
Correlating requests and replies
template<typename T >
T& connext::Sample< T >::data ( )

Gets the data this sample contains.

See Also
Basic Requester example
template<typename T >
SampleInfo& connext::Sample< T >::info ( )

Gets the sample information.

See Also
DDS_SampleInfo
Basic Requester example
template<typename T >
const T& connext::Sample< T >::data ( )

Gets the data this sample contains.

See Also
Basic Requester example
template<typename T >
const SampleInfo& connext::Sample< T >::info ( )

Gets the sample information.

See Also
DDS_SampleInfo
Basic Requester example

RTI Connext C++ API Version 5.0.0 Copyright © Thu Aug 30 2012 Real-Time Innovations, Inc