diff --git a/simgear/io/SGDataDistributionService.hxx b/simgear/io/SGDataDistributionService.hxx index d915a04e..92613fe0 100644 --- a/simgear/io/SGDataDistributionService.hxx +++ b/simgear/io/SGDataDistributionService.hxx @@ -78,9 +78,19 @@ public: // read data from the topic. int read(char *buf, int length); + template + bool read(T& sample) { + return (read((char*)&sample, sizeof(T)) == sizeof(T)) ? true : false; + } + // write data to the topic. int write(const char *buf, const int length); + template + bool write(const T& sample) { + return (write((char*)&sample, sizeof(T)) == sizeof(T)) ? true : false; + } + // close the participant. bool close();