Skip to content

Instantly share code, notes, and snippets.

@rblaze
Created February 25, 2015 01:54
Show Gist options
  • Save rblaze/ef1ec311ab4e497319c2 to your computer and use it in GitHub Desktop.
Save rblaze/ef1ec311ab4e497319c2 to your computer and use it in GitHub Desktop.
class ConverterInterface {
void WriteInt(int, int);
void WriteDouble(int, double);
}
void convert_stream(Stream stream, ConverterInterface *writer) {
for (auto record : stream) {
if (record.type == INT) {
writer->WriteInt(record.fieldnumber, record.intvalue);
} else if (record.type == DOUBLE) {
writer->WriteDouble(record.fieldnumber, record.intvalue);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment