Skip to content

Commit

Permalink
Update repository for Fast DDS 3.0.0 compatibility (#111)
Browse files Browse the repository at this point in the history
* Update repository for FastDDS 3.0.0 compatibility

Signed-off-by: Lucia Echevarria <luciaechevarria@eprosima.com>

* Fix tests and first approximation to change Dynamic Types

Signed-off-by: Lucia Echevarria <luciaechevarria@eprosima.com>

* Fix DynTypesParticipant::on_type_discovery_ callback to register type_name-type_id tuple and some other minor changes

Signed-off-by: Lucia Echevarria <luciaechevarria@eprosima.com>

* Change DynTypesParticipant to use RTPS Participant callbacks

Signed-off-by: Lucia Echevarria <luciaechevarria@eprosima.com>

* Regenarate types

Signed-off-by: Lucia Echevarria <luciaechevarria@eprosima.com>

* Add TypeIdentifiers to DdsTopic in order to pass the TypeInformation to RTPS Writer/Reader

Signed-off-by: Lucia Echevarria <luciaechevarria@eprosima.com>

* Apply suggested changes

Signed-off-by: Lucia Echevarria <luciaechevarria@eprosima.com>

* Apply suggested changes

Signed-off-by: Lucia Echevarria <luciaechevarria@eprosima.com>

* Regenerate types

Signed-off-by: Lucia Echevarria <luciaechevarria@eprosima.com>

* Fix compilation after rebase to fastdds master

Signed-off-by: Lucia Echevarria <luciaechevarria@eprosima.com>

* Continue rebasing to FastDDS master

Signed-off-by: Lucia Echevarria <luciaechevarria@eprosima.com>

* Change .h headers to .hpp and regenerate types

Signed-off-by: Lucia Echevarria <luciaechevarria@eprosima.com>

* Update repository with new changes in Fast DDS 3.x

Signed-off-by: Lucia Echevarria <luciaechevarria@eprosima.com>

* Remove DynamicType to IDL serialization from DDSPipe

Signed-off-by: Lucia Echevarria <luciaechevarria@eprosima.com>

* Delete public functions in PayloadPool inherited from IPayloadPool and add missing tests in CMake file

Signed-off-by: Lucia Echevarria <luciaechevarria@eprosima.com>

* Apply suggested changes

Signed-off-by: Lucia Echevarria <luciaechevarria@eprosima.com>

* Adjust to TopicDataType refactor and removal of WriterProxyData/ReaderProxyData from public API

Signed-off-by: Lucia Echevarria <luciaechevarria@eprosima.com>

* Update after refactor in Participant discovery information

Signed-off-by: Lucia Echevarria <luciaechevarria@eprosima.com>

* Update after TopicAttributes removal from public API

Signed-off-by: Lucia Echevarria <luciaechevarria@eprosima.com>

* Regenerate types

Signed-off-by: Lucia Echevarria <luciaechevarria@eprosima.com>

* Fix TopicDescription in CommonReader and CommonWriter

Signed-off-by: Lucia Echevarria <luciaechevarria@eprosima.com>

* Apply suggested changes

Signed-off-by: Lucia Echevarria <luciaechevarria@eprosima.com>

* Remove GuidPrefix attribute from DiscoveryServerConnectionAddress

Signed-off-by: Lucia Echevarria <luciaechevarria@eprosima.com>

* Remove is_keyed_ method after Publication/SubscriptionBuiltinTopicData update in Fast DDS

Signed-off-by: Lucia Echevarria <luciaechevarria@eprosima.com>

* Fix CacheChangePool after rebase

Signed-off-by: Lucia Echevarria <luciaechevarria@eprosima.com>

* Fix tests

Signed-off-by: Lucia Echevarria <luciaechevarria@eprosima.com>

* Fix uncrustify

Signed-off-by: Lucia Echevarria <luciaechevarria@eprosima.com>

* Free allocated memory in PayloadPool::release_

Signed-off-by: Lucia Echevarria <luciaechevarria@eprosima.com>

* Fill TypeInformation in Topic Description just from complete TypeIdentifier in CommonWriter (already done in CommonReader)

Signed-off-by: Lucia Echevarria <luciaechevarria@eprosima.com>

* Apply suggested changes

Signed-off-by: Lucia Echevarria <luciaechevarria@eprosima.com>

* Make payload_owner=nullptr in PayloadPool::release_ before empty() to avoid assertion failure

Signed-off-by: Lucia Echevarria <luciaechevarria@eprosima.com>

* Add assertion making sure TypeIdentifier is complete before calling add_schema

Signed-off-by: Lucia Echevarria <luciaechevarria@eprosima.com>

* Apply suggested changes

Signed-off-by: Lucia Echevarria <luciaechevarria@eprosima.com>

* Refactor rtps participants reckon_participant_attributes_

Signed-off-by: Lucia Echevarria <luciaechevarria@eprosima.com>

* Accept v6 interfaces and interface names in whitelist (#128)

Signed-off-by: Juan Lopez Fernandez <juanlopez@eprosima.com>

* Make DiscoveryServer servers' guid prefix optional (#129)

* Make DiscoveryServer servers' guid prefix optional

Signed-off-by: Juan Lopez Fernandez <juanlopez@eprosima.com>

* Raise YAML reader version

Signed-off-by: Juan Lopez Fernandez <juanlopez@eprosima.com>

* BONUS: improve participant discovery traces

Signed-off-by: Juan Lopez Fernandez <juanlopez@eprosima.com>

---------

Signed-off-by: Juan Lopez Fernandez <juanlopez@eprosima.com>

* Add missing suggested changes

Signed-off-by: Lucia Echevarria <luciaechevarria@eprosima.com>

* Correct type_kind_to_str output for TK_CHAR8 case

Signed-off-by: Lucia Echevarria <luciaechevarria@eprosima.com>

* Remove unnecessary CacheChange include

Signed-off-by: Lucia Echevarria <luciaechevarria@eprosima.com>

* Implement add_qos_properties_ in reckon_participant_qos_

Signed-off-by: Lucia Echevarria <luciaechevarria@eprosima.com>

* Remove Fast-DDS API ReturnCode explanation in PayloadPoolMediator::write

Signed-off-by: Lucia Echevarria <luciaechevarria@eprosima.com>

* Change name ip_configuration -> initial_peers_configuration

Signed-off-by: Lucia Echevarria <luciaechevarria@eprosima.com>

* Change name ds_configuration -> discovery_server_configuration

Signed-off-by: Lucia Echevarria <luciaechevarria@eprosima.com>

* Use dynamic_pointer_cast instead of static_pointer_cast in reckon_participant_attributes_

Signed-off-by: Lucia Echevarria <luciaechevarria@eprosima.com>

* Change function descriptions in CommonParticipant

Signed-off-by: Lucia Echevarria <luciaechevarria@eprosima.com>

* CHange char sequence message in tests

Signed-off-by: Lucia Echevarria <luciaechevarria@eprosima.com>

* Add clarification comment in TopicDataType::compute_key(SerializedPayload_t, ...)

Signed-off-by: Lucia Echevarria <luciaechevarria@eprosima.com>

* Fix YamlGetEntityGuidPrefixTest.get_guidprefix_explicitly test

Signed-off-by: Lucia Echevarria <luciaechevarria@eprosima.com>

* Add comment clarifying the order of TypeIdentifiers (complete and minimal) in DdsTopic.type_identifiers

Signed-off-by: Lucia Echevarria <luciaechevarria@eprosima.com>

* Fix Windows compilation

Signed-off-by: Lucia Echevarria <luciaechevarria@eprosima.com>

* Uncrustify

Signed-off-by: Lucia Echevarria <luciaechevarria@eprosima.com>

* Check if ParticipantConfiguration is nullptr after cast in reckon_participant_attributes_

Signed-off-by: Lucia Echevarria <luciaechevarria@eprosima.com>

* Fix uncrustify

Signed-off-by: Lucia Echevarria <luciaechevarria@eprosima.com>

---------

Signed-off-by: Lucia Echevarria <luciaechevarria@eprosima.com>
Signed-off-by: Juan Lopez Fernandez <juanlopez@eprosima.com>
Co-authored-by: juanlofer-eprosima <88179026+juanlofer-eprosima@users.noreply.github.com>
  • Loading branch information
LuciaEchevarria99 and juanlofer-eprosima committed Sep 10, 2024
1 parent 9de993f commit 7fff9e9
Show file tree
Hide file tree
Showing 478 changed files with 11,529 additions and 59,941 deletions.
9 changes: 0 additions & 9 deletions ddspipe_core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,6 @@ file(
"${PROJECT_SOURCE_DIR}/include/*.h*"
)

# Exclude types' files depending on the Fast DDS version
if ("${fastrtps_VERSION}" VERSION_LESS 2.13)
list(FILTER SOURCES_FILES EXCLUDE REGEX "v2/")
list(FILTER HEADERS_FILES EXCLUDE REGEX "v2/")
else()
list(FILTER SOURCES_FILES EXCLUDE REGEX "v1/")
list(FILTER HEADERS_FILES EXCLUDE REGEX "v1/")
endif()

# Compile C++ library
compile_library(
"${PROJECT_SOURCE_DIR}/src/cpp" # Source directory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <map>
#include <mutex>

#include <fastdds/rtps/common/SampleIdentity.h>
#include <fastdds/rtps/common/SampleIdentity.hpp>

#include <ddspipe_core/types/dds/Guid.hpp>
#include <ddspipe_core/types/participant/ParticipantId.hpp>
Expand All @@ -28,9 +28,9 @@ namespace eprosima {
namespace ddspipe {
namespace core {

using SampleIdentity = eprosima::fastrtps::rtps::SampleIdentity;
using SampleIdentity = eprosima::fastdds::rtps::SampleIdentity;

using SequenceNumber = eprosima::fastrtps::rtps::SequenceNumber_t;
using SequenceNumber = eprosima::fastdds::rtps::SequenceNumber_t;

/**
* Class used to store the information associated to a service request, so its reply can be forwarded through the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@ struct DdsPublishingConfiguration : public IConfiguration

//! The DDS topic name to publish in.
std::string topic_name{};

//! Whether the LogEntry type should be published or not.
bool publish_type = false;
};

} /* namespace core */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
#include <string>
#include <thread>

#include <fastrtps/utils/DBQueue.h>
#include <cpp_utils/queue/DBQueue.hpp>
#include <cpp_utils/ReturnCode.hpp>

#include <ddspipe_core/types/dds/Endpoint.hpp>
#include <ddspipe_core/types/dds/Guid.hpp>
#include <cpp_utils/ReturnCode.hpp>
#include <ddspipe_core/types/topic/dds/DistributedTopic.hpp>

namespace eprosima {
Expand Down Expand Up @@ -263,7 +263,7 @@ class DiscoveryDatabase
mutable std::mutex callbacks_mutex_;

//! Queue storing database operations to be performed in a dedicated thread
fastrtps::DBQueue<std::tuple<DatabaseOperation, types::Endpoint>> entities_to_process_;
utils::event::DBQueue<std::tuple<DatabaseOperation, types::Endpoint>> entities_to_process_;

//! Handle of thread dedicated to performing database operations
std::thread queue_processing_thread_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,16 @@ class CopyPayloadPool : public PayloadPool
//! Reserve a new memory space
bool get_payload(
uint32_t size,
types::Payload& payload) override;
eprosima::fastdds::rtps::SerializedPayload_t& payload) override;

//! Reserve a new memory space and copy the data from \c src_payload to \c target_payload
bool get_payload(
const types::Payload& src_payload,
IPayloadPool*& data_owner,
types::Payload& target_payload) override;
const eprosima::fastdds::rtps::SerializedPayload_t& src_payload,
eprosima::fastdds::rtps::SerializedPayload_t& target_payload) override;

//! Release data in \c payload
bool release_payload(
types::Payload& payload) override;
eprosima::fastdds::rtps::SerializedPayload_t& payload) override;
};

} /* namespace core */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ typedef std::atomic<unsigned int> MetaInfoType;
* This class is used to manage the allocation and release of the payloads used within the Router.
* The main target is not to copy or alloc data that is already in memory, but to reuse it safely.
*
* This implementation uses an idea get from TopicPayloadPool from fastrtps.
* This implementation uses an idea get from TopicPayloadPool from fastdds.
* This is, to alloc more space than required whenever a new payload is needed, and in this extra space (at the
* beginning of the data) stores the number of references this data has.
* As long as this number does not reach 0, the data is not deleted.
Expand Down Expand Up @@ -76,7 +76,7 @@ class FastPayloadPool : public PayloadPool
DDSPIPE_CORE_DllAPI
bool get_payload(
uint32_t size,
types::Payload& payload) override;
eprosima::fastdds::rtps::SerializedPayload_t& payload) override;

/**
* Reserve in \c target_payload the payload in \c src_payload .
Expand All @@ -95,9 +95,8 @@ class FastPayloadPool : public PayloadPool
*/
DDSPIPE_CORE_DllAPI
bool get_payload(
const types::Payload& src_payload,
IPayloadPool*& data_owner,
types::Payload& target_payload) override;
const eprosima::fastdds::rtps::SerializedPayload_t& src_payload,
eprosima::fastdds::rtps::SerializedPayload_t& payload) override;

/**
* Release a payload that has been reserved from this pool.
Expand All @@ -113,7 +112,7 @@ class FastPayloadPool : public PayloadPool
*/
DDSPIPE_CORE_DllAPI
bool release_payload(
types::Payload& payload) override;
eprosima::fastdds::rtps::SerializedPayload_t& payload) override;

protected:

Expand All @@ -132,7 +131,7 @@ class FastPayloadPool : public PayloadPool
DDSPIPE_CORE_DllAPI
virtual bool reserve_(
uint32_t size,
types::Payload& payload) override;
eprosima::fastdds::rtps::SerializedPayload_t& payload) override;

/**
* @brief Reimplement parent \c release_ method
Expand All @@ -146,7 +145,7 @@ class FastPayloadPool : public PayloadPool
*/
DDSPIPE_CORE_DllAPI
virtual bool release_(
types::Payload& payload) override;
eprosima::fastdds::rtps::SerializedPayload_t& payload) override;
};

} /* namespace core */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class MapPayloadPool : public PayloadPool
*/
bool get_payload(
uint32_t size,
types::Payload& payload) override;
eprosima::fastdds::rtps::SerializedPayload_t& payload) override;

/**
* @brief Set \c target_payload data to \c src_payload .
Expand All @@ -78,9 +78,8 @@ class MapPayloadPool : public PayloadPool
* @throw utils::InconsistencyException if \c data_owner is \c this but the data in \c src_payload is not from this pool.
*/
bool get_payload(
const types::Payload& src_payload,
IPayloadPool*& data_owner,
types::Payload& target_payload) override;
const eprosima::fastdds::rtps::SerializedPayload_t& src_payload,
eprosima::fastdds::rtps::SerializedPayload_t& payload) override;

/**
* @brief Decrease reference counter for data in \c payload .
Expand All @@ -96,7 +95,7 @@ class MapPayloadPool : public PayloadPool
* @throw utils::InconsistencyException if the data in \c payload is not from this pool.
*/
bool release_payload(
types::Payload& payload) override;
eprosima::fastdds::rtps::SerializedPayload_t& payload) override;

protected:

Expand Down
153 changes: 2 additions & 151 deletions ddspipe_core/include/ddspipe_core/efficiency/payload/PayloadPool.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@

#include <atomic>

#include <fastdds/rtps/common/CacheChange.h>
#include <fastdds/rtps/common/SerializedPayload.h>
#include <fastdds/rtps/history/IPayloadPool.h>
#include <fastdds/rtps/history/IPayloadPool.hpp>

#include <ddspipe_core/types/dds/Payload.hpp>

Expand All @@ -38,7 +36,7 @@ namespace core {
* Then, this payload will be moved to the Track. As the payload is already in the pool, there will be no copy.
* Finally, the payload will be moved to every Writer that has to send the data (ideally without copy).
*/
class PayloadPool : public eprosima::fastrtps::rtps::IPayloadPool
class PayloadPool : public eprosima::fastdds::rtps::IPayloadPool
{
public:

Expand All @@ -50,153 +48,6 @@ class PayloadPool : public eprosima::fastrtps::rtps::IPayloadPool
DDSPIPE_CORE_DllAPI
virtual ~PayloadPool();

/////
// FAST DDS PART

/**
* @brief Reserve in \c cache_change a new payload of max size \c size .
*
* It sets values to the serialized payload inside \c cache_change .
* This method calls \c get_payload for the serialized payload.
* The \c cache_change owner is set to \c this .
*
* @warning length value in \c payload is not modified.
*
* @note This method may reserve new memory.
*
* @param [in] size : Size in bytes of the payload that will be reserved
* @param [out] cache_change : the cache change which SerializedPayload will be set
*
* @return true if everything ok
* @return false if something went wrong
*
* @pre Fields @c cache_change must not have the serialized payload initialized.
*/
DDSPIPE_CORE_DllAPI
virtual bool get_payload(
uint32_t size,
eprosima::fastrtps::rtps::CacheChange_t& cache_change) override; // TODO add noexcept once is implemented

/**
* @brief Store in \c cache_change the \c data payload.
*
* This method set \c cache_change serialized payload to the same data in \c data .
* This method should reuse \c data and not copy it in case the owner of \c data is \c this .
* It sets values to the serialized payload inside \c cache_change .
*
* This method calls \c get_payload for the serialized payload.
* The \c cache_change owner is set to \c this .
*
* @note This method may reserve new memory in case the owner is not \c this .
*
* @param [in,out] data Serialized payload received
* @param [in,out] data_owner Payload pool owning incoming data \c data
* @param [in,out] cache_change Cache change to assign the payload to
*
* @warning @c data_owner can only be changed from @c nullptr to @c this. If a value different from
* @c nullptr is received it should be left unchanged.
*
* @return true if everything ok
* @return false if something went wrong
*
* @pre Fields @c cache_change must not have the serialized payload initialized.
*/
DDSPIPE_CORE_DllAPI
virtual bool get_payload(
eprosima::fastrtps::rtps::SerializedPayload_t& data,
IPayloadPool*& data_owner,
eprosima::fastrtps::rtps::CacheChange_t& cache_change) override; // TODO add noexcept once is implemented

/**
* @brief Release the data from the serialized payload inside \c cache_change .
*
* @note This method must only release the actual memory of a data in case nobody is referencing it anymore.
*
* This method calls \c release_payload for the serialized payload.
* The \c cache_change owner is set to \c nullptr .
*
* @param [in,out] cache_change Cache change to release the payload from
*
* @return true if everything ok
* @return false if something went wrong
*
* @throw IncosistencyException if cache change owner is other than this
*/
DDSPIPE_CORE_DllAPI
virtual bool release_payload(
eprosima::fastrtps::rtps::CacheChange_t& cache_change) override; // TODO add noexcept once is implemented

/////
// DDSPIPE PART

/**
* @brief Reserve a new data in \c payload of size \c size.
*
* It sets value \c max_size and \c data of \c payload .
*
* @note This method may reserve new memory.
*
* @warning length value in \c payload is not modified.
*
* @param [in] size : Size in bytes of the payload that will be reserved
* @param [out] payload : the SerializedPayload that will be set
*
* @return true if everything ok
* @return false if something went wrong
*
* @pre Fields @c payload must not have been initialized.
*/
DDSPIPE_CORE_DllAPI
virtual bool get_payload(
uint32_t size,
types::Payload& payload) = 0;

/**
* @brief Store in \c target_payload the data from \c src_payload .
*
* This method set \c target_payload fields \c max_size , \c lenght and \c data .
* This method "should" reuse data in \c src_payload and not copy it in case \c data_owner is \c this .
*
* @note This method may reserve new memory in case the owner is not \c this .
*
* @param [in] src_payload Payload to move to target
* @param [in,out] data_owner Payload pool owning incoming data \c src_payload
* @param [out] target_payload Payload to assign the payload to
*
* @warning @c data_owner can only be changed from @c nullptr to @c this. If a value different from
* @c nullptr is received it must be left unchanged.
*
* @return true if everything ok
* @return false if something went wrong
*
* @pre Fields @c target_payload must not have been initialized.
*/
DDSPIPE_CORE_DllAPI
virtual bool get_payload(
const types::Payload& src_payload,
IPayloadPool*& data_owner,
types::Payload& target_payload) = 0;

/**
* @brief Release the data from the \c payload .
*
* @note This method must only release the actual memory of a data in case nobody is referencing it anymore.
*
* @note This method should use method \c reserve_ to reserve new memory.
*
* Reset the \c payload info.
*
* @param [in,out] payload Payload to release data from
*
* @return true if everything ok
* @return false if something went wrong
*
* @pre @c payload must have been initialized from this pool.
*/
DDSPIPE_CORE_DllAPI
virtual bool release_payload(
types::Payload& payload) = 0;

//! Wether every payload get has been released.
DDSPIPE_CORE_DllAPI
virtual bool is_clean() const noexcept;
Expand Down
Loading

0 comments on commit 7fff9e9

Please sign in to comment.