Hi,
Currently I was able to write string to topic and read from topic. I also understand I can defined user types and dynamic data types.
Is there way to write and read primite types only ( like, double, boolean) ?
Thanks,
Biswanath
Hi,
Currently I was able to write string to topic and read from topic. I also understand I can defined user types and dynamic data types.
Is there way to write and read primite types only ( like, double, boolean) ?
Thanks,
Biswanath
Hi Biswanath,
The Modern C++ API has a utility that may be what you're looking for (it requires C++11 support in your compiler):
In this HOWTO look for "Manipulating data reflectively using C++ tuples."
This will let you directly use C++11 tuples of primitive types, without any IDL type definition.
Hi,
For the other API's you need to define a "wrapper" structure and run
rtiddsgen
on it. For example to send a primitivedouble
you would define:Note that on the wire you only send the
double
itself so there is no overheard caused by having it wrapped inside theDoubleType
structure.I am interested to know more about the use case that is making you want to send just the primitive types... One reason we did not add these primitives as types built-in is that we have not found it to be a common or recommended practice. In many situations applications end up not sending just primitive values. Rather it becomes more approriate to send a sequence of them, and/or include a key (e.g. the sensorId that generated that value), some identification of the quality or error, units etc. These additional fields make the use of the data less error prone and the overhead introduced by the use of a network prototocol normally dwarfs the cost of these additional fields.
Gerardo