Is there a boost library that I can use to dynamically deserialize structures from untyped buffers? I need to write code that receives a buffer of data from another computer, with some data serialized with bitfield structs. Yes, I do understand the difficulty of doing this and that it would have been easier if the data was serialized properly before transmission. I have no control over the transmitted data, but I can get the data format defined accurately. I fully understand the numerous edge cases and pitfalls with doing this and don't take the task lightly. Therefore, I'm looking for libs and open source code to make it easier. The incoming data format can and frequently does change so I can't hard code the format, but the format is defined in an XML file. I wrote an internal database containing field type, offset, and bit lengths, and populated via the XML file. My XML file is auto generated to match the as built interface definition, bit for bit. I wrote code that deserializes most of the data, but I need to rewrite it as a general purpose function to work for all cases, including bitfield structs. For now, I can assume same CPU (little endian) and the same compiler (gcc). However, both source and destination CPUs and OS's might be 32 bit or 64 bit. In future versions, I would like to add support for endian conversion and differing compiler packing. Does boost have something that would help? Sent from my Packard Bell 386
What C++ data structures should the buffer be deserialized into? When do you get the interface definition (the XML file)? At compile-time or at run-time? Are you going to handle several versions of the interface definition at the same time?
I'm converting each element from an intrinsic data type to a key/value string.
Runtime.
Only one version at a time, but it can contain hundreds or thousands of individual message definitions. Uniqueness is enforced by the sender and within the XML schema.
On Apr 27, 2014, at 6:45 AM, Bjorn Reese
What C++ data structures should the buffer be deserialized into?
When do you get the interface definition (the XML file)? At compile-time or at run-time?
Are you going to handle several versions of the interface definition at the same time?
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
There was an extensive discussion of a proposed 'bitstream' library last year. https://groups.google.com/forum/m/#!topic/boost-devel-archive/oNyxJjaPD7w I'm not sure if the author (Paul Long) continued with it, but he links to code.
On Apr 27, 2014, at 8:09 AM, Mathew Benson
wrote: I'm converting each element from an intrinsic data type to a key/value string.
Runtime.
Only one version at a time, but it can contain hundreds or thousands of individual message definitions. Uniqueness is enforced by the sender and within the XML schema.
On Apr 27, 2014, at 6:45 AM, Bjorn Reese
wrote: What C++ data structures should the buffer be deserialized into?
When do you get the interface definition (the XML file)? At compile-time or at run-time?
Are you going to handle several versions of the interface definition at the same time?
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (3)
-
Bjorn Reese
-
Gordon Woodhull
-
Mathew Benson