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

Public Functions

Type Name
DataReader (Topic * topic, Subscriber * subscriber)
void add_matched_writer (const rtps::GUID_t & writer_guid)
void add_sample (const ReceivedSample & sample)
Add a received sample to the cache.
ReturnCode_t get_key_value (std::vector< uint8_t > & key_holder, InstanceHandle_t handle)
Get the key value for an instance.
const DataReaderQos & get_qos () const
TopicDescription * get_topicdescription () const
const rtps::GUID_t & guid () const
void notify_receive ()
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_data_callback (DataCallback callback)
void set_guid (const rtps::GUID_t & guid)
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 () = default

Protected Attributes

Type Name
TopicDescription * topicdescription_ = {nullptr}

Public Types Documentation

typedef DataCallback

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

Public Functions Documentation

function DataReader

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

function add_matched_writer

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

function add_sample

Add a received sample to the cache.

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


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_qos

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

function get_topicdescription

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

function guid

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

function notify_receive

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

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_data_callback

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

function set_guid

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

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

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