Class astutedds::dcps::DataReader

ClassList > astutedds > dcps > DataReader

Subscribes to data samples from a topic.

  • #include <dcps.hpp>

Public Types

Type Name
typedef std::function< void(const ReceivedSample &)> DataCallback
typedef std::function< void()> DestroyCallback
typedef std::function< LivelinessChangedStatus()> LivelinessChangedStatusHook
typedef std::function< void()> NotifyCallback

Public Functions

Type Name
DataReader (Topic * topic, Subscriber * subscriber)
DataReader (const DataReader &) = delete
void add_destroy_callback (DestroyCallback cb)
void add_matched_writer (const rtps::GUID_t & writer_guid)
void add_notify_callback (NotifyCallback cb)
void add_sample (const ReceivedSample & sample)
Add a received sample to the cache.
void bump_sample_lost (int32_t count=1)
ReturnCode_t get_key_value (std::vector< uint8_t > & key_holder, InstanceHandle_t handle)
Get the key value for an instance.
DataReaderListener * get_listener () const
LivelinessChangedStatus get_liveliness_changed_status () const
Get liveliness-changed status (DDS §2.2.4.1.4). Tracks the count of matched remote writers whose liveliness is currently asserted (alive_count) vs expired (not_alive_count). The *_change deltas are reset on read.
const DataReaderQos & get_qos () const
RequestedDeadlineMissedStatus get_requested_deadline_missed_status ()
Get requested-deadline-missed status (DDS §2.2.4.1.5). Bumps every time no matching sample arrives within the DEADLINE QoS period. total_count_change reset on read.
void get_requested_incompatible_qos_status (RequestedIncompatibleQosStatus & out)
SampleLostStatus get_sample_lost_status ()
Get sample-lost status (DDS §2.2.4.1.7). Bumps once per sample that will never be delivered to the reader — currently signalled from the KEEP_LAST overflow path in DataReader::add_sample() .total_count_change resets on read.
void get_subscription_matched_status (SubscriptionMatchedStatus & out)
TopicDescription * get_topicdescription () const
const rtps::GUID_t & guid () const
bool is_writer_matched (const rtps::GUID_t & writer_guid) const
void note_requested_incompatible_qos (QosPolicyId_t failed_policy_id)
void notify_receive (InstanceHandle_t handle)
DataReader & operator= (const DataReader &) = delete
void process_heartbeat (const rtps::GUID_t & writer_guid, const rtps::SequenceNumber_t & first_sn, const rtps::SequenceNumber_t & last_sn, rtps::Count_t count, bool final)
std::vector< ReceivedSample > read (size_t max_samples=0xFFFFFFFF)
Read samples (keeps samples in cache)
ReturnCode_t read_next_sample (std::vector< uint8_t > & data, SampleInfo & info)
Read the next sample from the reader.
void remove_matched_writer (const rtps::GUID_t & writer_guid)
ReturnCode_t return_loan (std::vector< std::vector< uint8_t > > &, std::vector< SampleInfo > &)
Return loaned sequences (no-op for now; samples are copied)
void set_acknack_callback (AcknackCallback cb)
void set_data_callback (DataCallback callback)
void set_deadline_timer_service (TimerService * ts)
void set_guid (const rtps::GUID_t & guid)
void set_listener (DataReaderListener * listener)
void set_liveliness_changed_hook (LivelinessChangedStatusHook hook)
void set_qos (const DataReaderQos & qos)
void set_topicdescription (TopicDescription * td)
void start_deadline_timer ()
void stop_deadline_timer ()
Subscriber * subscriber () const
std::vector< ReceivedSample > take (size_t max_samples=0xFFFFFFFF)
Take samples (removes samples from cache)
ReturnCode_t take_next_sample (std::vector< uint8_t > & data, SampleInfo & info)
Take the next sample from the reader (removes from cache)
Topic * topic () const
size_t unread_count () const
virtual ~DataReader ()

Protected Attributes

Type Name
TopicDescription * topicdescription_ = {nullptr}

Public Types Documentation

typedef DataCallback

