From 931a696007e80fac2f35aec90ffac7bee647cc40 Mon Sep 17 00:00:00 2001 From: Erik Hofman Date: Mon, 15 Mar 2021 15:16:28 +0100 Subject: [PATCH] Add a setup function which takes the topic name from the descriptors typename --- simgear/io/SGDataDistributionService.cxx | 8 ++++++++ simgear/io/SGDataDistributionService.hxx | 7 ++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/simgear/io/SGDataDistributionService.cxx b/simgear/io/SGDataDistributionService.cxx index 7a2339a2..bc79ab41 100644 --- a/simgear/io/SGDataDistributionService.cxx +++ b/simgear/io/SGDataDistributionService.cxx @@ -53,6 +53,14 @@ SG_DDS::setup( const char *topic, const dds_topic_descriptor_t *desc, const size packet_size = size; } +void +SG_DDS::setup(const dds_topic_descriptor_t *desc, const size_t size) +{ + topic_name = desc->m_typename; + descriptor = desc; + packet_size = size; +} + // If specified as a server (in direction) create a subscriber. // If specified as a client (out direction), create a publisher. bool diff --git a/simgear/io/SGDataDistributionService.hxx b/simgear/io/SGDataDistributionService.hxx index c570d9f6..4e2afad8 100644 --- a/simgear/io/SGDataDistributionService.hxx +++ b/simgear/io/SGDataDistributionService.hxx @@ -60,7 +60,12 @@ public: /** Destructor */ ~SG_DDS(); - // Set the paramaters which weren't available at creation time. + // Set the paramaters which weren't available at creation time and use + // the descrtors typename as topic name. + void setup(const dds_topic_descriptor_t *desc, size_t size); + + // Set the paramaters which weren't available at creation time and use + // a custom topic name. void setup(const char* topic, const dds_topic_descriptor_t *desc, size_t size); // If specified as a server start a publishing participant.