RTI Connext Modern C++ API Version 7.3.0
dds::topic::TopicInstance< T > Class Template Reference

Encapsulates a sample and its associated instance handle. More...

#include <TopicInstance.hpp>

Public Member Functions

 TopicInstance ()
 Create a null TopicInstance. More...
 
 TopicInstance (const ::dds::core::InstanceHandle &the_handle)
 Create a TopicInstance with an InstanceHandle. More...
 
 TopicInstance (const ::dds::core::InstanceHandle &the_handle, const T &the_sample)
 Create a TopicInstance with a data sample and an InstanceHandle. More...
 
 operator dds::core::InstanceHandle () const
 Obtains the InstanceHandle. More...
 
dds::core::InstanceHandle handle () const
 Obtains the InstahnceHandle. More...
 
void handle (const ::dds::core::InstanceHandle &the_handle)
 Sets the InstanceHandle. More...
 
const T & sample () const
 Gets the sample by const reference. More...
 
T & sample ()
 Gets the sample by reference. More...
 
void sample (const T &the_sample)
 Assigns the data sample. More...
 

Detailed Description

template<typename T>
class dds::topic::TopicInstance< T >

Encapsulates a sample and its associated instance handle.

Template Parameters
Thetype of the sample that the TopicInstance is encapsulating.
See also
dds::pub::DataWriter::write(const dds::topic::TopicInstance<T>&)

Constructor & Destructor Documentation

◆ TopicInstance() [1/3]

template<typename T >
dds::topic::TopicInstance< T >::TopicInstance ( )
inline

Create a null TopicInstance.

The sample is default constructed and the instance handle is equal to dds::core::null.

◆ TopicInstance() [2/3]

template<typename T >
dds::topic::TopicInstance< T >::TopicInstance ( const ::dds::core::InstanceHandle the_handle)
inline

Create a TopicInstance with an InstanceHandle.

The sample is default constructed and the instance handle is copied from handle.

◆ TopicInstance() [3/3]

template<typename T >
dds::topic::TopicInstance< T >::TopicInstance ( const ::dds::core::InstanceHandle the_handle,
const T &  the_sample 
)
inline

Create a TopicInstance with a data sample and an InstanceHandle.

Member Function Documentation

◆ operator dds::core::InstanceHandle()

template<typename T >
dds::topic::TopicInstance< T >::operator dds::core::InstanceHandle ( ) const
inline

Obtains the InstanceHandle.

References dds::topic::TopicInstance< T >::handle().

◆ handle() [1/2]

template<typename T >
dds::core::InstanceHandle dds::topic::TopicInstance< T >::handle ( ) const
inline

Obtains the InstahnceHandle.

Referenced by dds::topic::TopicInstance< T >::operator dds::core::InstanceHandle().

◆ handle() [2/2]

template<typename T >
void dds::topic::TopicInstance< T >::handle ( const ::dds::core::InstanceHandle the_handle)
inline

Sets the InstanceHandle.

◆ sample() [1/3]

template<typename T >
const T & dds::topic::TopicInstance< T >::sample ( ) const
inline

Gets the sample by const reference.

◆ sample() [2/3]

template<typename T >
T & dds::topic::TopicInstance< T >::sample ( )
inline

Gets the sample by reference.

◆ sample() [3/3]

template<typename T >
void dds::topic::TopicInstance< T >::sample ( const T &  the_sample)
inline

Assigns the data sample.

Parameters
the_sampleThe data sample to copy into this TopicInstance