using astutedds::dcps::DataReader::DataCallback =  std::function<void(const ReceivedSample &)>;

typedef DestroyCallback

using astutedds::dcps::DataReader::DestroyCallback =  std::function<void()>;

typedef LivelinessChangedStatusHook

using astutedds::dcps::DataReader::LivelinessChangedStatusHook =  std::function<LivelinessChangedStatus()>;

Hook installed by Subscriber::create_datareader — reads the changed-status snapshot from the participant's LivelinessManager.


typedef NotifyCallback

using astutedds::dcps::DataReader::NotifyCallback =  std::function<void()>;

Public Functions Documentation

function DataReader [1/2]

astutedds::dcps::DataReader::DataReader (
    Topic * topic,
    Subscriber * subscriber
) 

function DataReader [2/2]

astutedds::dcps::DataReader::DataReader (
    const DataReader &
) = delete

function add_destroy_callback

inline void astutedds::dcps::DataReader::add_destroy_callback (
    DestroyCallback cb
) 

function add_matched_writer

void astutedds::dcps::DataReader::add_matched_writer (
    const rtps::GUID_t & writer_guid
) 

function add_notify_callback

inline void astutedds::dcps::DataReader::add_notify_callback (
    NotifyCallback cb
) 

function add_sample

Add a received sample to the cache.

void astutedds::dcps::DataReader::add_sample (
    const ReceivedSample & sample
) 


function bump_sample_lost

void astutedds::dcps::DataReader::bump_sample_lost (
    int32_t count=1
) 

§1.1b-B — bump the sample-lost counter from an internal caller (transport GAP handler, KEEP_LAST overflow). Dispatches the reader listener (falling back to the participant listener) with a drained snapshot.


function get_key_value

Get the key value for an instance.

ReturnCode_t astutedds::dcps::DataReader::get_key_value (
    std::vector< uint8_t > & key_holder,
    InstanceHandle_t handle
) 

Parameters:

  • key_holder Output data for key fields
  • handle The instance handle

Returns:

RETCODE_OK on success


function get_listener

inline DataReaderListener * astutedds::dcps::DataReader::get_listener () const

function get_liveliness_changed_status

Get liveliness-changed status (DDS §2.2.4.1.4). Tracks the count of matched remote writers whose liveliness is currently asserted (alive_count) vs expired (not_alive_count). The *_change deltas are reset on read.

LivelinessChangedStatus astutedds::dcps::DataReader::get_liveliness_changed_status () const


function get_qos

inline const DataReaderQos & astutedds::dcps::DataReader::get_qos () const

function get_requested_deadline_missed_status

Get requested-deadline-missed status (DDS §2.2.4.1.5). Bumps every time no matching sample arrives within the DEADLINE QoS period. total_count_change reset on read.

RequestedDeadlineMissedStatus astutedds::dcps::DataReader::get_requested_deadline_missed_status () 


function get_requested_incompatible_qos_status

void astutedds::dcps::DataReader::get_requested_incompatible_qos_status (
    RequestedIncompatibleQosStatus & out
) 

function get_sample_lost_status

Get sample-lost status (DDS §2.2.4.1.7). Bumps once per sample that will never be delivered to the reader — currently signalled from the KEEP_LAST overflow path in DataReader::add_sample() .total_count_change resets on read.

SampleLostStatus astutedds::dcps::DataReader::get_sample_lost_status () 


function get_subscription_matched_status

void astutedds::dcps::DataReader::get_subscription_matched_status (
    SubscriptionMatchedStatus & out
) 

function get_topicdescription

TopicDescription * astutedds::dcps::DataReader::get_topicdescription () const

function guid

inline const rtps::GUID_t & astutedds::dcps::DataReader::guid () const

function is_writer_matched

bool astutedds::dcps::DataReader::is_writer_matched (
    const rtps::GUID_t & writer_guid
) const

§1.1b-B — true if writer_guid is currently in this reader's matched-writers set. Used by the participant's liveliness routing callback to fan changed events out to the affected readers only.


function note_requested_incompatible_qos

void astutedds::dcps::DataReader::note_requested_incompatible_qos (
    QosPolicyId_t failed_policy_id
) 

