Skip to content

Commit

Permalink
Call listener on incompatible QoS (#1259)
Browse files Browse the repository at this point in the history
* Refs 8637. Define policy ids

Signed-off-by: Iker Luengo <[email protected]>

* Refs 8637. Add changed status mask to Entity

Signed-off-by: Iker Luengo <[email protected]>

* Refs 8637. Init incompatibleQosStatus

Signed-off-by: Iker Luengo <[email protected]>

* Refs 8637. get IncompatibleQosStatus

Signed-off-by: Iker Luengo <[email protected]>

* Refs 8637. set IncompatibleQosStatus + listener

Signed-off-by: Iker Luengo <[email protected]>

* Refs 8637. Blackbox test for listeners

Signed-off-by: Iker Luengo <[email protected]>

* Refs 8637. Blackbox test for getters

Signed-off-by: Iker Luengo <[email protected]>

* Refs 8637. Mocks for EDP unit testing

Signed-off-by: Iker Luengo <[email protected]>

* Refs 8637. EDP unit testing

Signed-off-by: Iker Luengo <[email protected]>

* Refs 8637. Check non-qos incompatibility

Signed-off-by: Iker Luengo <[email protected]>

* Refs 8637. Separate DDS Blackbox test

Signed-off-by: Iker Luengo <[email protected]>

* Refs 8637. Check all qos before failing

Signed-off-by: Iker Luengo <[email protected]>

* Refs 8637. Apply suggested changes

Signed-off-by: Iker Luengo <[email protected]>

* Refs 8637. Apply suggested changes

Signed-off-by: Iker Luengo <[email protected]>

* Refs #8707. Fixing linters.

Signed-off-by: Miguel Company <[email protected]>

Co-authored-by: Miguel Company <[email protected]>
  • Loading branch information
IkerLuengo and MiguelCompany authored Jun 19, 2020
1 parent e9a68a9 commit 9125239
Show file tree
Hide file tree
Showing 39 changed files with 2,984 additions and 631 deletions.
64 changes: 32 additions & 32 deletions include/dds/core/policy/CorePolicy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@

//==============================================================================
// MACROS
//
// *INDENT-OFF*
#define OMG_DDS_POLICY_TRAITS(POLICY, ID) \
template<> \
class policy_id<POLICY> { \
public: \
public: \
static const dds::core::policy::QosPolicyId value = ID; \
}; \
template<> \
class policy_name<POLICY> { \
public: \
public: \
static const std::string& name(); \
};

Expand All @@ -51,6 +51,7 @@ public: \
static std::string name = #NAME; \
return name; \
}
// *INDENT-OFF*


namespace dds {
Expand Down Expand Up @@ -644,7 +645,7 @@ class Ownership : public dds::core::Value<detail::Ownership>

# if defined (__SUNPRO_CC) && defined(SHARED)
# undef SHARED
# endif
# endif // if defined (__SUNPRO_CC) && defined(SHARED)
/**
* Creates an Ownership QoS instance
*
Expand Down Expand Up @@ -953,8 +954,8 @@ class Presentation : public dds::core::Value<detail::Presentation>
* @param ordered_access the ordered_access setting
*/
Presentation(
dds::core::policy::PresentationAccessScopeKind::Type access_scope
= dds::core::policy::PresentationAccessScopeKind::INSTANCE,
dds::core::policy::PresentationAccessScopeKind::Type access_scope =
dds::core::policy::PresentationAccessScopeKind::INSTANCE,
bool coherent_access = false,
bool ordered_access = false);

Expand Down Expand Up @@ -1149,8 +1150,8 @@ class DestinationOrder : public dds::core::Value<detail::DestinationOrder>
* @param kind the kind
*/
explicit DestinationOrder(
dds::core::policy::DestinationOrderKind::Type kind
= dds::core::policy::DestinationOrderKind::BY_RECEPTION_TIMESTAMP);
dds::core::policy::DestinationOrderKind::Type kind =
dds::core::policy::DestinationOrderKind::BY_RECEPTION_TIMESTAMP);

