You are here: Part 2: Core Concepts > Receiving Data > Subscribers > Getting DataReaders with Specific DDS Samples

Getting DataReaders with Specific DDS Samples

The Subscriber’s get_datareaders() operation retrieves a list of DataReaders that have DDS samples with specific sample_states, view_states, and instance_states.

If the application is outside a begin_access()/end_access() block, or if the Subscriber’s access_scope (in the PRESENTATION QosPolicy) is INSTANCE or TOPIC, or ordered_access (also in the PRESENTATION QosPolicy) is FALSE, the returned collection is a 'set' containing each DataReader at most once, in no specified order.

If the application is within a begin_access()/end_access() block, and the Subscriber’s access_scope is GROUP or HIGHEST_OFFERED, and ordered_access is TRUE, the returned collection is a 'list' of DataReaders, where a DataReader may appear more than one time.

To retrieve the DDS samples in the order in which they were published across DataWriters of the same group (a Publisher configured with GROUP access_scope), the application should read()/take() from each DataReader in the same order as appears in the output sequence. The application will move to the next DataReader when the read()/take() operation fails with NO_DATA.

DDS_ReturnCode_t get_datareaders (DDSDataReaderSeq & readers,
    DDS_SampleStateMask    sample_states,
    DDS_ViewStateMask     view_states,
    DDS_InstanceStateMask  instance_states)

For more information, see The SampleInfo Structure.

© 2016 RTI