Awesome.
On Fri, Dec 13, 2019, 02:09 Purushotham Nayak <[email protected]>
wrote:
> Hi Everyone,
>
> There are a few changes I wanted to make to the C++ implementation and make
> compatible with std (and asio) streams as well as update it to use
> C++11/14. I wanted to see what other thought. I would be happy to make the
> change. I already have an implementation along these lines.
>
> Currently, we use the output stream like this:
>
> std::auto_ptr<avro::OutputStream> out =
> avro::fileOutputStream("complex.dat", 4096);
> avro::EncoderPtr e = avro::binaryEncoder();
> e->init(*out);
> c::cpx c1;
> c1.re = 1.0;
> c1.im = 2.13;
> avro::encode(*e, c1);
>
> Instead we should able to do like this:
>
> avro::ostream os("complex.dat", ios_base::binary); // avro binary stream
> c::cpx c1;
> c1.re = 1.0;
> c1.im = 2.13;
> os << c1;
>
> In other words, it should work similar to std stream. The use of
> ios_base::binary or not decides whether this is a binary / json stream. The
> implementation of the encoder/buffer is internal to the stream and client
> classes don't need to be aware of them.
>
> - Purush
>