Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Converting template into macro [7931] #1065

Merged
merged 1 commit into from
Mar 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
118 changes: 59 additions & 59 deletions include/fastdds/dds/core/policy/QosPolicies.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -839,68 +839,68 @@ class GenericDataQosPolicy : public Parameter_t, public QosPolicy,
};

/**
* Class TemplateDataQosPolicy, base template for user data qos policies.
* Class TClassName, base template for user data qos policies.
*/
template<ParameterId_t TPid>
class TemplateDataQosPolicy : public GenericDataQosPolicy
{
public:

RTPS_DllAPI TemplateDataQosPolicy()
: GenericDataQosPolicy(TPid)
{
}

RTPS_DllAPI TemplateDataQosPolicy(
uint16_t in_length)
: GenericDataQosPolicy(TPid, in_length)
{
}

/**
* Construct from another TemplateDataQosPolicy.
*
* The resulting TemplateDataQosPolicy will have the same size limits
* as the input attribute
*
* @param data data to copy in the newly created object
*/
RTPS_DllAPI TemplateDataQosPolicy(
const TemplateDataQosPolicy& data) = default;

/**
* Construct from underlying collection type.
*
* Useful to easy integration on old APIs where a traditional container was used.
* The resulting TemplateDataQosPolicy will always be unlimited in size
*
* @param data data to copy in the newly created object
*/
RTPS_DllAPI TemplateDataQosPolicy(
const collection_type& data)
: GenericDataQosPolicy(TPid, data)
{
}

virtual RTPS_DllAPI ~TemplateDataQosPolicy() = default;

/**
* Copies another TemplateDataQosPolicy.
*
* The resulting TemplateDataQosPolicy 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.
*/
TemplateDataQosPolicy& operator =(
const TemplateDataQosPolicy& b) = default;

#define TEMPLATE_DATA_QOS_POLICY(TClassName, TPid) \
class TClassName : public GenericDataQosPolicy \
{ \
public: \
\
RTPS_DllAPI TClassName() \
: GenericDataQosPolicy(TPid) \
{ \
} \
\
RTPS_DllAPI TClassName( \
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 \
*/ \
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 \
*/ \
RTPS_DllAPI TClassName( \
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. \
*/ \
TClassName& operator =( \
const TClassName& b) = default; \
\
};

using UserDataQosPolicy = TemplateDataQosPolicy<PID_USER_DATA>;
using TopicDataQosPolicy = TemplateDataQosPolicy<PID_TOPIC_DATA>;
using GroupDataQosPolicy = TemplateDataQosPolicy<PID_GROUP_DATA>;
TEMPLATE_DATA_QOS_POLICY(UserDataQosPolicy, PID_USER_DATA)
TEMPLATE_DATA_QOS_POLICY(TopicDataQosPolicy, PID_TOPIC_DATA)
TEMPLATE_DATA_QOS_POLICY(GroupDataQosPolicy, PID_GROUP_DATA)

/**
* Class TimeBasedFilterQosPolicy, to indicate the Time Based Filter Qos.
Expand Down
2 changes: 1 addition & 1 deletion include/fastdds/dds/publisher/qos/PublisherQos.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class PublisherQos
fastrtps::LifespanQosPolicy lifespan;

//!UserData Qos, NOT implemented in the library.
UserDataQosPolicy user_data;
fastrtps::UserDataQosPolicy user_data;

//!Time Based Filter Qos, NOT implemented in the library.
fastrtps::TimeBasedFilterQosPolicy time_based_filter;
Expand Down
2 changes: 1 addition & 1 deletion include/fastdds/dds/topic/qos/DataReaderQos.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class DataReaderQos
fastrtps::ResourceLimitsQosPolicy resource_limits;

//!User Data Qos, NOT implemented in the library.
UserDataQosPolicy user_data;
fastrtps::UserDataQosPolicy user_data;

//!Ownership Qos, NOT implemented in the library.
fastrtps::OwnershipQosPolicy ownership;
Expand Down
2 changes: 1 addition & 1 deletion include/fastdds/dds/topic/qos/DataWriterQos.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class DataWriterQos
fastrtps::LifespanQosPolicy lifespan;

//!User Data Qos, implemented in the library.
UserDataQosPolicy user_data;
fastrtps::UserDataQosPolicy user_data;

//!Ownership Qos, NOT implemented in the library.
fastrtps::OwnershipQosPolicy ownership;
Expand Down
2 changes: 1 addition & 1 deletion include/fastdds/rtps/builtin/data/ParticipantProxyData.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ class ParticipantProxyData
//!
ParameterPropertyList_t m_properties;
//!
fastdds::dds::UserDataQosPolicy m_userData;
UserDataQosPolicy m_userData;
//!
TimedEvent* lease_duration_event;
//!
Expand Down
5 changes: 3 additions & 2 deletions include/fastrtps/qos/QosPolicies.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@ constexpr PresentationQosPolicyAccessScopeKind GROUP_PRESENTATION_QOS =
PresentationQosPolicyAccessScopeKind::GROUP_PRESENTATION_QOS;
using PresentationQosPolicy = fastdds::dds::PresentationQosPolicy;
using PartitionQosPolicy = fastdds::dds::PartitionQosPolicy;
using TopicDataQosPolicy = fastdds::dds::TemplateDataQosPolicy<fastdds::dds::PID_TOPIC_DATA>;
using GroupDataQosPolicy = fastdds::dds::TemplateDataQosPolicy<fastdds::dds::PID_GROUP_DATA>;
using UserDataQosPolicy = fastdds::dds::UserDataQosPolicy;
using TopicDataQosPolicy = fastdds::dds::TopicDataQosPolicy;
using GroupDataQosPolicy = fastdds::dds::GroupDataQosPolicy;
using HistoryQosPolicyKind = fastdds::dds::HistoryQosPolicyKind;
constexpr HistoryQosPolicyKind KEEP_LAST_HISTORY_QOS = HistoryQosPolicyKind::KEEP_LAST_HISTORY_QOS;
constexpr HistoryQosPolicyKind KEEP_ALL_HISTORY_QOS = HistoryQosPolicyKind::KEEP_ALL_HISTORY_QOS;
Expand Down
2 changes: 1 addition & 1 deletion include/fastrtps/xmlparser/XMLParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ class XMLParser

RTPS_DllAPI static XMLP_ret getXMLUserDataQos(
tinyxml2::XMLElement* elem,
fastdds::dds::UserDataQosPolicy& userData,
UserDataQosPolicy& userData,
uint8_t ident);

RTPS_DllAPI static XMLP_ret getXMLLifespanQos(
Expand Down