Skip to content

Commit

Permalink
Refs 12758. Method writer_unmatched documented and improved.
Browse files Browse the repository at this point in the history
Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>
  • Loading branch information
MiguelCompany committed Dec 14, 2021
1 parent aba2449 commit 82c54e2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
17 changes: 12 additions & 5 deletions include/fastdds/rtps/history/ReaderHistory.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,20 @@ class ReaderHistory : public History
CacheChange_t** min_change,
const GUID_t& writerGuid);

RTPS_DllAPI virtual bool writer_unmatched(
/**
* Called when a writer is unmatched from the reader holding this history.
*
* This method will remove all the changes on the history that came from the writer being unmatched and which have
* not yet been notified to the user.
*
* @param writer_guid GUID of the writer being unmatched.
* @param last_notified_seq Last sequence number from the specified writer that was notified to the user.
*/
RTPS_DllAPI virtual void writer_unmatched(
const GUID_t& writer_guid,
const SequenceNumber_t& last_notified_seq)
{
return remove_changes_with_pred(
remove_changes_with_pred(
[writer_guid, last_notified_seq](CacheChange_t* ch)
{
return (writer_guid == ch->writerGUID) &&
Expand All @@ -174,7 +183,7 @@ class ReaderHistory : public History
CacheChange_t* ch) override;

template<typename Pred>
inline bool remove_changes_with_pred(
inline void remove_changes_with_pred(
Pred pred)
{
assert(nullptr != mp_reader);
Expand All @@ -186,8 +195,6 @@ class ReaderHistory : public History
{
new_end = remove_change_nts(new_end);
}

return true;
}

//!Pointer to the reader
Expand Down
14 changes: 5 additions & 9 deletions src/cpp/rtps/history/ReaderHistory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,15 +167,11 @@ bool ReaderHistory::remove_changes_with_guid(
return false;
}

if (!remove_changes_with_pred(
[a_guid](CacheChange_t* ch)
{
return a_guid == ch->writerGUID;
}))
{
logError(RTPS_READER_HISTORY, "One of the cachechanged in the GUID removal bulk could not be removed");
return false;
}
remove_changes_with_pred(
[a_guid](CacheChange_t* ch)
{
return a_guid == ch->writerGUID;
});

return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,10 @@ class ReaderHistory
return m_changes.erase(removal);
}

virtual bool writer_unmatched(
virtual void writer_unmatched(
const GUID_t& /*writer_guid*/,
const SequenceNumber_t& /*last_notified_seq*/)
{
return true;
}

HistoryAttributes m_att;
Expand Down

0 comments on commit 82c54e2

Please sign in to comment.