/**
* Copies a DestinationOrder QoS instance
Expand Down Expand Up @@ -1664,39 +1665,38 @@ class policy_name;

#ifdef OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT
/** @todo - Known issue. */
#endif
#endif // ifdef OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT

OMG_DDS_POLICY_TRAITS(UserData, 1)
OMG_DDS_POLICY_TRAITS(Durability, 2)
OMG_DDS_POLICY_TRAITS(Presentation, 3)
OMG_DDS_POLICY_TRAITS(Deadline, 4)
OMG_DDS_POLICY_TRAITS(LatencyBudget, 5)
OMG_DDS_POLICY_TRAITS(Ownership, 6)
OMG_DDS_POLICY_TRAITS(UserData, eprosima::fastdds::dds::USERDATA_QOS_POLICY_ID)
OMG_DDS_POLICY_TRAITS(Durability, eprosima::fastdds::dds::DURABILITY_QOS_POLICY_ID)
OMG_DDS_POLICY_TRAITS(Presentation, eprosima::fastdds::dds::PRESENTATION_QOS_POLICY_ID)
OMG_DDS_POLICY_TRAITS(Deadline, eprosima::fastdds::dds::DEADLINE_QOS_POLICY_ID)
OMG_DDS_POLICY_TRAITS(LatencyBudget, eprosima::fastdds::dds::LATENCYBUDGET_QOS_POLICY_ID)
OMG_DDS_POLICY_TRAITS(Ownership, eprosima::fastdds::dds::OWNERSHIP_QOS_POLICY_ID)

//#ifdef OMG_DDS_OWNERSHIP_SUPPORT
OMG_DDS_POLICY_TRAITS(OwnershipStrength, 7)
OMG_DDS_POLICY_TRAITS(OwnershipStrength, eprosima::fastdds::dds::OWNERSHIPSTRENGTH_QOS_POLICY_ID)
//#endif //OMG_DDS_OWNERSHIP_SUPPORT

OMG_DDS_POLICY_TRAITS(Liveliness, 8)
OMG_DDS_POLICY_TRAITS(TimeBasedFilter, 9)
OMG_DDS_POLICY_TRAITS(Partition, 10)
OMG_DDS_POLICY_TRAITS(Reliability, 11)
OMG_DDS_POLICY_TRAITS(DestinationOrder, 12)
OMG_DDS_POLICY_TRAITS(History, 13)
OMG_DDS_POLICY_TRAITS(ResourceLimits, 14)
OMG_DDS_POLICY_TRAITS(EntityFactory, 15)
OMG_DDS_POLICY_TRAITS(WriterDataLifecycle, 16)
OMG_DDS_POLICY_TRAITS(ReaderDataLifecycle, 17)
OMG_DDS_POLICY_TRAITS(TopicData, 18)
OMG_DDS_POLICY_TRAITS(GroupData, 19)
OMG_DDS_POLICY_TRAITS(TransportPriority, 20)
OMG_DDS_POLICY_TRAITS(Lifespan, 21)
OMG_DDS_POLICY_TRAITS(Liveliness, eprosima::fastdds::dds::LIVELINESS_QOS_POLICY_ID)
OMG_DDS_POLICY_TRAITS(TimeBasedFilter, eprosima::fastdds::dds::TIMEBASEDFILTER_QOS_POLICY_ID)
OMG_DDS_POLICY_TRAITS(Partition, eprosima::fastdds::dds::PARTITION_QOS_POLICY_ID)
OMG_DDS_POLICY_TRAITS(Reliability, eprosima::fastdds::dds::RELIABILITY_QOS_POLICY_ID)
OMG_DDS_POLICY_TRAITS(DestinationOrder, eprosima::fastdds::dds::DESTINATIONORDER_QOS_POLICY_ID)
OMG_DDS_POLICY_TRAITS(History, eprosima::fastdds::dds::HISTORY_QOS_POLICY_ID)
OMG_DDS_POLICY_TRAITS(ResourceLimits, eprosima::fastdds::dds::RESOURCELIMITS_QOS_POLICY_ID)
OMG_DDS_POLICY_TRAITS(EntityFactory, eprosima::fastdds::dds::ENTITYFACTORY_QOS_POLICY_ID)
OMG_DDS_POLICY_TRAITS(WriterDataLifecycle, eprosima::fastdds::dds::WRITERDATALIFECYCLE_QOS_POLICY_ID)
OMG_DDS_POLICY_TRAITS(ReaderDataLifecycle, eprosima::fastdds::dds::READERDATALIFECYCLE_QOS_POLICY_ID)
OMG_DDS_POLICY_TRAITS(TopicData, eprosima::fastdds::dds::TOPICDATA_QOS_POLICY_ID)
OMG_DDS_POLICY_TRAITS(GroupData, eprosima::fastdds::dds::GROUPDATA_QOS_POLICY_ID)
OMG_DDS_POLICY_TRAITS(TransportPriority, eprosima::fastdds::dds::TRANSPORTPRIORITY_QOS_POLICY_ID)
OMG_DDS_POLICY_TRAITS(Lifespan, eprosima::fastdds::dds::LIFESPAN_QOS_POLICY_ID)

