|
Boost : |
From: Terje Slettebø (tslettebo_at_[hidden])
Date: 2002-11-25 13:45:18
>From: "Pavol Droba" <droba_at_[hidden]>
> On Mon, Nov 25, 2002 at 04:52:35PM +0100, Terje Sletteb? wrote:
> > >From: "Pavol Droba" <droba_at_[hidden]>
> >
> > > I can imagine it should be something like this:
> > >
> > > void modify_binary_header( void* pData )
> > > {
> > > binary_struct b;
> > > b.add_field<int>( 0, "field1" );
> > > b.add_field<char>( 4, "field2" );
> > > b.add_field<int>( 5, "field3" );
> > >
> > > b.map_to_binary( pData, offset );
> > >
> > > b["field1"]=b["field2"]*2;
> > > }
> > >
> > > Idea is that binary_struct would be responsible to some sort of safe
> > > copying ( possibly byte-by-byte )
> > > of binary data into/out from the internal field representation. It can
> > > provide also some
> > > other functionality like byte order corretion or handling of sub-byte
> > > fields ( something what
> > > is not aligned to byte boundary )
> > >
> > > Well, this is my idea how to resolve such a problem where simple
mapping
> > > using offset_cast is not sufficient.
> > >
> > Aha, I understand. It's an interesting proposal. I guess it would still
> > require some way of detecting, or specifying, alignment requirements (to
> > avoid doing it completely pessimistic, by only reading a byte at a
time).
> >
> I think it would have to be some compile time option. I don't know about
any way
> how to detect it automaticaly.
>
> Anyway, do you think that it's worth to start a discussion about such a
library?
Since "you" can mean both singular and plural, I guess I should reply, here.
Well, I think I'll leave this up to the rest of the list to reply to. After
all, we already have a thread. :)
Regards,
Terje
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk