Closed mikegratton closed 1 year ago
Thanks for your contribution @mikegratton
Fast DDS developers have internally discussed this feature and the agreement is that this feature is not going to be officially supported in Fast DDS-Gen. Having features contributed by the community but without an official maintenance is risky and might arise false expectations in the Fast DDS-Gen users. Besides, the custom templates feature, -extrastg
, recently included in Fast DDS-Gen might be used to generate the JSON files you are interested in. This feature is scarcely documented and efforts to improve it will be made.
Consequently, I am going to proceed and close this PR. Thanks for your understanding!
Add to/from json support.
For type-to-json, I've added a method to generated types
toJson()
that produces a json string. This requires the changes to the idl parser to distinguish enum types (so that they may be serialized as strings in json). These json strings provide a simple way to view the contents of an idl-derived type when debugging an application.For type-from-json, I added optional extra output files.
-json
command-line argument will generate FooJsonSupport.h/cxx from Foo.idl along with the other artifacts.XXXFromJson(std::string)
functions that return instances of the idl-derived type by value.json.hpp
file must be in the include path when compiling FooJsonSupport.cxx.I know requiring users of fastddsgen to supply libraries other than fastcdr is a burden, so I've tried to isolate use by making these files (a) optionally generated and (b) only requiring the library for the cxx.