diff -r 8fd6c4d44071 -r 3613617d3076 src/DataTypeWriter.h --- a/src/DataTypeWriter.h Sun Jul 22 10:26:22 2018 +0200 +++ b/src/DataTypeWriter.h Sun Jul 22 17:19:25 2018 +0200 @@ -1,5 +1,8 @@ #pragma once +#include +#include + #include "DataTypeWriterBase.h" namespace relpipe { @@ -16,6 +19,17 @@ virtual void writeValue(std::ostream& output, const T& value) = 0; + void writeRaw(std::ostream& output, const void * value, const std::type_info& type) override { + if (type == typeid (T)) { + const T v = *(static_cast(value)); + writeValue(output, v); + } else { + wstringstream message; + message << L"Data type in writeRaw() does not match – got: " << type.name() << " but expected: " << typeid (T).name(); + throw RelpipeWriterException(message.str()); + } + } + void writeString(std::ostream& output, const string_t &stringValue) override { writeValue(output, toValue(stringValue)); }