Boost logo

Boost :

From: Reece Dunn (msclrhd_at_[hidden])
Date: 2003-12-16 08:58:27


Beman Dawes wrote:

>There is a discussion going on now on the C++ committee's library
>reflector, summed up by Pete Becker:

> > Yes, there is a general need for displaying an ordered set (in the
> > broadest sense) of things, whether we call that set a pair, a tuple, a
> > container, a complex number, or whatever.

Can you tell me where to find this discussion? Or is it just for committee
members?

>Discussion included ways of providing user customizable formatting for such
>display.

>This strikes me as the same problem as the much discussed (on Boost) issue
>of user-customizable serialization formats.

>I wonder what those who have been following Robert Ramey's serialization
>proposal closely think? Could one mechanism solve both serialization and
>display needs?

Where can I find information about this proposal? How does it compare to my
work for displaying types? Collaboration?

I agree there are similarities, but with serialization, it is important to
encode the type and/or length of the object being sent to the stream, e.g.

   $l{2}[ $c( 3, 4 ), $c( 1.5, -0.334 ) ]

where $l{2} indicates a sequence of length 2, and $c a complex number. This
information is useful for reading the data back in (e.g. using v.resize( 2 )
when reading in a vector) and performing validation (i.e. producing an error
if you have a vector< int > when reading in the above).

I understand that it is theoretically possible to have the output

   [ ( 3, 4 ), ( 1.5, -0.334 ) ]

read back into an appropriate container, without any type/size information.
The question then becomes:

[1] how do we support fixed-size data-types (e.g. ublas vectors/matrices,
multi_array or C-style arrays) without knowing the size of the sequence at
the start (it is distracting for a general output of data-types)?
   NOTE: We could provide a flag to add this type of information to the
stream, allowing a display and serialization mode. Thoughts?

[2] the output for a type will have a custom open, close and separator
character sequence, so how do we validate these when reading it back in?

[3] errors and error recovery, especially when a long way in?

I have a few ideas about adapting my Output Formatters library to support
reading data back in through an input stream. What are peoples thoughts
about this?

BTW: The latest version of my library is on boost-sandbox/boost/outfmt and
boost-format/lib/outfmt.

Regards,
Reece H Dunn

_________________________________________________________________
On the move? Get Hotmail on your mobile phone http://www.msn.co.uk/msnmobile


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