RTI Connext Modern C++ API  Version 5.2.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
dds::pub::AnyDataWriter Class Reference

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

#include "dds/pub/AnyDataWriter.hpp"

Public Member Functions

template<typename T >
 AnyDataWriter (const dds::pub::DataWriter< T > &dw)
 Create an AnyDataWriter that represents a generic, untyped DataWriter.
 
dds::pub::qos::DataWriterQos qos () const
 Get the QoS for this AnyDataWriter.
 
void qos (const dds::pub::qos::DataWriterQos &the_qos)
 Set the QoS for this AnyDataWriter.
 
const std::string & topic_name () const
 Get the topic name for this AnyDataWriter.
 
const std::string & type_name () const
 Get the type name for this AnyDataWriter.
 
const dds::pub::Publisherpublisher () const
 Get the publisher for this AnyDataWriter.
 
void wait_for_acknowledgments (const dds::core::Duration &timeout)
 
void close ()
 Close the DataWriter.
 
void retain ()
 Retain this AnyDataWriter.
 
template<typename T >
AnyDataWriteroperator= (const dds::pub::DataWriter< T > &other)
 Assign a different DataWriter.
 
template<typename T >
DataWriter< T > get ()
 Gets the typed DataWriter from this AnyDataWriter.
 

Related Functions

(Note that these are not member functions.)

template<typename T >
DataWriter< T > get (const AnyDataWriter &any_writer)
 Same as AnyDataWriter::get()
 

Detailed Description

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

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

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

Constructor & Destructor Documentation

template<typename T >
dds::pub::AnyDataWriter::AnyDataWriter ( const dds::pub::DataWriter< T > &  dw)
inline

Create an AnyDataWriter that represents a generic, untyped DataWriter.

Template Parameters
TThe type of the DataWriter that this AnyDataWriter is being created from
Parameters
dwThe typed DataWriter that this AnyDataWriter will represent

Member Function Documentation

dds::pub::qos::DataWriterQos dds::pub::AnyDataWriter::qos ( ) const
inline

Get the QoS for this AnyDataWriter.

Returns
dds::pub::qos::DataWriterQos The DataWriterQos
void dds::pub::AnyDataWriter::qos ( const dds::pub::qos::DataWriterQos the_qos)
inline

Set the QoS for this AnyDataWriter.

Parameters
the_qosThe QoS to set
const std::string& dds::pub::AnyDataWriter::topic_name ( ) const
inline

Get the topic name for this AnyDataWriter.

Returns
The topic name
const std::string& dds::pub::AnyDataWriter::type_name ( ) const
inline

Get the type name for this AnyDataWriter.

Returns
The type name
const dds::pub::Publisher& dds::pub::AnyDataWriter::publisher ( ) const
inline

Get the publisher for this AnyDataWriter.

Returns
The publisher
void dds::pub::AnyDataWriter::wait_for_acknowledgments ( const dds::core::Duration timeout)
inline
void dds::pub::AnyDataWriter::close ( )
inline

Close the DataWriter.

See Also
DataWriter::close()
void dds::pub::AnyDataWriter::retain ( )
inline

Retain this AnyDataWriter.

See Also
DataWriter::retain()
template<typename T >
AnyDataWriter& dds::pub::AnyDataWriter::operator= ( const dds::pub::DataWriter< T > &  other)
inline

Assign a different DataWriter.

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

template<typename T >
DataWriter<T> dds::pub::AnyDataWriter::get ( )
inline

Gets the typed DataWriter from this AnyDataWriter.

Template Parameters
TThe type of the DataWriter to extract
Returns
The typed DataWriter that this AnyDataWriter represents
Exceptions
dds::core::InvalidDowncastErrorIf this AnyDataWriter doesn't represent a DataWriter<T>.

Friends And Related Function Documentation

template<typename T >
DataWriter< T > get ( const AnyDataWriter any_writer)
related

RTI Connext Modern C++ API Version 5.2.0 Copyright © Sun Jun 21 2015 Real-Time Innovations, Inc