include/DataTypeWriterBase.h
author František Kučera <franta-hg@frantovo.cz>
Mon, 09 Jul 2018 00:43:35 +0200
branchv_0
changeset 2 1a574113da20
parent 1 DataTypeWriterBase.h@6e3494943c91
child 3 cdfb91189c9e
permissions -rw-r--r--
separate 'src' and 'include' (public interface)

#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();
};

}
}