RTI Connext Modern C++ API  Version 5.2.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
DataReader Use Cases

The following #includes are needed for the examples on this page

#include <dds/sub/ddssub.hpp>
#include <dds/domain/ddsdomain.hpp>
#include <dds/core/ddscore.hpp>
#include <dds/topic/ddstopic.hpp>
#include <dds/pub/ddspub.hpp>
#include <rti/core/ListenerBinder.hpp>
#include "Foo.hpp"

Setting up a DataReader

Managing instances

Set up a DataReader to access received data

Accessing Received Data

Reading data samples

You can read data samples from a DataReader by receiving a loan, inspecting the samples and then returning the loan, or you can directly copy them.

Selecting what samples to read

The functions read() and take() select all samples in the DataReader queue. The function select() allows specifying different criteria about the data to read. A equivalent API, using the streaming >> operator is available too.

Reading samples using coherent access

If a Subscriber's PresentationQosPolicy access_scope is GROUP and ordered_access is true, the application can access the samples in order across DataWriters of the same group (Publisher with access_scope GROUP). The queue is ordered/sorted per topic across all instances belonging to DataWriters (or DataReaders) within the same Publisher (or Subscriber).

DataReader Listeners

Looking up DataReaders

Getting Matched Publications

Accessing the Built-in Subscriber and DataReaders

Using untyped DataReaders

When you want to hold a reference to a DataReader and the type T doesn't matter, you can use the class dds::sub::AnyDataReader, which provides type-independent methods.

Tearing down a DataReader


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