Record that a remote DataWriter was seen with QoS incompatible with this reader's requested QoS. Bumps the RequestedIncompatibleQosStatus counters and, if a listener is registered, delivers the updated status.


function notify_receive

void astutedds::dcps::DataReader::notify_receive (
    InstanceHandle_t handle
) 

function operator=

DataReader & astutedds::dcps::DataReader::operator= (
    const DataReader &
) = delete

function process_heartbeat

void astutedds::dcps::DataReader::process_heartbeat (
    const rtps::GUID_t & writer_guid,
    const rtps::SequenceNumber_t & first_sn,
    const rtps::SequenceNumber_t & last_sn,
    rtps::Count_t count,
    bool final
) 

function read

Read samples (keeps samples in cache)

std::vector< ReceivedSample > astutedds::dcps::DataReader::read (
    size_t max_samples=0xFFFFFFFF
) 


function read_next_sample

Read the next sample from the reader.

ReturnCode_t astutedds::dcps::DataReader::read_next_sample (
    std::vector< uint8_t > & data,
    SampleInfo & info
) 

Parameters:

  • data Output buffer for serialized data
  • info Output sample info

Returns:

RETCODE_OK on success, RETCODE_NO_DATA if no data available


function remove_matched_writer

void astutedds::dcps::DataReader::remove_matched_writer (
    const rtps::GUID_t & writer_guid
) 

function return_loan

Return loaned sequences (no-op for now; samples are copied)

inline ReturnCode_t astutedds::dcps::DataReader::return_loan (
    std::vector< std::vector< uint8_t > > &,
    std::vector< SampleInfo > &
) 


function set_acknack_callback

inline void astutedds::dcps::DataReader::set_acknack_callback (
    AcknackCallback cb
) 

function set_data_callback

inline void astutedds::dcps::DataReader::set_data_callback (
    DataCallback callback
) 

function set_deadline_timer_service

inline void astutedds::dcps::DataReader::set_deadline_timer_service (
    TimerService * ts
) 

§1.1b-B — hook installed by Subscriber::create_datareader to share the participant's TimerService. Null when no participant is attached (e.g. unit tests constructing DataReader directly).


function set_guid

inline void astutedds::dcps::DataReader::set_guid (
    const rtps::GUID_t & guid
) 

function set_listener

inline void astutedds::dcps::DataReader::set_listener (
    DataReaderListener * listener
) 

function set_liveliness_changed_hook

inline void astutedds::dcps::DataReader::set_liveliness_changed_hook (
    LivelinessChangedStatusHook hook
) 

function set_qos

void astutedds::dcps::DataReader::set_qos (
    const DataReaderQos & qos
) 

function set_topicdescription

inline void astutedds::dcps::DataReader::set_topicdescription (
    TopicDescription * td
) 

function start_deadline_timer

void astutedds::dcps::DataReader::start_deadline_timer () 

function stop_deadline_timer

void astutedds::dcps::DataReader::stop_deadline_timer () 

function subscriber

inline Subscriber * astutedds::dcps::DataReader::subscriber () const

function take

Take samples (removes samples from cache)

std::vector< ReceivedSample > astutedds::dcps::DataReader::take (
    size_t max_samples=0xFFFFFFFF
) 


function take_next_sample

Take the next sample from the reader (removes from cache)

ReturnCode_t astutedds::dcps::DataReader::take_next_sample (
    std::vector< uint8_t > & data,
    SampleInfo & info
) 

Parameters:

  • data Output buffer for serialized data
  • info Output sample info

Returns:

RETCODE_OK on success, RETCODE_NO_DATA if no data available


function topic

inline Topic * astutedds::dcps::DataReader::topic () const

function unread_count

size_t astutedds::dcps::DataReader::unread_count () const

function ~DataReader

virtual astutedds::dcps::DataReader::~DataReader () 

Protected Attributes Documentation

variable topicdescription_

TopicDescription* astutedds::dcps::DataReader::topicdescription_;


The documentation for this class was generated from the following file include/astutedds/dcps/dcps.hpp