RTI Connext Modern C++ API  Version 6.0.1
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
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.
 
void close ()
 Deletes and cancels this TopicQuery.
 
const rti::core::Guid guid () const
 Gets the TopicQuery GUID.
 
bool closed () const
 Indicates whether this TopicQuery has been closed with close().
 
dds::sub::AnyDataReader datareader () const
 Gets the DataReader associated to this TopicQuery.
 

Static Public Member Functions

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

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.
 

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

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

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.

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

Gets the TopicQuery GUID.

See Also
rti::sub::find_topic_query()
bool rti::sub::TopicQuery::closed ( ) const
inline

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

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

Gets the DataReader associated to this TopicQuery.

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().

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

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()

RTI Connext Modern C++ API Version 6.0.1 Copyright © Sat Nov 23 2019 Real-Time Innovations, Inc