Hi everyone,
I'm playing around with Avro C++ and it looks pretty neat. I generated a
class based on a JSON schema which was dropped in a header file. What is
the best way to write out instances of these classes to a file? The
example in the documentation shows:
Math::complex c;
c.real = 10.0;
c.imaginary = 20.0;
// Writer is the object that will do the actual I/O and buffer the results
avro::Writer writer;
// This will invoke the writer on my object
avro::serialize(writer, c);
***********************************************************************************************
But it is unclear how to attach a file stream to the writer. I also tried:
avro::compileJsonSchema(is, validSchema);
is.close();
dfWriter = new
avro::DataFileWriter<GenObject>(outputdir.c_str(),
validSchema);
dfWriter->write(obj);
But this won't compile giving the error:
/terylt/Projects/bitvectors/avro-cpp-1.5.1/api/Specific.hh:195: error:
'encode' is not a member of 'avro::codec_traits<GenObject>'
What's the best way to write out my objects to disk?
Regards,
Teryl