src/DataTypeWriter.h
author František Kučera <franta-hg@frantovo.cz>
Sat, 21 Jul 2018 17:30:25 +0200
branchv_0
changeset 9 0a40752e401d
parent 5 include/DataTypeWriter.h@7fe870c3362f
child 15 8fd6c4d44071
permissions -rw-r--r--
shared library with pure abstract class (interface)

#pragma once

#include "DataTypeWriterBase.h"

namespace relpipe {
namespace writer {

template<typename T> class DataTypeWriter : public DataTypeWriterBase {
public:

	DataTypeWriter(const integer_t typeId, const string_t typeCode) : DataTypeWriterBase(typeId, typeCode) {
	}

	virtual ~DataTypeWriter() {
	};

	virtual void writeValue(std::ostream& output, const T& value) = 0;

	void writeString(std::ostream& output, const string_t &stringValue) override {
		writeValue(output, toValue(stringValue));
	}

	virtual T toValue(const string_t &stringValue) = 0;

};

}
}