15.2.8.2. RTPSReader

class eprosima::fastrtps::rtps::RTPSReader : public eprosima::fastrtps::rtps::Endpoint

Class RTPSReader, manages the reception of data from its matched writers.

Subclassed by eprosima::fastrtps::rtps::StatefulReader, eprosima::fastrtps::rtps::StatelessReader

Public Functions

bool matched_writer_add(const WriterProxyData &wdata) = 0

Add a matched writer represented by its attributes.

Return

True if correctly added.

Parameters
  • wdata: Attributes of the writer to add.

bool matched_writer_remove(const GUID_t &writer_guid, bool removed_by_lease = false) = 0

Remove a writer represented by its attributes from the matched writers.

Return

True if correctly removed.

Parameters
  • writer_guid: GUID of the writer to remove.

  • removed_by_lease: Whether the writer is being unmatched due to a participant drop.

bool matched_writer_is_matched(const GUID_t &writer_guid) = 0

Tells us if a specific Writer is matched against this reader.

Return

True if it is matched.

Parameters
  • writer_guid: GUID of the writer to check.

bool processDataMsg(CacheChange_t *change) = 0

Processes a new DATA message. Previously the message must have been accepted by function acceptMsgDirectedTo.

Return

true if the reader accepts messages from the.

Parameters

bool processDataFragMsg(CacheChange_t *change, uint32_t sampleSize, uint32_t fragmentStartingNum, uint16_t fragmentsInSubmessage) = 0

Processes a new DATA FRAG message.

Return

true if the reader accepts message.

Parameters
  • change: Pointer to the CacheChange_t.

  • sampleSize: Size of the complete, assembled message.

  • fragmentStartingNum: Starting number of this particular message.

  • fragmentsInSubmessage: Number of fragments on this particular message.

bool processHeartbeatMsg(const GUID_t &writerGUID, uint32_t hbCount, const SequenceNumber_t &firstSN, const SequenceNumber_t &lastSN, bool finalFlag, bool livelinessFlag) = 0

Processes a new HEARTBEAT message.

Return

true if the reader accepts messages from the.

Parameters
  • writerGUID:

  • hbCount:

  • firstSN:

  • lastSN:

  • finalFlag:

  • livelinessFlag:

bool processGapMsg(const GUID_t &writerGUID, const SequenceNumber_t &gapStart, const SequenceNumberSet_t &gapList) = 0

Processes a new GAP message.

Return

true if the reader accepts messages from the.

Parameters
  • writerGUID:

  • gapStart:

  • gapList:

bool change_removed_by_history(CacheChange_t *change, WriterProxy *prox = nullptr) = 0

Method to indicate the reader that some change has been removed due to HistoryQos requirements.

Return

True if correctly removed.

Parameters
  • change: Pointer to the CacheChange_t.

  • prox: Pointer to the WriterProxy.

ReaderListener *getListener() const

Get the associated listener, secondary attached Listener in case it is of coumpound type

Return

Pointer to the associated reader listener.

bool setListener(ReaderListener *target)

Switch the ReaderListener kind for the Reader. If the RTPSReader does not belong to the built-in protocols it switches out the old one. If it belongs to the built-in protocols, it sets the new ReaderListener callbacks to be called after the built-in ReaderListener ones.

Return

True is correctly set.

Parameters
  • target: Pointed to ReaderLister to attach

bool reserveCache(CacheChange_t **change, uint32_t dataCdrSerializedSize)

Reserve a CacheChange_t.

Return

True if correctly reserved.

Parameters
  • change: Pointer to pointer to the Cache.

  • dataCdrSerializedSize: Size of the Cache.

void releaseCache(CacheChange_t *change)

Release a cacheChange.

bool nextUnreadCache(CacheChange_t **change, WriterProxy **wp) = 0

Read the next unread CacheChange_t from the history

Return

True if read.

Parameters
  • change: Pointer to pointer of CacheChange_t

  • wp: Pointer to pointer to the WriterProxy

bool nextUntakenCache(CacheChange_t **change, WriterProxy **wp) = 0

Get the next CacheChange_t from the history to take.

Return

True if read.

Parameters
  • change: Pointer to pointer of CacheChange_t.

  • wp: Pointer to pointer to the WriterProxy.

bool expectsInlineQos()

Return

True if the reader expects Inline QOS.

ReaderHistory *getHistory()

Returns a pointer to the associated History.

bool isInCleanState() = 0

Returns there is a clean state with all Writers.

It occurs when the Reader received all samples sent by Writers. In other words, its WriterProxies are up to date.

Return

There is a clean state with all Writers.

void assert_writer_liveliness(const GUID_t &writer) = 0

Assert the liveliness of a matched writer.

Parameters
  • writer: GUID of the writer to assert.

bool begin_sample_access_nts(CacheChange_t *change, WriterProxy *&wp) = 0

Called just before a change is going to be deserialized.

Return

Whether the change is still valid or not.

Parameters
  • [in] change: Pointer to the change being accessed.

  • [out] wp: Writer proxy the change belongs to.

void end_sample_access_nts(CacheChange_t *change, WriterProxy *&wp, bool mark_as_read) = 0

Called after the change has been deserialized.

Parameters
  • [in] change: Pointer to the change being accessed.

  • [in] wp: Writer proxy the change belongs to.

  • [in] mark_as_read: Whether the change should be marked as read or not.

void change_read_by_user(CacheChange_t *change, const WriterProxy *writer, bool mark_as_read = true) = 0

Called when the user has retrieved a change from the history.

Parameters
  • change: Pointer to the change to ACK

  • writer: Writer proxy of the change.

  • mark_as_read: Whether the change should be marked as read or not

bool is_sample_valid(const void *data, const GUID_t &writer, const SequenceNumber_t &sn) const

Checks whether the sample is still valid or is corrupted

Return

true if the sample is valid

Parameters
  • data: Pointer to the sample data to check

  • writer: GUID of the writer that sent data

  • sn: Sequence number related to data

Public Members

LivelinessChangedStatus liveliness_changed_status_

The liveliness changed status struct as defined in the DDS.