include/DataTypeWriterBase.h
branchv_0
changeset 2 1a574113da20
parent 1 6e3494943c91
child 3 cdfb91189c9e
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/include/DataTypeWriterBase.h	Mon Jul 09 00:43:35 2018 +0200
@@ -0,0 +1,47 @@
+#pragma once
+
+#include <string>
+#include "common.h"
+
+namespace relpipe {
+namespace writer {
+
+/**
+ * This class contains common features that are independent from particular data type (generic/template type)
+ */
+class DataTypeWriterBase {
+private:
+	const integer_t typeId;
+	const string_t typeCode;
+public:
+
+	DataTypeWriterBase(const integer_t typeId, const string_t typeCode) :
+	typeId(typeId), typeCode(typeCode) {
+	}
+
+	virtual ~DataTypeWriterBase() {
+	};
+
+	virtual string_t readString(std::istream &input) = 0;
+
+	virtual void writeString(std::ostream& output, const string_t &stringValue) = 0;
+
+	/**
+	 * @param dataType data type code as defined in DDP L0
+	 * @return whether this class supports conversions of this type
+	 */
+	virtual bool supports(const integer_t &dataType);
+
+	/**
+	 * @param dataType data type name as defined in DDP L0
+	 * @return whether this class supports conversions of this type
+	 */
+	virtual bool supports(const string_t &dataType);
+
+	integer_t getTypeId();
+
+	string_t getTypeCode();
+};
+
+}
+}
\ No newline at end of file