[Development] Proposal for an efficient and robust (de)serialization mechanism working with Qt-supported data

Arnaud Clere arnaud.clere at minmaxmedical.com
Fri Aug 30 18:06:41 CEST 2019


-----Original Message-----
> From: Bogdan Vatra <bogdan.vatra at kdab.com> 
>
> It will be great if we can find a way to use it any (de)serialization mechanism (e.g. proto buff, flat buffers, etc.) not only with only one (qt specific).

As explained in the answer to Simon, QBind replaces .proto files with C++ functions to not require external tools. 
It is probable although uncertain that protobuf's binary encoding [1] can be read/written by QBind.
But the corresponding IBind implementation would not be trivial as it would need to map record's item names to unique integers and stack the current data structure that is implicit in the binary encoding.
It is even more probable that flatbuffers could have an IBind implementation since they claim to not erase any information but I did not look at the details[2].

FWIU, both protobuf and flatbuffers achieve ultimate performance by mandating that you use their generated data structures even though you can hide them in your own classes (where you can also add behavior).

Although QBind may be compatible with their binary encodings, it could not provide the same performance, just approach it.
OTOH, the approach of QBind keeps the data format and C++ types more cleanly separated and requires no tool nor separately compiled data structures.

Arnaud

[1] https://developers.google.com/protocol-buffers/docs/encoding
[2] https://google.github.io/flatbuffers/flatbuffers_internals.html 



More information about the Development mailing list