include/DataTypeWriterBase.h
author František Kučera <franta-hg@frantovo.cz>
Fri, 13 Jul 2018 23:02:09 +0200
branchv_0
changeset 3 cdfb91189c9e
parent 2 1a574113da20
child 4 e6db28447957
permissions -rw-r--r--
split common.h into typedefs.h and format.h

#pragma once

#include <string>
#include "typedefs.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();
};

}
}