From 741dd687932573f7b7a35a6c8e317d2cc64cb2cd Mon Sep 17 00:00:00 2001 From: tempate Date: Tue, 17 Oct 2023 09:07:29 +0200 Subject: [PATCH] Fix compilation in Ubuntu 20.04 debug Signed-off-by: tempate --- .../ddspipe_core/types/dds/TopicQoS.hpp | 92 +++++++++++++++---- ddspipe_core/src/cpp/types/dds/TopicQoS.cpp | 23 +++-- 2 files changed, 86 insertions(+), 29 deletions(-) diff --git a/ddspipe_core/include/ddspipe_core/types/dds/TopicQoS.hpp b/ddspipe_core/include/ddspipe_core/types/dds/TopicQoS.hpp index e38e25fc..721a512f 100644 --- a/ddspipe_core/include/ddspipe_core/types/dds/TopicQoS.hpp +++ b/ddspipe_core/include/ddspipe_core/types/dds/TopicQoS.hpp @@ -103,7 +103,52 @@ TopicQoS ///////////////////////// /** - * @brief Global value to store the default history depth in this execution. + * @brief Global value to store the default durability qos in this execution. + * + * This value can change along the execution. + * Every new TopicQoS object will use this value as \c durability_qos default. + */ + DDSPIPE_CORE_DllAPI + static std::atomic default_durability_qos; + + /** + * @brief Global value to store the default reliability qos in this execution. + * + * This value can change along the execution. + * Every new TopicQoS object will use this value as \c reliability_qos default. + */ + DDSPIPE_CORE_DllAPI + static std::atomic default_reliability_qos; + + /** + * @brief Global value to store the default ownership qos in this execution. + * + * This value can change along the execution. + * Every new TopicQoS object will use this value as \c ownership_qos default. + */ + DDSPIPE_CORE_DllAPI + static std::atomic default_ownership_qos; + + /** + * @brief Global value to store the default use_partitions in this execution. + * + * This value can change along the execution. + * Every new TopicQoS object will use this value as \c use_partitions default. + */ + DDSPIPE_CORE_DllAPI + static std::atomic default_use_partitions; + + /** + * @brief Global value to store the default keyed in this execution. + * + * This value can change along the execution. + * Every new TopicQoS object will use this value as \c keyed default. + */ + DDSPIPE_CORE_DllAPI + static std::atomic default_keyed; + + /** + * @brief Global value to store the default in this execution. * * This value can change along the execution. * Every new TopicQoS object will use this value as \c history_depth default. @@ -142,10 +187,10 @@ TopicQoS // VARIABLES ///////////////////////// - //! Durability kind (Default = VOLATILE) + //! Durability kind utils::Fuzzy durability_qos; - //! Reliability kind (Default = BEST_EFFORT) + //! Reliability kind utils::Fuzzy reliability_qos; //! Ownership kind of the topic @@ -154,17 +199,12 @@ TopicQoS //! Whether the topics uses partitions utils::Fuzzy use_partitions; - /** - * @brief History Qos - * - * @note Default value would be taken from \c default_history_depth in object creation. - * @note It only stores the depth because in pipe it will always be keep last, as RTPS has not resource limits. - */ - utils::Fuzzy history_depth; - //! Whether the topic has key or not utils::Fuzzy keyed; + //! Depth of the history + utils::Fuzzy history_depth; + //! Discard msgs if less than 1/rate seconds elapsed since the last sample was transmitted [Hz]. Default: 0 (no limit) utils::Fuzzy max_tx_rate; @@ -174,33 +214,45 @@ TopicQoS //! Downsampling factor: keep 1 out of every *downsampling* samples received (downsampling=1 <=> no downsampling) utils::Fuzzy downsampling; + ////////////////////////////////////////// + // GLOBAL VARIABLES' DEFAULT VALUES + ////////////////////////////////////////// //! Durability kind (Default = VOLATILE) - static constexpr DurabilityKind DURABILITY_QOS_DEFAULT = DurabilityKind::VOLATILE; + DDSPIPE_CORE_DllAPI + static constexpr const DurabilityKind DEFAULT_DURABILITY_QOS = DurabilityKind::VOLATILE; //! Reliability kind (Default = BEST_EFFORT) - static constexpr ReliabilityKind RELIABILITY_QOS_DEFAULT = ReliabilityKind::BEST_EFFORT; + DDSPIPE_CORE_DllAPI + static constexpr const ReliabilityKind DEFAULT_RELIABILITY_QOS = ReliabilityKind::BEST_EFFORT; //! Ownership kind (Default = SHARED_OWNERSHIP) - static constexpr OwnershipQosPolicyKind OWNERSHIP_QOS_DEFAULT = OwnershipQosPolicyKind::SHARED_OWNERSHIP_QOS; + DDSPIPE_CORE_DllAPI + static constexpr const OwnershipQosPolicyKind DEFAULT_OWNERSHIP_QOS = OwnershipQosPolicyKind::SHARED_OWNERSHIP_QOS; //! Whether the topic uses partitions (Default = False) - static constexpr bool USE_PARTITIONS_DEFAULT = false; + DDSPIPE_CORE_DllAPI + static constexpr const bool DEFAULT_USE_PARTITIONS = false; //! History depth (Default = 5000) - static constexpr HistoryDepthType HISTORY_DEPTH_DEFAULT = 5000; + DDSPIPE_CORE_DllAPI + static constexpr const HistoryDepthType DEFAULT_HISTORY_DEPTH = 5000; //! Whether the topic has a key (Default = False) - static constexpr bool KEYED_DEFAULT = false; + DDSPIPE_CORE_DllAPI + static constexpr const bool DEFAULT_KEYED = false; //! Max Tx Rate (Default = 0) - static constexpr float MAX_TX_RATE_DEFAULT = 0; + DDSPIPE_CORE_DllAPI + static constexpr const float DEFAULT_MAX_TX_RATE = 0; //! Max Rx Rate (Default = 0) - static constexpr float MAX_RX_RATE_DEFAULT = 0; + DDSPIPE_CORE_DllAPI + static constexpr const float DEFAULT_MAX_RX_RATE = 0; //! Downsampling (Default = 1) - static constexpr unsigned int DOWNSAMPLING_DEFAULT = 1; + DDSPIPE_CORE_DllAPI + static constexpr const unsigned int DEFAULT_DOWNSAMPLING = 1; }; /** diff --git a/ddspipe_core/src/cpp/types/dds/TopicQoS.cpp b/ddspipe_core/src/cpp/types/dds/TopicQoS.cpp index db03aaad..07abf216 100644 --- a/ddspipe_core/src/cpp/types/dds/TopicQoS.cpp +++ b/ddspipe_core/src/cpp/types/dds/TopicQoS.cpp @@ -25,27 +25,32 @@ namespace ddspipe { namespace core { namespace types { -std::atomic TopicQoS::default_history_depth{HISTORY_DEPTH_DEFAULT}; -std::atomic TopicQoS::default_max_tx_rate{MAX_TX_RATE_DEFAULT}; -std::atomic TopicQoS::default_max_rx_rate{MAX_RX_RATE_DEFAULT}; -std::atomic TopicQoS::default_downsampling{DOWNSAMPLING_DEFAULT}; +std::atomic TopicQoS::default_durability_qos{DEFAULT_DURABILITY_QOS}; +std::atomic TopicQoS::default_reliability_qos{DEFAULT_RELIABILITY_QOS}; +std::atomic TopicQoS::default_ownership_qos{DEFAULT_OWNERSHIP_QOS}; +std::atomic TopicQoS::default_use_partitions{DEFAULT_USE_PARTITIONS}; +std::atomic TopicQoS::default_keyed{DEFAULT_KEYED}; +std::atomic TopicQoS::default_history_depth{DEFAULT_HISTORY_DEPTH}; +std::atomic TopicQoS::default_max_tx_rate{DEFAULT_MAX_TX_RATE}; +std::atomic TopicQoS::default_max_rx_rate{DEFAULT_MAX_RX_RATE}; +std::atomic TopicQoS::default_downsampling{DEFAULT_DOWNSAMPLING}; TopicQoS::TopicQoS() { // Set the default durability - durability_qos.set_value(DURABILITY_QOS_DEFAULT, utils::FuzzyLevelValues::fuzzy_level_default); + durability_qos.set_value(default_durability_qos, utils::FuzzyLevelValues::fuzzy_level_default); // Set the default reliabitliy - reliability_qos.set_value(RELIABILITY_QOS_DEFAULT, utils::FuzzyLevelValues::fuzzy_level_default); + reliability_qos.set_value(default_reliability_qos, utils::FuzzyLevelValues::fuzzy_level_default); // Set the default ownership - ownership_qos.set_value(OWNERSHIP_QOS_DEFAULT, utils::FuzzyLevelValues::fuzzy_level_default); + ownership_qos.set_value(default_ownership_qos, utils::FuzzyLevelValues::fuzzy_level_default); // Set whether by default the Topic should use partitions - use_partitions.set_value(USE_PARTITIONS_DEFAULT, utils::FuzzyLevelValues::fuzzy_level_default); + use_partitions.set_value(default_use_partitions, utils::FuzzyLevelValues::fuzzy_level_default); // Set whether by default the Topic has a key - keyed.set_value(KEYED_DEFAULT, utils::FuzzyLevelValues::fuzzy_level_default); + keyed.set_value(default_keyed, utils::FuzzyLevelValues::fuzzy_level_default); // Set the default history depth history_depth.set_value(default_history_depth, utils::FuzzyLevelValues::fuzzy_level_default);