Boost logo

Boost :

Subject: Re: [boost] Any interest in bitstream class?
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2013-06-28 16:32:08


On 28/06/13 03:44, Paul Long wrote:
> Same semantics as, e.g., stringstream, but it operates on binary data. I
> already have the analogues to istringstream/stringbuf (you can take a
> look at ibitstream/bitbuf at https://github.com/dplong/bstream) There
> are some interesting features, but I won't go into them here. If there
> is interest, I would implement obitstream and bitstream and possibly
> support Boost::dynamic_bitset.
>
> The rationale is _succinct_ expression of predictive parsing of binary
> data.
>
> I've used ibitstream in production code for decoding RTP headers and
> frames of various video encodings. Below is a simple function that
> decodes an RTP header using ibitstream; I also have a GitHub repo that
> contains more complex code for high-level parsing of H.264 frames at
> https://github.com/dplong/rtspudph264

A couple of questions:

- how do you overload operator>> or operator<< for your stream? How do
you avoid conflicts with text-based overloads?
- what does writing an int to a stream actually do? Is it the same
behaviour as write(&i, sizeof(int)), or does it translate the int to
big-endian first?


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