From 8e97b5e414293c5b15a8e5e50e328cee8c3f0037 Mon Sep 17 00:00:00 2001 From: Erik Hofman Date: Sat, 27 Mar 2021 15:21:22 +0100 Subject: [PATCH] Add a helper function which converts the template typename into a topic name. --- simgear/io/SGDataDistributionService.hxx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/simgear/io/SGDataDistributionService.hxx b/simgear/io/SGDataDistributionService.hxx index 92613fe0..a135ef6a 100644 --- a/simgear/io/SGDataDistributionService.hxx +++ b/simgear/io/SGDataDistributionService.hxx @@ -35,6 +35,7 @@ #include #include #include +#include #define FG_DDS_DOMAIN DDS_DOMAIN_DEFAULT @@ -67,6 +68,12 @@ public: // a custom topic name. void setup(const char* topic, const dds_topic_descriptor_t *desc, size_t size); + template + void setup(const dds_topic_descriptor_t *desc) { + std::string type = simgear::getTypeName(); + setup(type.c_str(), desc, sizeof(T)); + } + // If specified as a server start a publishing participant. // If specified as a client start a subscribing participant. bool open(const SGProtocolDir d);