Skip to content

Commit

Permalink
RTPS reader APIs refactor (#4875)
Browse files Browse the repository at this point in the history
* Refs #21082. Add `BaseReader` alias.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21082. Refactor on `StatefulReader`.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21082. Refactor on `StatelessReader`.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21082. Refactor on `ListenerTests`.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21082. Refactor on `MessageReceiver`.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21082. Refactor on `RTPSMessageGroup`.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21082. Refactor on `StatisticsReaderImpl`.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21082. Refactor on writers (intraprocess).

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21082. Turn `BaseReader` into a class.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21082. Move `BaseReader` into its own private header.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21082. Move `StatisticsReaderImpl` to `BaseReader`.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21082. Move `BaseReader` implementation to source file.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21082. Refactor on `DataSharingListener`.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21082. Move submessage processing to `BaseReader`.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21082. Remove friend `MessageReceiver`.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21082. Remove friend `RTPSParticipantImpl`.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21082. Remove friend `EDP`.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21082. Remove friend `WLP`.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21082. Remove friend `ReaderHistory`.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21082. Use `BaseReader` on `forEachUserReader`.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21082. Move protected methods to `BaseReader`.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21082. Move unread related methods to `BaseReader`.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21082. Move destructor actions to `BaseReader`.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21082. Move some protected fields to `BaseReader`.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21082. Move data-sharing related fields to `BaseReader`.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21082. Remove unnecessary forward declarations.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21082. Move `liveliness_changed_status_` to `BaseReader`.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21082. Rearrange inline methods.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21082. Add `downcast` methods.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21082. Expose `assert_writer_liveliness`.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21082. Move history related methods to `BaseReader`.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21082. Expose `isInCleanState`.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21082. Refactor `nextXxxCache` methods.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21082. Move sample access related methods to `BaseReader`.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21082. Minor improvements.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21082. Snake case for public methods.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21082. Use correct names for attributes.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21120. Uncrustify.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21120. Suggestions on MessageReceiver.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21120. Using alias for BaseReader.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21120. Snake case for `expects_inline_qos`.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21120. Correct name for `ReaderAttributes::liveliness_kind`.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21120. Refactor on ReaderAttributes.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21120. Getters on `RTPSReader` made const.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21120. Initialize `accept_messages_from_unkown_writers_` from new attribute.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21120. Method `init` moved to `BaseReader`.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21120. Naming style on BaseReader.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21120. Naming style on BaseReader (`reserve_cache` / `release_cache`).

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21120. Naming style on BaseReader (submessages).

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21120. Naming style on BaseReader (`find_cache_in_fragmented_process`).

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21120. Move `find_cache_in_fragmented_process` to `StatefulReader`.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21120. Naming style on BaseReader (fields).

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21120. Suggestions on RTPSReader.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21120. Remove `change_read_by_user` references.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21120. Made all API in `RTPSReader` pure virtual.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21120. Includes in `RTPSReader`.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21120. Declaration order on BaseReader.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21120. Refactor `persist_last_notified_nts`.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21120. Remove `onReaderMatched` overload.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21120. Rename to `on_reader_matched`.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21120. Rename to `on_new_cache_change_added`.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21120. Uncrustify.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21120. Refactor of mocks.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21120. Add StatefulReader unit test.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21120. Remove RTPS blackbox test.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21120. Uncrustify.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21120. Fix discovery server tests.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21120. Improve test `sample_lost_be_dw_be_dr_fragments`.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21120. Improve `find_cache_in_fragmented_process`.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21120. Doxygen motivated refactor.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21120. Refactor `reserve_cache`.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21120. Refactor `allow_unknown_writers`.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21120. Refactor `change_removed_by_history`.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21120. Improve `update_liveliness_changed_status`.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21120. More doxygen improvements.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21120. Remove `accept_messages_to_unknown_readers`.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21120. More doxygen improvements.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21120. Snake case for `ReaderTimes`.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21120. Update versions.md.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

---------

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
  • Loading branch information
MiguelCompany authored Jun 11, 2024
1 parent e92a2cc commit 8308073
Show file tree
Hide file tree
Showing 121 changed files with 2,521 additions and 1,874 deletions.
6 changes: 3 additions & 3 deletions examples/cpp/rtps/AsSocket/TestReaderSocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ bool TestReaderSocket::init(
IPLocator::setIPv4(loc, ip);
loc.port = static_cast<uint16_t>(port);
ratt.endpoint.multicastLocatorList.push_back(loc);
ratt.accept_messages_from_unkown_writers = true;
mp_reader = RTPSDomain::createRTPSReader(mp_participant, ratt, mp_history, &m_listener);
mp_reader->enableMessagesFromUnkownWriters(true);
if (mp_reader == nullptr)
{
return false;
Expand All @@ -88,11 +88,11 @@ void TestReaderSocket::run()
std::cin >> aux;
}

void TestReaderSocket::MyListener::onNewCacheChangeAdded(
void TestReaderSocket::MyListener::on_new_cache_change_added(
RTPSReader* reader,
const CacheChange_t* const change)
{
printf("Received: %s\n", change->serializedPayload.data);
reader->getHistory()->remove_change((CacheChange_t*)change);
reader->get_history()->remove_change((CacheChange_t*)change);
m_received++;
}
2 changes: 1 addition & 1 deletion examples/cpp/rtps/AsSocket/TestReaderSocket.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class TestReaderSocket
{
}

void onNewCacheChangeAdded(
void on_new_cache_change_added(
eprosima::fastrtps::rtps::RTPSReader* reader,
const eprosima::fastrtps::rtps::CacheChange_t* const change) override;
uint32_t m_received;
Expand Down
4 changes: 2 additions & 2 deletions examples/cpp/rtps/Persistent/TestReaderPersistent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,11 @@ void TestReaderPersistent::run()
std::cin.ignore();
}

void TestReaderPersistent::MyListener::onNewCacheChangeAdded(
void TestReaderPersistent::MyListener::on_new_cache_change_added(
RTPSReader* reader,
const CacheChange_t* const change)
{
printf("Received: %s\n", change->serializedPayload.data);
reader->getHistory()->remove_change((CacheChange_t*)change);
reader->get_history()->remove_change((CacheChange_t*)change);
n_received++;
}
9 changes: 3 additions & 6 deletions examples/cpp/rtps/Persistent/TestReaderPersistent.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ class TestReaderPersistent
{
}

void onNewCacheChangeAdded(
void on_new_cache_change_added(
eprosima::fastrtps::rtps::RTPSReader* reader,
const eprosima::fastrtps::rtps::CacheChange_t* const change) override;
void onReaderMatched(
void on_reader_matched(
eprosima::fastrtps::rtps::RTPSReader*,
eprosima::fastrtps::rtps::MatchingInfo& info) override
const eprosima::fastrtps::rtps::MatchingInfo& info) override
{
if (info.status == eprosima::fastrtps::rtps::MATCHED_MATCHING)
{
Expand All @@ -74,9 +74,6 @@ class TestReaderPersistent
uint32_t n_received;
uint32_t n_matched;

private:

using eprosima::fastrtps::rtps::ReaderListener::onReaderMatched;
}
m_listener;
};
Expand Down
4 changes: 2 additions & 2 deletions examples/cpp/rtps/Registered/TestReaderRegistered.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,11 @@ void TestReaderRegistered::run()
std::cin.ignore();
}

void TestReaderRegistered::MyListener::onNewCacheChangeAdded(
void TestReaderRegistered::MyListener::on_new_cache_change_added(
RTPSReader* reader,
const CacheChange_t* const change)
{
printf("Received: %s\n", change->serializedPayload.data);
reader->getHistory()->remove_change((CacheChange_t*)change);
reader->get_history()->remove_change((CacheChange_t*)change);
n_received++;
}
9 changes: 3 additions & 6 deletions examples/cpp/rtps/Registered/TestReaderRegistered.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ class TestReaderRegistered
{
}

void onNewCacheChangeAdded(
void on_new_cache_change_added(
eprosima::fastrtps::rtps::RTPSReader* reader,
const eprosima::fastrtps::rtps::CacheChange_t* const change) override;
void onReaderMatched(
void on_reader_matched(
eprosima::fastrtps::rtps::RTPSReader*,
eprosima::fastrtps::rtps::MatchingInfo& info) override
const eprosima::fastrtps::rtps::MatchingInfo& info) override
{
if (info.status == eprosima::fastrtps::rtps::MATCHED_MATCHING)
{
Expand All @@ -75,9 +75,6 @@ class TestReaderRegistered
uint32_t n_received;
uint32_t n_matched;

private:

using eprosima::fastrtps::rtps::ReaderListener::onReaderMatched;
}
m_listener;
};
Expand Down
8 changes: 4 additions & 4 deletions include/fastdds/dds/subscriber/qos/DataReaderQos.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -703,19 +703,19 @@ class DataReaderQos
}

/**
* Getter for expectsInlineQos
* Getter for expects_inline_qos
*
* @return expectsInlineQos
* @return expects_inline_qos
*/
FASTDDS_EXPORTED_API bool expects_inline_qos() const
{
return expects_inline_qos_;
}

/**
* Setter for expectsInlineQos
* Setter for expects_inline_qos
*
* @param new_value new value for the expectsInlineQos
* @param new_value new value for the expects_inline_qos
*/
FASTDDS_EXPORTED_API void expects_inline_qos(
bool new_value)
Expand Down
56 changes: 21 additions & 35 deletions include/fastdds/rtps/attributes/ReaderAttributes.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,27 +38,17 @@ class ReaderTimes
{
public:

ReaderTimes()
{
initialAcknackDelay.nanosec = 70 * 1000 * 1000;
heartbeatResponseDelay.nanosec = 5 * 1000 * 1000;
}

virtual ~ReaderTimes()
{
}

bool operator ==(
const ReaderTimes& b) const
{
return (this->initialAcknackDelay == b.initialAcknackDelay) &&
(this->heartbeatResponseDelay == b.heartbeatResponseDelay);
return (initial_acknack_delay == b.initial_acknack_delay) &&
(heartbeat_response_delay == b.heartbeat_response_delay);
}

//!Initial AckNack delay. Default value 70ms.
Duration_t initialAcknackDelay;
//!Delay to be applied when a HEARTBEAT message is received, default value 5ms.
Duration_t heartbeatResponseDelay;
//! Initial AckNack delay. Default value 70ms.
Duration_t initial_acknack_delay {0, 70 * 1000 * 1000};
//! Delay to be applied when a HEARTBEAT message is received, default value 5ms.
Duration_t heartbeat_response_delay {0, 5 * 1000 * 1000};
};

/**
Expand All @@ -70,43 +60,39 @@ class ReaderAttributes
public:

ReaderAttributes()
: liveliness_kind_(fastdds::dds::LivelinessQosPolicyKind::AUTOMATIC_LIVELINESS_QOS)
, liveliness_lease_duration(TIME_T_INFINITE_SECONDS, TIME_T_INFINITE_NANOSECONDS)
, expectsInlineQos(false)
, disable_positive_acks(false)
{
endpoint.endpointKind = READER;
endpoint.durabilityKind = VOLATILE;
endpoint.reliabilityKind = BEST_EFFORT;
}

virtual ~ReaderAttributes()
{
}
//! Attributes of the associated endpoint.
EndpointAttributes endpoint {};

//!Attributes of the associated endpoint.
EndpointAttributes endpoint;

//!Times associated with this reader (only for stateful readers)
ReaderTimes times;
//! Times associated with this reader (only for stateful readers)
ReaderTimes times {};

//! Liveliness kind
fastdds::dds::LivelinessQosPolicyKind liveliness_kind_;
fastdds::dds::LivelinessQosPolicyKind liveliness_kind =
fastdds::dds::LivelinessQosPolicyKind::AUTOMATIC_LIVELINESS_QOS;

//! Liveliness lease duration
Duration_t liveliness_lease_duration;
Duration_t liveliness_lease_duration {TIME_T_INFINITE_SECONDS, TIME_T_INFINITE_NANOSECONDS};

//!Indicates if the reader expects Inline qos, default value 0.
bool expectsInlineQos;
//! Indicates if the reader expects Inline qos, default value false.
bool expects_inline_qos = false;

//! Disable positive ACKs
bool disable_positive_acks;
bool disable_positive_acks = false;

//! Enable or disable the reception of messages from unknown writers.
bool accept_messages_from_unkown_writers = false;

//! Define the allocation behaviour for matched-writer-dependent collections.
ResourceLimitedContainerConfig matched_writers_allocation;
ResourceLimitedContainerConfig matched_writers_allocation {};

//! Thread settings for the data-sharing listener thread
fastdds::rtps::ThreadSettings data_sharing_listener_thread;
fastdds::rtps::ThreadSettings data_sharing_listener_thread {};
};

} /* namespace rtps */
Expand Down
Loading

0 comments on commit 8308073

Please sign in to comment.