//#ifdef OMG_DDS_PERSISTENCE_SUPPORT
OMG_DDS_POLICY_TRAITS(DurabilityService, 22)
OMG_DDS_POLICY_TRAITS(DurabilityService, eprosima::fastdds::dds::DURABILITYSERVICE_QOS_POLICY_ID)
//#endif //OMG_DDS_PERSISTENCE_SUPPORT


} //namespace policy
} //namespace core
} //namespace dds
Expand Down
23 changes: 23 additions & 0 deletions include/fastdds/dds/core/Entity.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class Entity
RTPS_DllAPI Entity(
const StatusMask& mask = StatusMask::all())
: status_mask_(mask)
, status_changes_(StatusMask::none())
, enable_(false)
{
}
Expand Down Expand Up @@ -75,6 +76,25 @@ class Entity
return status_mask_;
}

/**
* @brief Retrieves the set of triggered statuses in the Entity
*
* Triggered statuses are the ones whose value has changed
* since the last time the application read the status.
* When the entity is first created or if the entity is not enabled,
* all communication statuses are in the “untriggered” state,
* so the list returned by the get_status_changes operation will be empty.
* The list of statuses returned by the get_status_changes operation
* refers to the status that are triggered on the Entity itself
* and does not include statuses that apply to contained entities.
*
* @return const reference to the StatusMask with the triggered statuses set to 1
*/
RTPS_DllAPI const StatusMask& get_status_changes() const
{
return status_changes_;
}

