Skip to content

Commit

Permalink
Refs #21082. Method get_history in BaseWriter.
Browse files Browse the repository at this point in the history
Signed-off-by: Miguel Company <[email protected]>
  • Loading branch information
MiguelCompany committed Jul 5, 2024
1 parent b232a81 commit a021411
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 8 deletions.
5 changes: 5 additions & 0 deletions src/cpp/rtps/writer/BaseWriter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@ class BaseWriter

#endif // FASTDDS_STATISTICS

WriterHistory* get_history() const
{
return history_;
}

//!Get maximum size of the data
uint32_t getMaxDataSize();

Expand Down
2 changes: 1 addition & 1 deletion src/cpp/rtps/writer/ReaderProxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ ReaderProxy::ReaderProxy(
, is_reliable_(false)
, disable_positive_acks_(false)
, writer_(writer)
, changes_for_reader_(resource_limits_from_history(writer->history_->m_att, 0))
, changes_for_reader_(resource_limits_from_history(writer->get_history()->m_att, 0))
, nack_supression_event_(nullptr)
, initial_heartbeat_event_(nullptr)
, timers_enabled_(false)
Expand Down
4 changes: 2 additions & 2 deletions test/mock/rtps/RTPSWriter/fastdds/rtps/writer/RTPSWriter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,9 @@ class RTPSWriter : public Endpoint
return true;
}

WriterHistory* history_;
WriterHistory* history_ = nullptr;

WriterListener* listener_;
WriterListener* listener_ = nullptr;

GUID_t m_guid;

Expand Down
5 changes: 5 additions & 0 deletions test/mock/rtps/RTPSWriter/rtps/writer/BaseWriter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ class BaseWriter : public RTPSWriter

virtual ~BaseWriter() = default;

virtual WriterHistory* get_history() const
{
return history_;
}

static BaseWriter* downcast(
RTPSWriter* writer)
{
Expand Down
13 changes: 8 additions & 5 deletions test/mock/rtps/StatefulWriter/rtps/writer/StatefulWriter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ class StatefulWriter : public fastdds::rtps::BaseWriter
: participant_(participant)
, mp_history(new WriterHistory())
{
mp_history->m_att.initialReservedCaches = 0;
}

StatefulWriter()
: participant_(nullptr)
, mp_history(new WriterHistory())
: StatefulWriter(nullptr)
{
}

Expand Down Expand Up @@ -88,11 +88,14 @@ class StatefulWriter : public fastdds::rtps::BaseWriter
return SequenceNumber_t::unknown();
}

WriterHistory* get_history() const override
{
return history_ ? history_ : mp_history;
}

SequenceNumber_t next_sequence_number() const
{
return history_ ?
history_->next_sequence_number() :
mp_history->next_sequence_number();
return get_history()->next_sequence_number();
}

void reader_data_filter(
Expand Down

0 comments on commit a021411

Please sign in to comment.