Boost logo

Boost :

From: Robert Ramey (ramey_at_[hidden])
Date: 2004-04-20 14:11:12

Ralf W. Grosse-Kunstleve wrote:

> FWIW: For the serialization of C++ arrays wrapped as Python objects (via
> Python's pickle) I implemented a small "library" (it really is just one
> header file) for converting integers and floating-point numbers to a
> pseudo text format. In principle it works just like the conversion to
> base-10 numbers, but uses base-256 instead. I.e. the result looks like a
> binary format, but it is as machine-independent as a text format. The
> serialized strings are smaller than regular text format, but larger than
> raw binary format.

> Integers are serialized like this:

> NXX...X


This is interesting. I made an example as part of the library
called:demo_portable_binary or which attempted to handle issues such as
endianness and size. I bailed at floating point because of the concern for
handling things like conversion between 80 bit IEEE float and 64 proprietary
floats. And then I was just making as sketch to inspire someone to
implement XDR which I presumed had some sort of way of handling this. (I
still don't know how other formats handle this) I like your method.

I may steal it yet.

Robert Ramey

Boost list run by bdawes at, gregod at, cpdaniel at, john at