/**
* @brief Retrieves the instance handler that represents the Entity
* @return Reference to the InstanceHandle
Expand Down Expand Up @@ -114,6 +134,9 @@ class Entity
//! StatusMask with relevant statuses set to 1
StatusMask status_mask_;

//! StatusMask with triggered statuses set to 1
StatusMask status_changes_;

//! InstanceHandle associated to the Entity
fastrtps::rtps::InstanceHandle_t instance_handle_;

Expand Down
152 changes: 101 additions & 51 deletions include/fastdds/dds/core/policy/QosPolicies.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,67 @@


namespace eprosima {

namespace fastrtps {
namespace rtps {
class EDP;
}
}

namespace fastdds {
namespace dds {

/**
* The identifier for each QosPolicy.
*
* Each QosPolicy class has a different ID that is then used to refer
* to the incompatible policies on OfferedIncompatibleQosStatus
* and RequestedIncompatibleQosStatus.
*/
enum QosPolicyId_t : uint32_t
{
INVALID_QOS_POLICY_ID = 0, //< Does not refer to any valid QosPolicy

// Standard QosPolicies
USERDATA_QOS_POLICY_ID = 1, //< UserDataQosPolicy
DURABILITY_QOS_POLICY_ID = 2, //< DurabilityQosPolicy
PRESENTATION_QOS_POLICY_ID = 3, //< PresentationQosPolicy
DEADLINE_QOS_POLICY_ID = 4, //< DeadlineQosPolicy
LATENCYBUDGET_QOS_POLICY_ID = 5, //< LatencyBudgetQosPolicy
OWNERSHIP_QOS_POLICY_ID = 6, //< OwnershipQosPolicy
OWNERSHIPSTRENGTH_QOS_POLICY_ID = 7, //< OwnershipStrengthQosPolicy
LIVELINESS_QOS_POLICY_ID = 8, //< LivelinessQosPolicy
TIMEBASEDFILTER_QOS_POLICY_ID = 9, //< TimeBasedFilterQosPolicy
PARTITION_QOS_POLICY_ID = 10, //< PartitionQosPolicy
RELIABILITY_QOS_POLICY_ID = 11, //< ReliabilityQosPolicy
DESTINATIONORDER_QOS_POLICY_ID = 12, //< DestinationOrderQosPolicy
HISTORY_QOS_POLICY_ID = 13, //< HistoryQosPolicy
RESOURCELIMITS_QOS_POLICY_ID = 14, //< ResourceLimitsQosPolicy
ENTITYFACTORY_QOS_POLICY_ID = 15, //< EntityFactoryQosPolicy
WRITERDATALIFECYCLE_QOS_POLICY_ID = 16, //< WriterDataLifecycleQosPolicy
READERDATALIFECYCLE_QOS_POLICY_ID = 17, //< ReaderDataLifecycleQosPolicy
TOPICDATA_QOS_POLICY_ID = 18, //< TopicDataQosPolicy
GROUPDATA_QOS_POLICY_ID = 19, //< GroupDataQosPolicy
TRANSPORTPRIORITY_QOS_POLICY_ID = 20, //< TransportPriorityQosPolicy
LIFESPAN_QOS_POLICY_ID = 21, //< LifespanQosPolicy
DURABILITYSERVICE_QOS_POLICY_ID = 22, //< DurabilityServiceQosPolicy

//XTypes extensions
DATAREPRESENTATION_QOS_POLICY_ID = 23, //< DataRepresentationQosPolicy
TYPECONSISTENCYENFORCEMENT_QOS_POLICY_ID = 24, //< TypeConsistencyEnforcementQosPolicy

//eProsima Extensions
DISABLEPOSITIVEACKS_QOS_POLICY_ID = 25, //< DisablePositiveACKsQosPolicy
PARTICIPANTRESOURCELIMITS_QOS_POLICY_ID = 26, //< ParticipantResourceLimitsQos
PROPERTYPOLICY_QOS_POLICY_ID = 27, //< PropertyPolicyQos
PUBLISHMODE_QOS_POLICY_ID = 28, //< PublishModeQosPolicy
READERRESOURCELIMITS_QOS_POLICY_ID = 29, //< Reader ResourceLimitsQos
RTPSENDPOINT_QOS_POLICY_ID = 30, //< RTPSEndpointQos
RTPSRELIABLEREADER_QOS_POLICY_ID = 31, //< RTPSReliableReaderQos
RTPSRELIABLEWRITER_QOS_POLICY_ID = 32, //< RTPSReliableWriterQos
TRANSPORTCONFIG_QOS_POLICY_ID = 33, //< TransportConfigQos
TYPECONSISTENCY_QOS_POLICY_ID = 34, //< TipeConsistencyQos
WIREPROTOCOLCONFIG_QOS_POLICY_ID = 35, //< WireProtocolConfigQos
WRITERRESOURCELIMITS_QOS_POLICY_ID = 36, //< WriterResourceLimitsQos

NEXT_QOS_POLICY_ID //< Keep always the last element. For internal use only
};

using PolicyMask = std::bitset<NEXT_QOS_POLICY_ID>;

