microRTPS: agent: simplify Publisher code specialization

This commit is contained in:
TSC21
2020-03-11 14:03:41 +00:00
committed by Nuno Marques
parent 296714a00a
commit e9bc675bfa
2 changed files with 29 additions and 41 deletions
+20 -26
View File
@@ -77,6 +77,24 @@ except AttributeError:
using namespace eprosima::fastrtps;
using namespace eprosima::fastrtps::rtps;
@[if fastrtps_version <= 1.7]@
@[ if ros2_distro]@
using @(topic)_msg_t = @(package)::msg::dds_::@(topic)_;
using @(topic)_msg_datatype = @(package)::msg::dds_::@(topic)_PubSubType;
@[ else]@
using @(topic)_msg_t = @(topic)_;
using @(topic)_msg_datatype = @(topic)_PubSubType;
@[ end if]@
@[else]@
@[ if ros2_distro]@
using @(topic)_msg_t = @(package)::msg::@(topic);
using @(topic)_msg_datatype = @(package)::msg::@(topic)PubSubType;
@[ else]@
using @(topic)_msg_t = @(topic);
using @(topic)_msg_datatype = @(topic)PubSubType;
@[ end if]@
@[end if]@
class @(topic)_Publisher
{
public:
@@ -84,19 +102,7 @@ public:
virtual ~@(topic)_Publisher();
bool init();
void run();
@[if fastrtps_version <= 1.7]@
@[ if ros2_distro]@
void publish(@(package)::msg::dds_::@(topic)_* st);
@[ else]@
void publish(@(topic)_* st);
@[ end if]@
@[else]@
@[ if ros2_distro]@
void publish(@(package)::msg::@(topic)* st);
@[ else]@
void publish(@(topic)* st);
@[ end if]@
@[end if]@
void publish(@(topic)_msg_t* st);
private:
Participant *mp_participant;
Publisher *mp_publisher;
@@ -109,19 +115,7 @@ private:
void onPublicationMatched(Publisher* pub, MatchingInfo& info);
int n_matched;
} m_listener;
@[if fastrtps_version <= 1.7]@
@[ if ros2_distro]@
@(package)::msg::dds_::@(topic)_PubSubType @(topic)DataType;
@[ else]@
@(topic)_PubSubType @(topic)DataType;
@[ end if]@
@[else]@
@[ if ros2_distro]@
@(package)::msg::@(topic)PubSubType @(topic)DataType;
@[ else]@
@(topic)PubSubType @(topic)DataType;
@[ end if]@
@[end if]@
@(topic)_msg_datatype @(topic)DataType;
};
#endif // _@(topic)__PUBLISHER_H_