diff -r c80d55cdb42d -r fc3a84a62dd9 include/DataTypeReaderBase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/DataTypeReaderBase.h Sat Jul 14 17:01:16 2018 +0200 @@ -0,0 +1,61 @@ +#pragma once + +#include +#include "typedefs.h" + +namespace relpipe { +namespace writer { + +/** + * This class contains common features that are independent from particular data type (generic/template type) + */ +class DataTypeReaderBase { +private: + const integer_t typeId; + const string_t typeCode; +public: + + DataTypeReaderBase(const integer_t typeId, const string_t typeCode) : + typeId(typeId), typeCode(typeCode) { + } + + virtual ~DataTypeReaderBase() { + }; + + /** + * @param input input stream, should be at position where the value is to be read; the stream will not be closed afred reading + * @return read value in form of the string representation of given data type. + * E.g. integer 123 is returned as a character string "123", + * boolean true is returned as a character string "true". + * See Relational pipes format specification for details. + */ + virtual string_t readString(std::istream &input) = 0; + + /** + * @param output output stream, should be at position where the value is to be written; the stream will not be closed not flushed after writing + * @param stringValue write value as given data type (e.g. integer or boolean); stringValue parameter contains given value in string representation of given data type + * E.g. integer 123 is passed as a character string "123" + * boolean true is passed as a character string "true". + * See Relational pipes format specification for details. + */ + 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