/**
* Class QosPolicy, base for all QoS policies defined for Writers and Readers.
*/
Expand Down Expand Up @@ -898,62 +949,63 @@ class GenericDataQosPolicy : public Parameter_t, public QosPolicy,
* By default, zero-sized sequence.
* @note Mutable Qos Policy
*/
#define TEMPLATE_DATA_QOS_POLICY(TClassName, TPid) \
// *INDENT-OFF* (uncrustify seems to have problems with this macro)
#define TEMPLATE_DATA_QOS_POLICY(TClassName, TPid) \
class TClassName : public GenericDataQosPolicy \
{ \
public: \
\
public: \
\
RTPS_DllAPI TClassName() \
: GenericDataQosPolicy(TPid) \
{ \
} \
\
\
RTPS_DllAPI TClassName( \
uint16_t in_length) \
uint16_t in_length) \
: GenericDataQosPolicy(TPid, in_length) \
{ \
} \
\
/** \
* Construct from another TClassName. \
* \
* The resulting TClassName will have the same size limits \
* as the input attribute \
* \
* @param data data to copy in the newly created object \
*/ \
\
/** \
* Construct from another TClassName. \
* \
* The resulting TClassName will have the same size limits \
* as the input attribute \
* \
* @param data data to copy in the newly created object \
*/ \
RTPS_DllAPI TClassName( \
const TClassName &data) = default; \
\
/** \
* Construct from underlying collection type. \
* \
* Useful to easy integration on old APIs where a traditional container was used. \
* The resulting TClassName will always be unlimited in size \
* \
* @param data data to copy in the newly created object \
*/ \
const TClassName &data) = default; \
\
/** \
* Construct from underlying collection type. \
* \
* Useful to easy integration on old APIs where a traditional container was used. \
* The resulting TClassName will always be unlimited in size \
* \
* @param data data to copy in the newly created object \
*/ \
RTPS_DllAPI TClassName( \
const collection_type &data) \
const collection_type &data) \
: GenericDataQosPolicy(TPid, data) \
{ \
} \
\
\
virtual RTPS_DllAPI ~TClassName() = default; \
\
/** \
* Copies another TClassName. \
* \
* The resulting TClassName will have the same size limit \
* as the input parameter, so all data in the input will be copied. \
* \
* @param b object to be copied \
* @return reference to the current object. \
*/ \
\
/** \
* Copies another TClassName. \
* \
* The resulting TClassName will have the same size limit \
* as the input parameter, so all data in the input will be copied. \
* \
* @param b object to be copied \
* @return reference to the current object. \
*/ \
TClassName& operator =( \
const TClassName &b) = default; \
\
const TClassName& b) = default; \
};
// *INDENT-ON*

//Variable used to generate the doxygen documentation for this QoS Policies
#ifdef DOXYGEN_DOCUMENTATION
Expand Down Expand Up @@ -997,7 +1049,7 @@ class TopicDataQosPolicy : public GenericDataQosPolicy
class GroupDataQosPolicy : public GenericDataQosPolicy
{
};
#endif
#endif // DOXYGEN_DOCUMENTATION

TEMPLATE_DATA_QOS_POLICY(UserDataQosPolicy, PID_USER_DATA)
TEMPLATE_DATA_QOS_POLICY(TopicDataQosPolicy, PID_TOPIC_DATA)
Expand Down Expand Up @@ -1211,13 +1263,11 @@ class Partition_t
*/
class PartitionQosPolicy : public Parameter_t, public QosPolicy
{
friend class fastrtps::rtps::EDP;

public:

class const_iterator
{
public:
public:

typedef const_iterator self_type;
typedef const Partition_t value_type;
Expand Down Expand Up @@ -1273,7 +1323,7 @@ class PartitionQosPolicy : public Parameter_t, public QosPolicy
return ptr_ != rhs.ptr_;
}

protected:
protected:

/**
* @brief Shift the pointer to the next element
Expand All @@ -1286,7 +1336,7 @@ class PartitionQosPolicy : public Parameter_t, public QosPolicy
value_ = Partition_t(ptr_);
}

private:
private:

//!Pointer
const fastrtps::rtps::octet* ptr_;
Expand Down
Loading

0 comments on commit 9125239

Please sign in to comment.