RTI Connext Modern C++ API  Version 7.0.0
rti::sub::TopicQuery Class Reference

<<extension>> <<reference-type>> Allows a dds::sub::DataReader to query the sample cache of its matching dds::pub::DataWriters. More...

#include <rti/sub/TopicQuery.hpp>

Inheritance diagram for rti::sub::TopicQuery:
dds::core::Reference< TopicQueryImpl >

Public Member Functions

 TopicQuery (dds::sub::AnyDataReader reader, const TopicQuerySelection &selection)
 Creates a TopicQuery for a given DataReader. More...
 
void close ()
 Deletes and cancels this TopicQuery. More...
 
const rti::core::Guid guid () const
 Gets the TopicQuery GUID. More...
 
bool closed () const
 Indicates whether this TopicQuery has been closed with close(). More...
 
dds::sub::AnyDataReader datareader () const
 Gets the DataReader associated to this TopicQuery. More...
 

Static Public Member Functions

static TopicQuery UseReaderContentFilter (dds::sub::AnyDataReader reader)
 Creates a TopicQuery with the same filter as this reader's ContentFilteredTopic. More...
 
static TopicQuery SelectAll (dds::sub::AnyDataReader reader)
 Creates a TopicQuery that requests all the samples in the DataWriters' cache. More...
 

Related Functions

(Note that these are not member functions.)

TopicQuery find_topic_query (dds::sub::AnyDataReader datareader, const rti::core::Guid &guid)
 Looks up a TopicQuery by its GUID. More...
 

Detailed Description

<<extension>> <<reference-type>> Allows a dds::sub::DataReader to query the sample cache of its matching dds::pub::DataWriters.

Note
A TopicQuery provides all the functions of a <<reference-type>>, including close() and retain().

You can create a TopicQuery for a DataReader with the constructor that receives a TopicQuerySelection or with the following static member functions:

As a <<reference-type>>, a TopicQuery will be deleted when all references to it go out of scope or after calling close(). The middleware will notify the deletion of a TopicQuery to the DataWriters. See close() for more details.

Constructor & Destructor Documentation

◆ TopicQuery()

rti::sub::TopicQuery::TopicQuery ( dds::sub::AnyDataReader  reader,
const TopicQuerySelection selection 
)
inline

Creates a TopicQuery for a given DataReader.

The resulting TopicQuery will propagate to the matching DataWriters right after creating if the reader is enabled. Otherwise it will propagate after enabling the reader.

Any late-joining DataWriter matching with the DataReader will also receive the query.

Parameters
readerThe DataReader that will query and receive the requested samples
selectionSelects which samples the matching DataWriters will provide.

There are two special kinds of TopicQueries, created with the static member functions UseReaderContentFilter() and SelectAll().

Member Function Documentation

◆ close()

void rti::sub::TopicQuery::close ( )
inline

Deletes and cancels this TopicQuery.

This is a explicit deletion, which otherwise would occur when all references to this TopicQuery go out of scope.

After deleting a TopicQuery new DataWriters won't discover it and existing DataWriters currently publishing cached samples may stop before delivering all of them.

◆ guid()

const rti::core::Guid rti::sub::TopicQuery::guid ( ) const
inline

Gets the TopicQuery GUID.

See also
rti::sub::find_topic_query()

◆ closed()

bool rti::sub::TopicQuery::closed ( ) const
inline

Indicates whether this TopicQuery has been closed with close().

◆ datareader()

dds::sub::AnyDataReader rti::sub::TopicQuery::datareader ( ) const
inline

Gets the DataReader associated to this TopicQuery.

References rti::sub::find_topic_query().

◆ UseReaderContentFilter()

static TopicQuery rti::sub::TopicQuery::UseReaderContentFilter ( dds::sub::AnyDataReader  reader)
static

Creates a TopicQuery with the same filter as this reader's ContentFilteredTopic.

If the reader doesn't use a dds::topic::ContentFilteredTopic, this TopicQuery behaves as TopicQuery::SelectAll().

◆ SelectAll()

static TopicQuery rti::sub::TopicQuery::SelectAll ( dds::sub::AnyDataReader  reader)
static

Creates a TopicQuery that requests all the samples in the DataWriters' cache.

Friends And Related Function Documentation

◆ find_topic_query()

TopicQuery find_topic_query ( dds::sub::AnyDataReader  datareader,
const rti::core::Guid guid 
)
related

Looks up a TopicQuery by its GUID.

Parameters
datareaderThe DataReader used to create the TopicQuery
guidThe TopicQuery's GUID
Returns
The TopicQuery if it exists or a dds::core::null reference otherwise.
See also
rti::sub::TopicQuery::guid()