In this way, there is no need to introduce another components such as yaml-cpp or jsoncpp for parsing text format configuration file, so we want to deserialize text into an IDL-defined object.
So, what I don't understand is what you want to do with respect to the DDS-side of things. What you mean by an IDL-defined object?
In DDS, IDL is used to define datastructures. An IDL compiler, in RTI Connext DDS that would be rtiddsgen, is used to convert the IDL in to language-specific data structure definitions and supporting code.
For C/C++, the data structure is literally defined as a struct (or a class) that has members. That data structure that is defined is frankly no different than any that you would create yourself. Nothing special about that data structure (other than there's alot of supporting code generated to help DDS manipulate objects of that type).
So, if you want to parse text and store it in a data structure...unfortunately, that's not something that DDS has special support to do. It can print the data out in a string format...but it can't read data in from a string format.
At least not at this time. There is a feature request recorded to be able to support this, but it's not implemented at this time.
Since the Recording Service can be saved in json and replay from json format, I think RTI DDS has the ability to recover objects from text input. I hope that the interface can be provided, thanks.
Yes, unfortunately the work to transform to/from JSON was done outside of the RTI core libraries and within RTI Recording Service. But the idea is to support this in the RTI core libraries in a future release.
You can contact your RTI account manager to let them know that you would like to this feature released sooner than later. By tying a feature request to a customer id will give the feature request higher visibility and importance when work for future releases is being prioritorized and scheduled.
@pi1ot Did you get this working? Are you able to serialize/deserialize protobuf data to/from CDR format? Can you share your approach here, so the community can benefit?
I know that our customers did create custom serialize/deserialize for IDL using RIDL as generic IDL compiler frontend using their own backend. Maybe something to look into that, we have several backends available as part of AXCIOMA and TAOX11
Sorry, what do you mean? "deserialize from json (or other plain text format), just like prototxt in google protobuf" into what?
How is this related to the use of DDS?
We use google protobuf in two scenarios:
1. define interface and message for communication transmission.
2. define structured data for parsing configuration files in text format.
For example:
file config.proto
-----------------
message AppConfig {
string option1 = 1;
uint32 option2 = 2;
}
file config.prototxt
--------------------
option1 : "some string"
option2 : 123
file parse_config.cpp
---------------------
#include "config.pb.h"
// parse config
AppConfig config;
std::ifstream fs("config.prototxt", std::ios::in);
google::protobuf::io::IstreamInputStream is(&fs);
google::protobuf::TextFormat::Parse(&is, &config);
// use config
std::cout << config.option1() << std::endl;
std::cout << config.option2() << std::endl;
In this way, there is no need to introduce another components such as yaml-cpp or jsoncpp for parsing text format configuration file, so we want to deserialize text into an IDL-defined object.
So, what I don't understand is what you want to do with respect to the DDS-side of things. What you mean by an IDL-defined object?
In DDS, IDL is used to define datastructures. An IDL compiler, in RTI Connext DDS that would be rtiddsgen, is used to convert the IDL in to language-specific data structure definitions and supporting code.
For C/C++, the data structure is literally defined as a struct (or a class) that has members. That data structure that is defined is frankly no different than any that you would create yourself. Nothing special about that data structure (other than there's alot of supporting code generated to help DDS manipulate objects of that type).
So, if you want to parse text and store it in a data structure...unfortunately, that's not something that DDS has special support to do. It can print the data out in a string format...but it can't read data in from a string format.
At least not at this time. There is a feature request recorded to be able to support this, but it's not implemented at this time.
Since the Recording Service can be saved in json and replay from json format, I think RTI DDS has the ability to recover objects from text input. I hope that the interface can be provided, thanks.
Yes, unfortunately the work to transform to/from JSON was done outside of the RTI core libraries and within RTI Recording Service. But the idea is to support this in the RTI core libraries in a future release.
You can contact your RTI account manager to let them know that you would like to this feature released sooner than later. By tying a feature request to a customer id will give the feature request higher visibility and importance when work for future releases is being prioritorized and scheduled.
@pi1ot Did you get this working? Are you able to serialize/deserialize protobuf data to/from CDR format? Can you share your approach here, so the community can benefit?
No, I choose yaml-cpp.
I know that our customers did create custom serialize/deserialize for IDL using RIDL as generic IDL compiler frontend using their own backend. Maybe something to look into that, we have several backends available as part of AXCIOMA and TAOX11