RTI Connext Modern C++ API  Version 5.3.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
dds::sub::AnyDataReader Class Reference

<<reference-type>> This class provides an non-template holder for representing a DataReader of any type More...

#include "dds/sub/AnyDataReader.hpp"

Public Member Functions

template<typename T >
 AnyDataReader (const dds::sub::DataReader< T > &reader)
 Create an AnyDataReader that represents a generic, untyped DataReader.
 
dds::sub::qos::DataReaderQos qos () const
 Get the QoS for this AnyDataReader.
 
void qos (const dds::sub::qos::DataReaderQos &the_qos)
 Set the QoS for this AnyDataReader.
 
const std::string & topic_name () const
 Get the topic name for this AnyDataReader.
 
const std::string & type_name () const
 Get the type name for this AnyDataReader.
 
const dds::sub::Subscribersubscriber () const
 Get the publisher for this AnyDataReader.
 
template<typename T >
AnyDataReaderoperator= (const DataReader< T > &other)
 Assign a different DataReader.
 
template<typename T >
dds::sub::DataReader< T > get () const
 Gets the typed DataReader from this AnyDataReader.
 
void close ()
 Close this AnyDataReader.
 
void retain ()
 Retain this AnyDataReader.
 

Related Functions

(Note that these are not member functions.)

template<typename T >
DataReader< T > get (const AnyDataReader &any_reader)
 Same as AnyDataReader::get()
 

Detailed Description

<<reference-type>> This class provides an non-template holder for representing a DataReader of any type

This class is useful for code that uses DataReaders of different types. It provides access to type-independent DataReader functions.

An AnyDataReader is always created from a typed DataReader, increasing its reference count. The member function get() allows getting the typed DataReader back.

Constructor & Destructor Documentation

template<typename T >
dds::sub::AnyDataReader::AnyDataReader ( const dds::sub::DataReader< T > &  reader)
inline

Create an AnyDataReader that represents a generic, untyped DataReader.

Template Parameters
TThe type of the DataReader that this AnyDataReader is being created from
Parameters
readerThe typed DataReader that this AnyDataReader will represent

Member Function Documentation

dds::sub::qos::DataReaderQos dds::sub::AnyDataReader::qos ( ) const
inline

Get the QoS for this AnyDataReader.

Returns
dds::sub::qos::DataReaderQos The DataReaderQos
void dds::sub::AnyDataReader::qos ( const dds::sub::qos::DataReaderQos the_qos)
inline

Set the QoS for this AnyDataReader.

Parameters
the_qosThe QoS to set
const std::string& dds::sub::AnyDataReader::topic_name ( ) const
inline

Get the topic name for this AnyDataReader.

Returns
The topic name
const std::string& dds::sub::AnyDataReader::type_name ( ) const
inline

Get the type name for this AnyDataReader.

Returns
The type name
const dds::sub::Subscriber& dds::sub::AnyDataReader::subscriber ( ) const
inline

Get the publisher for this AnyDataReader.

Returns
The subscriber
template<typename T >
AnyDataReader& dds::sub::AnyDataReader::operator= ( const DataReader< T > &  other)
inline

Assign a different DataReader.

Replaces the reference to the current reader with a new one, whose type T can be different.

template<typename T >
dds::sub::DataReader<T> dds::sub::AnyDataReader::get ( ) const
inline

Gets the typed DataReader from this AnyDataReader.

Template Parameters
TThe type of the DataReader to extract
Returns
The typed DataReader that this AnyDataReader represents
Exceptions
dds::core::InvalidDowncastErrorIf this AnyDataReader doesn't represent a DataReader<T>.
void dds::sub::AnyDataReader::close ( )
inline

Close this AnyDataReader.

See Also
DataReader::close()
void dds::sub::AnyDataReader::retain ( )
inline

Retain this AnyDataReader.

See Also
DataReader::retain()

Friends And Related Function Documentation

template<typename T >
DataReader< T > get ( const AnyDataReader any_reader)
related

RTI Connext Modern C++ API Version 5.3.0 Copyright © Sun Jun 25 2017 Real-Time Innovations, Inc