| QxOrm 1.2.2 C++ Object Relational Mapping library

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Directories

- File List
- File Members

Classes | Namespaces | Defines | Typedefs
portable_iarchive.hpp File Reference

Provides an archive to read from portable binary files. More...

`#include <istream>`
`#include <boost/version.hpp>`
`#include <boost/utility/enable_if.hpp>`
`#include <boost/archive/binary_iarchive.hpp>`
`#include <boost/integer/endian.hpp>`
`#include <boost/math/fpclassify.hpp>`
`#include <boost/type_traits/is_integral.hpp>`
`#include <boost/type_traits/is_unsigned.hpp>`
`#include <boost/type_traits/is_arithmetic.hpp>`
`#include <boost/type_traits/is_floating_point.hpp>`
`#include "portable_archive_exception.hpp"`

Go to the source code of this file.

## Classes
class | eos::portable_iarchive
| Portable binary input archive using little endian format. More...
struct | eos::portable_iarchive::dummy< int >
## Namespaces
namespace | eos
namespace | boost
namespace | boost::archive
## Defines
#define | QX_ARCHIVE_PORTABLE_BINARY_VERSION_PATCH 3
#define | BOOST_ARCHIVE_CUSTOM_IARCHIVE_TYPES eos::portable_iarchive
## Typedefs
typedef boost::archive::binary_iarchive_impl < portable_iarchive > | eos::portable_iarchive_base

## Detailed Description

Provides an archive to read from portable binary files.

Author:
  christian.pfligersdorffer@eos.info

Version:
  3.1

This archive (pair) brings the advantanges of binary streams to the cross platform boost::serialization user. While being almost as fast as the native binary archive it allows its files to be exchanged between cpu architectures using different byte order (endianness). Speaking of speed: in serializing numbers the (portable) binary approach is approximately ten times faster than the ascii implementation that is inherently portable!

Based on the portable archive example by Robert Ramey this implementation uses Beman Dawes endian library and fp_utilities from Johan Rade, both being in boost since 1.36. Prior to that you need to add them both (header only) to your boost directory before you're able to use the archives provided. Our archives have been tested successfully for boost versions 1.33 to 1.38!

Note:
  Correct behaviour has so far been confirmed using PowerPC-32, x86-32 and x86-64 platforms featuring different byte order. So there is a good chance it will instantly work for your specific setup. If you encounter problems or have suggestions please contact the author.
  A few fixes introduced in version 3.1 let the archives pass all of the serialization tests. Thanks to Sergey Morozov for running the tests. Wouter Bijlsma pointed out where to find the fp_utilities and endian libraries headers inside the boost distribution. I would never have found them so thank him it works now out of the box since boost 1.36.
  With Version 3.0 the archives have been made portable across different boost versions. For that purpose a header is added to the data that supplies the underlying serialization library version. Backwards compatibility is maintained by assuming library version boost-1.33 if the iarchive is created using the no_header flag. Whether a header is present or not can be guessed by peeking into the stream: the header's first byte is the magic number 127 coinciding with 'e' | 'o' | 's' :-)
  Version 2.1 removes several compiler warnings and enhances floating point diagnostics to inform the user if some preconditions are violated on his platform. We do not strive for the universally portable solution in binary floating point serialization as desired by some boost users. Instead we support only the most widely used IEEE 754 format and try to detect when requirements are not met and hence our approach must fail. Contributions we made by Johan Rade and Ákos Maróy.
  Version 1.0 contained a serious bug that effectively transformed most of negative integral values into positive values! For example the two numbers -12 and 234 were stored in the same 8-bit pattern and later always restored to 234. This was fixed in this version in a way that does not change the interpretation of existing archives that did work because there were no negative numbers. The other way round archives created by version 2.x and containing negative numbers will raise an integer type size exception when reading it with version 1.0. Thanks to Markus Frohnmaier for testing the archives and finding the bug.
  The boost software license applies.

Definition in file portable_iarchive.hpp.

## Define Documentation

#define BOOST_ARCHIVE_CUSTOM_IARCHIVE_TYPES eos::portable_iarchive

Definition at line 314 of file portable_iarchive.hpp.

#define QX_ARCHIVE_PORTABLE_BINARY_VERSION_PATCH 3

Definition at line 118 of file portable_iarchive.hpp.