Add a helper function which converts the template typename into a topic name.

This commit is contained in:
Erik Hofman 2021-03-27 15:21:22 +01:00
parent 5e837b50c4
commit 8e97b5e414

View File

@ -35,6 +35,7 @@
#include <simgear/compiler.h>
#include <simgear/math/sg_types.hxx>
#include <simgear/io/iochannel.hxx>
#include <simgear/structure/intern.hxx>
#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<typename T>
void setup(const dds_topic_descriptor_t *desc) {
std::string type = simgear::getTypeName<T>();
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);