src/DataTypeWriter.h
branchv_0
changeset 9 0a40752e401d
parent 5 7fe870c3362f
child 15 8fd6c4d44071
equal deleted inserted replaced
8:03750aff8619 9:0a40752e401d
       
     1 #pragma once
       
     2 
       
     3 #include "DataTypeWriterBase.h"
       
     4 
       
     5 namespace relpipe {
       
     6 namespace writer {
       
     7 
       
     8 template<typename T> class DataTypeWriter : public DataTypeWriterBase {
       
     9 public:
       
    10 
       
    11 	DataTypeWriter(const integer_t typeId, const string_t typeCode) : DataTypeWriterBase(typeId, typeCode) {
       
    12 	}
       
    13 
       
    14 	virtual ~DataTypeWriter() {
       
    15 	};
       
    16 
       
    17 	virtual void writeValue(std::ostream& output, const T& value) = 0;
       
    18 
       
    19 	void writeString(std::ostream& output, const string_t &stringValue) override {
       
    20 		writeValue(output, toValue(stringValue));
       
    21 	}
       
    22 
       
    23 	virtual T toValue(const string_t &stringValue) = 0;
       
    24 
       
    25 };
       
    26 
       
    27 }
       
    28 }