Binary serialization
From Code Synthesis Wiki
Revision as of 10:12, 14 February 2011 Erik Sjölund (Talk | contribs) ← Previous diff |
Current revision Erik Sjölund (Talk | contribs) |
||
Line 28: | Line 28: | ||
== QDataStream == | == QDataStream == | ||
+ | |||
+ | [http://doc.qt.nokia.com/latest/qdatastream.html QDataStream] is a serialization class from the Qt library. Some [https://svn.sbc.su.se/repos/qdatastream-for-codesynthesis-xsd/trunk/ experimental code] is available that uses QDataStream together with Codesynthesis XSD. | ||
= Comparison of the binary formats = | = Comparison of the binary formats = | ||
Serializing a Codesynthesis XSD data object can yield different file sizes for the different binary formats. | Serializing a Codesynthesis XSD data object can yield different file sizes for the different binary formats. | ||
- | The xml schema datatype int8 takes up 32 bits in the XDR format but only 8 bit in the CDR and the QDataStream format (tested on a Ubuntu Linux 10.10 32-bit computer). | + | The XML Schema datatype int8 takes up 32 bits in the XDR format but only 8 bit in the CDR and the QDataStream format (tested on a Ubuntu Linux 10.10 32-bit computer). |
Current revision
The C++/Tree Mapping User Manual has a section about binary serialization.
Contents |
Predefined binary formats
CDR (Common Data Representation)
The ADAPTIVE Communication Environment (ACE) provides a binary format. The extraction and insertion classes are described in the doxygen generated documentation.
There is an example of using CDR in examples/cxx/tree/binary/cdr
XDR (eXternal Data Representation)
There is an example of using XDR in examples/cxx/tree/binary/xdr
Custom binary formats
Boost serialization library
The Boost C++ libraries provides a serialization library.
There is an example of using Boost serialization in examples/cxx/tree/binary/boost
QDataStream
QDataStream is a serialization class from the Qt library. Some experimental code is available that uses QDataStream together with Codesynthesis XSD.
Comparison of the binary formats
Serializing a Codesynthesis XSD data object can yield different file sizes for the different binary formats. The XML Schema datatype int8 takes up 32 bits in the XDR format but only 8 bit in the CDR and the QDataStream format (tested on a Ubuntu Linux 10.10 32-bit computer).