Boost logo

Boost :

From: Beman Dawes (beman_at_[hidden])
Date: 2000-11-22 20:45:24


At 12:08 AM 11/23/2000 +0100, Jens Maurer wrote:

> ...
>
>Completely disparate from this discussion is the Buffer/iostreams
>discussion.
>
>All in all, this probably means splitting off more parts from the
>persistence library, with clearly specified interfaces:
>
> - Formatting of elementary items (my Reader/Writer, XTL's Format).
>XDR and GIOP libraries on its own would come in handy here (XTL's
>xdr.h looks slightly messy and somewhat non-portable to me, though).
>The interface is: reading and writing int's, double's, strings,
>structure and sequence boundaries etc.
> - Buffer/iostream: Needs more investigation.

Yes, I've been looking at that lower level too. It seems to me that your
Reader/Writer needs to call a lower level which handles actual value
formatting, and is parameterized by stream to avoid the J*K (formats*
streams) problem.

This lower level (which I'm thinking of as a Stream Format Adaptor) would
also be useful standalone to solve general binary streaming problems as
discussed in other threads. It would handle marshalling each byte of an
int, for example, but the Reader/Writer/Format caller would still be
responsible for calling it with a trailing " " or "," or whatever
persistence format called for.

I'm thinking of two sets of Stream Format Adaptors:

// XDR Stream Format Adaptors
// Exactly follows the IETF's RFC-1832 standard
// which is big-endian only, and pads modulo 4.
template <class WritableStream> class xdr_ostream;
template <class ReadableStream> class xdr_istream;

// Helper classes which model the ByteOrdering concept.
// User can supply own ByteOrdering class to handle odd-balls.
class big_endian;
class little_endian;
class native_endian;

// Binary Stream Format Adaptors
// To meet the portable integer (and other data type) requirements
// identified by Beman, Darin, Mark, Dave, etc.
template <class WritableStream, class ByteOrdering=big_endian>
   class xdr_ostream;
template <class ReadableStream, class ByteOrdering=big_endian>
   class xdr_istream;

That's as far as I've gotten.

--Beman
  


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk