Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost iostreams for binary data
From: Jeff Garland (azswdude_at_[hidden])
Date: 2017-02-03 16:24:53


I guess the request is somewhat confusing -- are you asking about
boost.iostreams, boost.serialization, something else? Note, if you want to
do binary i/o in C++ you can always use the streambuf interfaces directly
-- which would be similar to the vector approach if I'm understanding...

http://en.cppreference.com/w/cpp/io/basic_streambuf

Jeff

On Thu, Feb 2, 2017 at 2:07 PM, Robert Dailey <rcdailey.lists_at_[hidden]>
wrote:

> On Tue, Jan 31, 2017 at 2:25 PM, Robert Dailey <rcdailey.lists_at_[hidden]>
> wrote:
> > I have my own BinaryInputStream and BinaryOutputStream classes that
> > simply take a reference to some container that meets the requirements
> > of random access and contiguous internal memory. It doesn't own this
> > container, but rather serves as an adapter to the container to allow
> > stream operators to be used for streaming out data. For example, you
> > can stream a `std::uint32_t` to the binary stream, and it will insert
> > 4 elements into an internal byte vector which is just
> > `std::vector<std::uint8_t>`.
> >
> > I did not implement these in terms of IO streams, because those seemed
> > a bit overkill and make a lot of assumptions on the data being
> > text-only. Also I can't stream binary data into vectors, lists, and
> > other containers because the data simply can't be parsed. Each stream
> > out of a binary vector must be done so with a finite count of bytes.
> >
> > Would it make sense to implement these objects in terms of the
> > IOstream facilities provided by boost? I know these were designed to
> > make defining stream classes easier, but honestly I don't have a lot
> > of experience with them.
> >
> > Any feedback on this? Thanks in advance. I can provide some example
> > code if needed.
>
> Could I get any advice on this? If I was too vague, please let me know.
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net