From 4be91b00f68d78307f19292601fd52cc2d25d2f2 Mon Sep 17 00:00:00 2001 From: Erik Boasson Date: Thu, 19 Aug 2021 16:30:32 +0200 Subject: [PATCH] Add IgnoreLocal reader, writer QoS setting Signed-off-by: Erik Boasson --- .../include/dds/core/policy/CorePolicy.hpp | 4 + .../include/dds/core/policy/PolicyKind.hpp | 11 +++ .../include/dds/core/policy/TCorePolicy.hpp | 67 ++++++++++++++++ .../dds/core/policy/detail/CorePolicy.hpp | 3 + .../core/policy/detail/TCorePolicyImpl.hpp | 39 ++++++++++ .../dds/pub/qos/detail/DataWriterQos.hpp | 1 + .../dds/sub/qos/detail/DataReaderQos.hpp | 1 + .../eclipse/cyclonedds/core/policy/Policy.hpp | 28 +++++++ .../cyclonedds/core/policy/PolicyDelegate.hpp | 25 ++++++ .../pub/qos/DataWriterQosDelegate.hpp | 12 +++ .../sub/qos/DataReaderQosDelegate.hpp | 15 ++++ src/ddscxx/src/dds/core/policy/CorePolicy.cpp | 1 + .../cyclonedds/core/policy/PolicyDelegate.cpp | 78 +++++++++++++++++++ .../pub/qos/DataWriterQosDelegate.cpp | 23 +++++- .../sub/qos/DataReaderQosDelegate.cpp | 22 +++++- src/ddscxx/tests/Qos.cpp | 21 +++-- 16 files changed, 344 insertions(+), 7 deletions(-) diff --git a/src/ddscxx/include/dds/core/policy/CorePolicy.hpp b/src/ddscxx/include/dds/core/policy/CorePolicy.hpp index 25d1c120..2567c1c0 100644 --- a/src/ddscxx/include/dds/core/policy/CorePolicy.hpp +++ b/src/ddscxx/include/dds/core/policy/CorePolicy.hpp @@ -148,6 +148,9 @@ TypeConsistencyEnforcement; typedef dds::core::policy::detail::PSMXInstances PSMXInstances; +typedef dds::core::policy::detail::IgnoreLocal +IgnoreLocal; + typedef dds::core::policy::detail::UserData UserData; @@ -199,6 +202,7 @@ OMG_DDS_POLICY_TRAITS(TypeConsistencyEnforcement, 24) #endif // OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT OMG_DDS_POLICY_TRAITS(WriterBatching, 25) OMG_DDS_POLICY_TRAITS(PSMXInstances, 34) +OMG_DDS_POLICY_TRAITS(IgnoreLocal, 35) } } diff --git a/src/ddscxx/include/dds/core/policy/PolicyKind.hpp b/src/ddscxx/include/dds/core/policy/PolicyKind.hpp index 16e99aac..a6781aa5 100644 --- a/src/ddscxx/include/dds/core/policy/PolicyKind.hpp +++ b/src/ddscxx/include/dds/core/policy/PolicyKind.hpp @@ -253,6 +253,17 @@ struct TypeConsistencyKind_def typedef dds::core::safe_enum TypeConsistencyKind; +struct IgnoreLocalKind_def +{ + enum Type + { + NONE, + PARTICIPANT, + PROCESS + }; +}; +typedef dds::core::safe_enum IgnoreLocalKind; + } } } diff --git a/src/ddscxx/include/dds/core/policy/TCorePolicy.hpp b/src/ddscxx/include/dds/core/policy/TCorePolicy.hpp index c1cedaee..bf53ae01 100644 --- a/src/ddscxx/include/dds/core/policy/TCorePolicy.hpp +++ b/src/ddscxx/include/dds/core/policy/TCorePolicy.hpp @@ -1939,6 +1939,73 @@ class TPSMXInstances : public dds::core::Value const dds::core::StringSeq instances() const; }; +//============================================================================== + +/** + * \copydoc DCPS_QoS_Durability + */ +template +class TIgnoreLocal : public dds::core::Value +{ +public: + /** + * Creates a IgnoreLocal QoS instance + * + * @param kind the kind + */ + explicit TIgnoreLocal( + dds::core::policy::IgnoreLocalKind::Type kind = dds::core::policy::IgnoreLocalKind::NONE); + + /** + * Copies a IgnoreLocal QoS instance + * + * @param other the IgnoreLocal QoS instance to copy + */ + TIgnoreLocal(const TIgnoreLocal& other); + + /** + * Copies a IgnoreLocal QoS instance + * + * @param other the IgnoreLocal QoS instance to copy + * + * @return reference to the IgnoreLocal QoS that was copied to + */ + TIgnoreLocal& operator=(const TIgnoreLocal& other) = default; + +public: + /** + * Set the kind + * + * @param kind the kind to set + * + * @return the kind that was set + */ + TIgnoreLocal& kind(dds::core::policy::IgnoreLocalKind::Type kind); + + /** + * Get the kind + * + * @return the kind + */ + dds::core::policy::IgnoreLocalKind::Type kind() const; + +public: + /** + * @return a IgnoreLocal QoS instance with the kind set to NONE + */ + static TIgnoreLocal None(); + + /** + * @return a IgnoreLocal QoS instance with the kind set to PARTICIPANT + */ + static TIgnoreLocal Participant(); + + /** + * @return a IgnoreLocal QoS instance with the kind set to PROCESS + */ + static TIgnoreLocal Process(); +}; + } } } diff --git a/src/ddscxx/include/dds/core/policy/detail/CorePolicy.hpp b/src/ddscxx/include/dds/core/policy/detail/CorePolicy.hpp index 00ab811c..1f8c1a89 100644 --- a/src/ddscxx/include/dds/core/policy/detail/CorePolicy.hpp +++ b/src/ddscxx/include/dds/core/policy/detail/CorePolicy.hpp @@ -109,6 +109,9 @@ namespace dds { namespace core { namespace policy { namespace detail { typedef dds::core::policy::TWriterBatching WriterBatching; + + typedef dds::core::policy::TIgnoreLocal + IgnoreLocal; } } } } // namespace dds::core::policy::detail diff --git a/src/ddscxx/include/dds/core/policy/detail/TCorePolicyImpl.hpp b/src/ddscxx/include/dds/core/policy/detail/TCorePolicyImpl.hpp index 12c6ef72..798bf058 100644 --- a/src/ddscxx/include/dds/core/policy/detail/TCorePolicyImpl.hpp +++ b/src/ddscxx/include/dds/core/policy/detail/TCorePolicyImpl.hpp @@ -1174,6 +1174,45 @@ const dds::core::StringSeq TPSMXInstances::instances() const return this->delegate().instances(); } +//TIgnoreLocal + +template +TIgnoreLocal::TIgnoreLocal(dds::core::policy::IgnoreLocalKind::Type kind) : dds::core::Value(kind) { } + +template +TIgnoreLocal::TIgnoreLocal(const TIgnoreLocal& other) : dds::core::Value(other.delegate()) { } + +template +TIgnoreLocal& TIgnoreLocal::kind(dds::core::policy::IgnoreLocalKind::Type kind) +{ + this->delegate().kind(kind); + return *this; +} + +template +dds::core::policy::IgnoreLocalKind::Type TIgnoreLocal::kind() const +{ + return this->delegate().kind(); +} + +template +TIgnoreLocal TIgnoreLocal::None() +{ + return TIgnoreLocal(dds::core::policy::IgnoreLocalKind::NONE); +} + +template +TIgnoreLocal TIgnoreLocal::Participant() +{ + return TIgnoreLocal(dds::core::policy::IgnoreLocalKind::PARTICIPANT); +} + +template +TIgnoreLocal TIgnoreLocal::Process() +{ + return TIgnoreLocal(dds::core::policy::IgnoreLocalKind::PROCESS); +} + } } } diff --git a/src/ddscxx/include/dds/pub/qos/detail/DataWriterQos.hpp b/src/ddscxx/include/dds/pub/qos/detail/DataWriterQos.hpp index 3697ad69..9b450c3a 100644 --- a/src/ddscxx/include/dds/pub/qos/detail/DataWriterQos.hpp +++ b/src/ddscxx/include/dds/pub/qos/detail/DataWriterQos.hpp @@ -54,6 +54,7 @@ * dds::core::policy::DataRepresentation | Supported data representation kinds (@ref DCPS_QoS_DataRepresentation "info") | DataRepresentation::DataRepresentation(dds::core::policy::DataRepresentationId::XCDR1) * dds::core::policy::TypeConsistencyEnforcement | Type consistency enforcement policies (@ref DCPS_QoS_TypeConsistencyEnforcement "info") | dds::core::policy::TypeConsistencyKind::DISALLOW_TYPE_COERCION * dds::core::policy::WriterBatching | Writer data batching | dds::core::policy::WriterBatching::DoNotBatchUpdates() + * dds::core::policy::IgnoreLocal | Ignore local readers | dds::core::policy::IgnoreLocal::None() * * A QosPolicy can be set when the DataWriter is created or modified with the set * qos operation. diff --git a/src/ddscxx/include/dds/sub/qos/detail/DataReaderQos.hpp b/src/ddscxx/include/dds/sub/qos/detail/DataReaderQos.hpp index 14d3265a..c775ac23 100644 --- a/src/ddscxx/include/dds/sub/qos/detail/DataReaderQos.hpp +++ b/src/ddscxx/include/dds/sub/qos/detail/DataReaderQos.hpp @@ -50,6 +50,7 @@ * dds::core::policy::ReaderDataLifecycle | Instance state changes and notifications (@ref DCPS_QoS_ReaderDataLifecycle "info") | ReaderDataLifecycle::NoAutoPurgeDisposedSamples() * dds::core::policy::DataRepresentation | Supported data representation kinds (@ref DCPS_QoS_DataRepresentation "info") | DataRepresentation::DataRepresentation(dds::core::policy::DataRepresentationId::XCDR1) * dds::core::policy::TypeConsistencyEnforcement | Type consistency enforcement policies (@ref DCPS_QoS_TypeConsistencyEnforcement "info") | dds::core::policy::TypeConsistencyKind::DISALLOW_TYPE_COERCION + * dds::core::policy::IgnoreLocal | Ignore local readers | dds::core::policy::IgnoreLocal::None() * * A QosPolicy can be set when the DataReader is created or modified with the set * qos operation. diff --git a/src/ddscxx/include/org/eclipse/cyclonedds/core/policy/Policy.hpp b/src/ddscxx/include/org/eclipse/cyclonedds/core/policy/Policy.hpp index 91ee5a1d..34208079 100644 --- a/src/ddscxx/include/org/eclipse/cyclonedds/core/policy/Policy.hpp +++ b/src/ddscxx/include/org/eclipse/cyclonedds/core/policy/Policy.hpp @@ -39,6 +39,33 @@ static const std::string& name(); \ }; +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace core +{ +namespace policy +{ +template +class policy_id; +template +class policy_name; + +/* + * Proprietary policies values + */ +typedef dds::core::policy::TIgnoreLocal IgnoreLocal; + +} +} +} +} +} + + namespace dds { namespace core @@ -49,6 +76,7 @@ template class policy_id; template class policy_name; + } } } diff --git a/src/ddscxx/include/org/eclipse/cyclonedds/core/policy/PolicyDelegate.hpp b/src/ddscxx/include/org/eclipse/cyclonedds/core/policy/PolicyDelegate.hpp index f65532be..589ef303 100644 --- a/src/ddscxx/include/org/eclipse/cyclonedds/core/policy/PolicyDelegate.hpp +++ b/src/ddscxx/include/org/eclipse/cyclonedds/core/policy/PolicyDelegate.hpp @@ -916,6 +916,31 @@ class OMG_DDS_API WriterBatchingDelegate bool batch_updates_; }; +//============================================================================== + +class OMG_DDS_API IgnoreLocalDelegate +{ +public: + IgnoreLocalDelegate(const IgnoreLocalDelegate& other); + explicit IgnoreLocalDelegate(dds::core::policy::IgnoreLocalKind::Type kind); + + IgnoreLocalDelegate& operator=(const IgnoreLocalDelegate& other) = default; + + void kind(dds::core::policy::IgnoreLocalKind::Type kind); + dds::core::policy::IgnoreLocalKind::Type kind() const; + + bool operator ==(const IgnoreLocalDelegate& other) const; + + void check() const; + + void set_iso_policy(const dds_qos_t* qos); + void set_c_policy(dds_qos_t* qos) const; + +public: + dds::core::policy::IgnoreLocalKind::Type kind_; +}; + +//============================================================================== #ifdef OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT diff --git a/src/ddscxx/include/org/eclipse/cyclonedds/pub/qos/DataWriterQosDelegate.hpp b/src/ddscxx/include/org/eclipse/cyclonedds/pub/qos/DataWriterQosDelegate.hpp index 2930200a..7b619a77 100644 --- a/src/ddscxx/include/org/eclipse/cyclonedds/pub/qos/DataWriterQosDelegate.hpp +++ b/src/ddscxx/include/org/eclipse/cyclonedds/pub/qos/DataWriterQosDelegate.hpp @@ -62,6 +62,7 @@ class OMG_DDS_API DataWriterQosDelegate #endif // OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT void policy(const dds::core::policy::WriterBatching& writerbatching); void policy(const dds::core::policy::PSMXInstances& psmxinstances); + void policy(const dds::core::policy::IgnoreLocal& ignorelocal); template const POLICY& policy() const; template POLICY& policy(); @@ -106,6 +107,7 @@ class OMG_DDS_API DataWriterQosDelegate #endif // OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT dds::core::policy::WriterBatching writerbatching_; dds::core::policy::PSMXInstances psmxinstances_; + dds::core::policy::IgnoreLocal ignorelocal_; }; @@ -294,6 +296,16 @@ DataWriterQosDelegate::policy() const return psmxinstances_; } +template<> inline const dds::core::policy::IgnoreLocal& +DataWriterQosDelegate::policy() const +{ + return ignorelocal_; +} + +template<> OMG_DDS_API dds::core::policy::IgnoreLocal& +DataWriterQosDelegate::policy(); + + } } } diff --git a/src/ddscxx/include/org/eclipse/cyclonedds/sub/qos/DataReaderQosDelegate.hpp b/src/ddscxx/include/org/eclipse/cyclonedds/sub/qos/DataReaderQosDelegate.hpp index 2a39abd0..f03ffaca 100644 --- a/src/ddscxx/include/org/eclipse/cyclonedds/sub/qos/DataReaderQosDelegate.hpp +++ b/src/ddscxx/include/org/eclipse/cyclonedds/sub/qos/DataReaderQosDelegate.hpp @@ -54,6 +54,7 @@ class OMG_DDS_API DataReaderQosDelegate void policy(const dds::core::policy::TypeConsistencyEnforcement& typeconsistencyenforcement); #endif // OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT void policy(const dds::core::policy::PSMXInstances& psmxinstances); + void policy(const dds::core::policy::IgnoreLocal& ignorelocal); template const POLICY& policy() const; template POLICY& policy(); @@ -90,6 +91,7 @@ class OMG_DDS_API DataReaderQosDelegate dds::core::policy::TypeConsistencyEnforcement typeconsistencyenforcement_; #endif // OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT dds::core::policy::PSMXInstances psmxinstances_; + dds::core::policy::IgnoreLocal ignorelocal_; }; @@ -251,6 +253,19 @@ DataReaderQosDelegate::policy() const return psmxinstances_; } + +template<> +inline const dds::core::policy::IgnoreLocal& +DataReaderQosDelegate::policy() const +{ + return ignorelocal_; +} + +template<> +OMG_DDS_API dds::core::policy::IgnoreLocal& +DataReaderQosDelegate::policy(); + + } } } diff --git a/src/ddscxx/src/dds/core/policy/CorePolicy.cpp b/src/ddscxx/src/dds/core/policy/CorePolicy.cpp index b500a215..a31af8e6 100644 --- a/src/ddscxx/src/dds/core/policy/CorePolicy.cpp +++ b/src/ddscxx/src/dds/core/policy/CorePolicy.cpp @@ -49,3 +49,4 @@ OMG_DDS_DEFINE_POLICY_TRAITS(dds::core::policy::DurabilityService, DurabilityS #endif // OMG_DDS_PERSISTENCE_SUPPORT OMG_DDS_DEFINE_POLICY_TRAITS(dds::core::policy::WriterBatching, WriterBatching) OMG_DDS_DEFINE_POLICY_TRAITS(dds::core::policy::PSMXInstances, PSMXInstances) +OMG_DDS_DEFINE_POLICY_TRAITS(dds::core::policy::IgnoreLocal, IgnoreLocal) diff --git a/src/ddscxx/src/org/eclipse/cyclonedds/core/policy/PolicyDelegate.cpp b/src/ddscxx/src/org/eclipse/cyclonedds/core/policy/PolicyDelegate.cpp index 4c8dad57..1988caa3 100644 --- a/src/ddscxx/src/org/eclipse/cyclonedds/core/policy/PolicyDelegate.cpp +++ b/src/ddscxx/src/org/eclipse/cyclonedds/core/policy/PolicyDelegate.cpp @@ -21,6 +21,10 @@ #include "dds/ddsc/dds_public_qos.h" #include "dds/ddsc/dds_psmx.h" +/* + * Proprietary policies traits. + */ + namespace org { namespace eclipse @@ -1624,6 +1628,80 @@ void WriterDataLifecycleDelegate::set_c_policy(dds_qos_t* qos) const dds_qset_writer_data_lifecycle(qos, autodispose_); } +//============================================================================== + +IgnoreLocalDelegate::IgnoreLocalDelegate(const IgnoreLocalDelegate& other) + : kind_(other.kind_) +{ +} + +IgnoreLocalDelegate::IgnoreLocalDelegate(dds::core::policy::IgnoreLocalKind::Type kind) + : kind_(kind) +{ + this->check(); +} + +void IgnoreLocalDelegate::kind(dds::core::policy::IgnoreLocalKind::Type kind) +{ + kind_ = kind; +} + +dds::core::policy::IgnoreLocalKind::Type IgnoreLocalDelegate::kind() const +{ + return kind_; +} + +bool IgnoreLocalDelegate::operator ==(const IgnoreLocalDelegate& other) const +{ + return other.kind() == kind_; +} + +void IgnoreLocalDelegate::check() const +{ + /* The kind correctness is enforced by the compiler: nothing to check. */ +} + +void IgnoreLocalDelegate::set_iso_policy(const dds_qos_t* qos) +{ + dds_ignorelocal_kind_t kind; + if (dds_qget_ignorelocal(qos, &kind)) { + switch (kind) { + case DDS_IGNORELOCAL_NONE: + kind_ = dds::core::policy::IgnoreLocalKind::NONE; + break; + case DDS_IGNORELOCAL_PARTICIPANT: + kind_ = dds::core::policy::IgnoreLocalKind::PARTICIPANT; + break; + case DDS_IGNORELOCAL_PROCESS: + kind_ = dds::core::policy::IgnoreLocalKind::PROCESS; + break; + default: + assert(0); + break; + } + } +} + +void IgnoreLocalDelegate::set_c_policy(dds_qos_t* qos) const +{ + switch(kind_) + { + case dds::core::policy::IgnoreLocalKind::NONE: + dds_qset_ignorelocal(qos, DDS_IGNORELOCAL_NONE); + break; + case dds::core::policy::IgnoreLocalKind::PARTICIPANT: + dds_qset_ignorelocal(qos, DDS_IGNORELOCAL_PARTICIPANT); + break; + case dds::core::policy::IgnoreLocalKind::PROCESS: + dds_qset_ignorelocal(qos, DDS_IGNORELOCAL_PROCESS); + break; + default: + assert(0); + break; + } +} + +//============================================================================== //============================================================================== diff --git a/src/ddscxx/src/org/eclipse/cyclonedds/pub/qos/DataWriterQosDelegate.cpp b/src/ddscxx/src/org/eclipse/cyclonedds/pub/qos/DataWriterQosDelegate.cpp index bae59eb4..b21fab98 100644 --- a/src/ddscxx/src/org/eclipse/cyclonedds/pub/qos/DataWriterQosDelegate.cpp +++ b/src/ddscxx/src/org/eclipse/cyclonedds/pub/qos/DataWriterQosDelegate.cpp @@ -201,6 +201,14 @@ DataWriterQosDelegate::policy(const dds::core::policy::PSMXInstances& psmxinstan psmxinstances_ = psmxinstances; } +void +DataWriterQosDelegate::policy(const dds::core::policy::IgnoreLocal& ignorelocal) +{ + ignorelocal.delegate().check(); + present_ |= DDSI_QP_CYCLONE_IGNORELOCAL; + ignorelocal_ = ignorelocal; +} + dds_qos_t* DataWriterQosDelegate::ddsc_qos() const { @@ -252,6 +260,8 @@ DataWriterQosDelegate::ddsc_qos() const writerbatching_.delegate().set_c_policy(qos); if (present_ & DDSI_QP_PSMX) psmxinstances_.delegate().set_c_policy(qos); + if (present_ & DDSI_QP_CYCLONE_IGNORELOCAL) + ignorelocal_.delegate().set_c_policy(qos); return qos; } @@ -305,6 +315,8 @@ DataWriterQosDelegate::ddsc_qos(const dds_qos_t* qos, bool copy_flags) writerbatching_.delegate().set_iso_policy(qos); if (qos->present & DDSI_QP_PSMX) psmxinstances_.delegate().set_iso_policy(qos); + if (qos->present & DDSI_QP_CYCLONE_IGNORELOCAL) + ignorelocal_.delegate().set_iso_policy(qos); } void @@ -341,6 +353,7 @@ DataWriterQosDelegate::named_qos(const struct _DDS_NamedDataWriterQos &qos) #endif // OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT writerbatching_.delegate().v_policy((v_writerbatchingPolicy&)(q->writer_batching) ); psmxinstances_.delegate().v_policy((v_psmxinstancesPolicy&)(q->psmxinstances) ); + ignorelocal_.delegate().v_policy((v_ignorelocalPolicy&)(q->ignorelocal) ); #endif } @@ -380,7 +393,8 @@ DataWriterQosDelegate::operator ==(const DataWriterQosDelegate& other) const other.typeconsistencyenforcement_ == typeconsistencyenforcement_ && #endif // OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT other.writerbatching_ == writerbatching_ && - other.psmxinstances_ == psmxinstances_ + other.psmxinstances_ == psmxinstances_ && + other.ignorelocal_ == ignorelocal_ ; } @@ -561,6 +575,13 @@ DataWriterQosDelegate::policy() return psmxinstances_; } +template<> dds::core::policy::IgnoreLocal& +DataWriterQosDelegate::policy() +{ + present_ |= DDSI_QP_CYCLONE_IGNORELOCAL; + return ignorelocal_; +} + } } } diff --git a/src/ddscxx/src/org/eclipse/cyclonedds/sub/qos/DataReaderQosDelegate.cpp b/src/ddscxx/src/org/eclipse/cyclonedds/sub/qos/DataReaderQosDelegate.cpp index 483320b0..5c8c556c 100644 --- a/src/ddscxx/src/org/eclipse/cyclonedds/sub/qos/DataReaderQosDelegate.cpp +++ b/src/ddscxx/src/org/eclipse/cyclonedds/sub/qos/DataReaderQosDelegate.cpp @@ -165,6 +165,14 @@ DataReaderQosDelegate::policy(const dds::core::policy::PSMXInstances& psmxinstan psmxinstances_ = psmxinstances; } +void +DataReaderQosDelegate::policy(const dds::core::policy::IgnoreLocal& ignorelocal) +{ + ignorelocal.delegate().check(); + present_ |= DDSI_QP_CYCLONE_IGNORELOCAL; + ignorelocal_ = ignorelocal; +} + dds_qos_t* DataReaderQosDelegate::ddsc_qos() const { @@ -204,6 +212,8 @@ DataReaderQosDelegate::ddsc_qos() const #endif // OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT if (present_ & DDSI_QP_PSMX) psmxinstances_.delegate().set_c_policy(qos); + if (present_ & DDSI_QP_CYCLONE_IGNORELOCAL) + ignorelocal_.delegate().set_c_policy(qos); return qos; } @@ -245,6 +255,8 @@ DataReaderQosDelegate::ddsc_qos(const dds_qos_t* qos, bool copy_flags) #endif // OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT if (qos->present & DDSI_QP_PSMX) psmxinstances_.delegate().set_iso_policy(qos); + if (qos->present & DDSI_QP_CYCLONE_IGNORELOCAL) + ignorelocal_.delegate().set_iso_policy(qos); } void @@ -274,6 +286,7 @@ DataReaderQosDelegate::named_qos(const struct _DDS_NamedDataReaderQos &qos) typeconsistencyenforcement_.delegate().v_policy((v_typeConsistencyEnforcementPolicy&)(q->typeconsistencyenforcement)); #endif // OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT psmxinstances_.delegate().v_policy((v_psmxinstancesPolicy&)(q->psmxinstances) ); + ignorelocal_ .delegate().v_policy((v_ignorelocalPolicy&)(q->ignorelocal) ); #endif } @@ -306,7 +319,8 @@ DataReaderQosDelegate::operator==(const DataReaderQosDelegate& other) const other.datarepresentation_ == datarepresentation_ && other.typeconsistencyenforcement_ == typeconsistencyenforcement_ && #endif // OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT - other.psmxinstances_ == psmxinstances_ + other.psmxinstances_ == psmxinstances_ && + other.ignorelocal_ == ignorelocal_ ; } @@ -459,6 +473,12 @@ DataReaderQosDelegate::policy() return psmxinstances_; } +template<> dds::core::policy::IgnoreLocal& +DataReaderQosDelegate::policy() +{ + present_ |= DDSI_QP_CYCLONE_IGNORELOCAL; + return ignorelocal_; +} } } } diff --git a/src/ddscxx/tests/Qos.cpp b/src/ddscxx/tests/Qos.cpp index 5475788b..ed578048 100644 --- a/src/ddscxx/tests/Qos.cpp +++ b/src/ddscxx/tests/Qos.cpp @@ -72,6 +72,7 @@ TypeConsistencyEnforcement nonDefaultTypeConsistencyEnforcement(dds::core::polic #endif // OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT WriterBatching nonDefaultWriterBatching(true); PSMXInstances nonDefaultPSMXInstances({"some_psmx_name"}); +IgnoreLocal nonDefaultIgnoreLocal(dds::core::policy::IgnoreLocalKind::PROCESS); @@ -110,6 +111,7 @@ TypeConsistencyEnforcement tmpEnforcement; #endif // OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT WriterBatching tmpWriterBatching; PSMXInstances tmpPSMXInstances; +IgnoreLocal tmpIgnoreLocal; TEST(Qos, DomainParticipant) { @@ -360,9 +362,10 @@ TEST(Qos, DataWriter) << nonDefaultRepresentation << nonDefaultTypeConsistencyEnforcement #endif // OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT - << nonDefaultWriterBatching - << nonDefaultPSMXInstances - ; + << nonDefaultWriterBatching + << nonDefaultPSMXInstances + << nonDefaultIgnoreLocal + ; DataWriterQos dwQosWConstructed(dwQosShifted); DataWriterQos dwQosWAssigned1 = dwQosShifted; /* Actually calls copy constructor. */ DataWriterQos dwQosWAssigned2; @@ -411,6 +414,7 @@ TEST(Qos, DataWriter) #endif // OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT dwQosShifted >> tmpWriterBatching; dwQosShifted >> tmpPSMXInstances; + dwQosShifted >> tmpIgnoreLocal; ASSERT_EQ(nonDefaultUserData, tmpUserData); ASSERT_EQ(nonDefaultDurability, tmpDurability); #ifdef OMG_DDS_PERSISTENCE_SUPPORT @@ -433,6 +437,7 @@ TEST(Qos, DataWriter) #endif // OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT ASSERT_EQ(nonDefaultWriterBatching, tmpWriterBatching); ASSERT_EQ(nonDefaultPSMXInstances, tmpPSMXInstances); + ASSERT_EQ(nonDefaultIgnoreLocal, tmpIgnoreLocal); ASSERT_EQ(nonDefaultUserData, dwQosWConstructed.policy()); ASSERT_EQ(nonDefaultDurability, dwQosWConstructed.policy()); @@ -456,6 +461,7 @@ TEST(Qos, DataWriter) #endif // OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT ASSERT_EQ(nonDefaultWriterBatching, dwQosWConstructed.policy()); ASSERT_EQ(nonDefaultPSMXInstances, dwQosWConstructed.policy()); + ASSERT_EQ(nonDefaultIgnoreLocal, dwQosWConstructed->policy()); #ifdef OMG_DDS_OWNERSHIP_SUPPORT dwQosShifted >> tmpStrength; @@ -508,8 +514,9 @@ TEST(Qos, DataReader) << nonDefaultRepresentation << nonDefaultTypeConsistencyEnforcement #endif // OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT - << nonDefaultPSMXInstances - ; + << nonDefaultPSMXInstances + << nonDefaultIgnoreLocal + ; DataReaderQos drQosRConstructed(drQosShifted); DataReaderQos drQosRAssigned1 = drQosShifted; /* Actually calls copy constructor. */ DataReaderQos drQosRAssigned2; @@ -550,6 +557,7 @@ TEST(Qos, DataReader) drQosShifted >> tmpEnforcement; #endif // OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT drQosShifted >> tmpPSMXInstances; + drQosShifted >> tmpIgnoreLocal; ASSERT_EQ(nonDefaultUserData, tmpUserData); ASSERT_EQ(nonDefaultDurability, tmpDurability); ASSERT_EQ(nonDefaultDeadline, tmpDeadline); @@ -567,6 +575,7 @@ TEST(Qos, DataReader) ASSERT_EQ(nonDefaultTypeConsistencyEnforcement, tmpEnforcement); #endif // OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT ASSERT_EQ(nonDefaultPSMXInstances, tmpPSMXInstances); + ASSERT_EQ(nonDefaultIgnoreLocal, tmpIgnoreLocal); ASSERT_EQ(nonDefaultUserData, drQosRConstructed.policy()); ASSERT_EQ(nonDefaultDurability, drQosRConstructed.policy()); @@ -585,6 +594,7 @@ TEST(Qos, DataReader) ASSERT_EQ(nonDefaultTypeConsistencyEnforcement, drQosRConstructed.policy()); #endif // OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT ASSERT_EQ(nonDefaultPSMXInstances, drQosRConstructed.policy()); + ASSERT_EQ(nonDefaultIgnoreLocal, drQosRConstructed.policy()); } TEST(Qos, invalid_values) @@ -683,4 +693,5 @@ TEST(Qos, policy_name) #endif // OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT ASSERT_EQ(dds::core::policy::policy_name::name(), "WriterBatching"); ASSERT_EQ(dds::core::policy::policy_name::name(), "PSMXInstances"); + ASSERT_EQ(dds::core::policy::policy_name::name(), "IgnoreLocal"); }