From: Paul Floyd on
On 24 Nov 2005 12:19:53 -0500, kanze <kanze(a)gabi-soft.fr> wrote:
> Holger Sebert wrote:

>> A general purpose serialization library might be overkill, or
>> not specialized enough (furthermore I am obliged to keep the
>> library dependencies as small as possible).
>
>> Does anyone know what in total I have to consider when dealing
>> portably with binary floating point data and could give a link
>> or something?
>
> I'm familiar with BER format, but it might be overkill; it can
> also be very expensive to decode. About the only other portable
> floating point format I know is text.

Assuming that you are referring to the Basic Encoding Rules of ASN.1,
there exist other rules that have better performance, especially the
PER, Packed Encoding Rules.

There are commercial libraries that perform encoding and decoding, with
C and C++ bindings.

A bientot
Paul
--
Paul Floyd http://paulf.free.fr (for what it's worth)
Surgery: ennobled Gerald.

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

From: elazro on
It sounds like HDF (Hierarchical Data Format) is something you might
wish to look into. HDF was developed for dealing with (large)
scientific datasets, and supports binary IO, compression, and
blocking/tiling for improved IO speeds. It handles endianness and
other issues for you, and it also compiles on a number of
high-performance platforms, so it may work where boost::serialization
fails.

It may be overkill for your situation, it's got a non-trivial learning
curve, and it is mainly C libraries (though there are C++ wrappers).
However, it is quite a good library, widely deployed, and is suitable
for production code.

Otherwise, if you would rather hand-roll it, I'd just put a endianness
flag in, use the types from cstddef for ints and longs (int32_t, etc.),
and encapsulate the conversion routines so that if you run into a
target architecture where the preceding isn't enough, you'll have an
easier time fixing it.

-matt


[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

First  |  Prev  | 
Pages: 1 2 3
Prev: SHA1
Next: generate double persision random value