RTI Connext Modern C++ API  Version 6.1.0
dds::topic::AnyTopic Class Reference

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

#include "dds/pub/AnyDataWriter.hpp"

Public Member Functions

template<typename T >
 AnyTopic (const dds::topic::Topic< T > &topic)
 Create an AnyTopic that represents a generic, untyped Topic. More...
 
dds::domain::DomainParticipant domain_participant () const
 Gets the DomainParticipant this topic belongs to. More...
 
dds::core::status::InconsistentTopicStatus inconsistent_topic_status ()
 Gets the InconsistentTopicStatus of this topic. More...
 
const dds::topic::qos::TopicQos qos () const
 Get the TopicQos. More...
 
void qos (const dds::topic::qos::TopicQos &the_qos)
 Sets the TopicQos. More...
 
std::string name () const
 Gets the topic name. More...
 
std::string type_name () const
 Gets the type name. More...
 
void close ()
 Closes the Topic. More...
 
template<typename T >
Topic< T > get ()
 Gets the typed Topic from this AnyTopic. More...
 

Related Functions

(Note that these are not member functions.)

template<typename T >
Topic< T > get (const AnyTopic &any_topic)
 Same as AnyTopic::get() More...
 

Detailed Description

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

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

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

Constructor & Destructor Documentation

◆ AnyTopic()

template<typename T >
dds::topic::AnyTopic::AnyTopic ( const dds::topic::Topic< T > &  topic)
inline

Create an AnyTopic that represents a generic, untyped Topic.

Template Parameters
TThe type of the Topic that this AnyTopic is being created from
Parameters
topicThe typed Topic that this AnyTopic will represent

Member Function Documentation

◆ domain_participant()

dds::domain::DomainParticipant dds::topic::AnyTopic::domain_participant ( ) const
inline

Gets the DomainParticipant this topic belongs to.

◆ inconsistent_topic_status()

dds::core::status::InconsistentTopicStatus dds::topic::AnyTopic::inconsistent_topic_status ( )
inline

Gets the InconsistentTopicStatus of this topic.

◆ qos() [1/2]

const dds::topic::qos::TopicQos dds::topic::AnyTopic::qos ( ) const
inline

Get the TopicQos.

◆ qos() [2/2]

void dds::topic::AnyTopic::qos ( const dds::topic::qos::TopicQos the_qos)
inline

Sets the TopicQos.

◆ name()

std::string dds::topic::AnyTopic::name ( ) const
inline

Gets the topic name.

◆ type_name()

std::string dds::topic::AnyTopic::type_name ( ) const
inline

Gets the type name.

◆ close()

void dds::topic::AnyTopic::close ( )
inline

Closes the Topic.

See also
Topic::close()

◆ get()

template<typename T >
Topic<T> dds::topic::AnyTopic::get ( )
inline

Gets the typed Topic from this AnyTopic.

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

Friends And Related Function Documentation

◆ get()

template<typename T >
Topic< T > get ( const AnyTopic any_topic)
related

Same as AnyTopic::get()