include/DataTypeReaderBase.h
author František Kučera <franta-hg@frantovo.cz>
Sat, 14 Jul 2018 17:06:04 +0200
branchv_0
changeset 4 da021e58c946
parent 2 fc3a84a62dd9
child 5 e004585ef84d
permissions -rw-r--r--
rename 'writer' namespace to 'reader'
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
c80d55cdb42d copy of .cpp and .h from relpipe-lib-writer.cpp
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     1
#pragma once
c80d55cdb42d copy of .cpp and .h from relpipe-lib-writer.cpp
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     2
c80d55cdb42d copy of .cpp and .h from relpipe-lib-writer.cpp
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     3
#include <string>
c80d55cdb42d copy of .cpp and .h from relpipe-lib-writer.cpp
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     4
#include "typedefs.h"
c80d55cdb42d copy of .cpp and .h from relpipe-lib-writer.cpp
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     5
c80d55cdb42d copy of .cpp and .h from relpipe-lib-writer.cpp
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     6
namespace relpipe {
4
da021e58c946 rename 'writer' namespace to 'reader'
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
     7
namespace reader {
1
c80d55cdb42d copy of .cpp and .h from relpipe-lib-writer.cpp
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     8
c80d55cdb42d copy of .cpp and .h from relpipe-lib-writer.cpp
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     9
/**
c80d55cdb42d copy of .cpp and .h from relpipe-lib-writer.cpp
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    10
 * This class contains common features that are independent from particular data type (generic/template type)
c80d55cdb42d copy of .cpp and .h from relpipe-lib-writer.cpp
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    11
 */
2
fc3a84a62dd9 rename writers to readers
František Kučera <franta-hg@frantovo.cz>
parents: 1
diff changeset
    12
class DataTypeReaderBase {
1
c80d55cdb42d copy of .cpp and .h from relpipe-lib-writer.cpp
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    13
private:
c80d55cdb42d copy of .cpp and .h from relpipe-lib-writer.cpp
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    14
	const integer_t typeId;
c80d55cdb42d copy of .cpp and .h from relpipe-lib-writer.cpp
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    15
	const string_t typeCode;
c80d55cdb42d copy of .cpp and .h from relpipe-lib-writer.cpp
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    16
public:
c80d55cdb42d copy of .cpp and .h from relpipe-lib-writer.cpp
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    17
2
fc3a84a62dd9 rename writers to readers
František Kučera <franta-hg@frantovo.cz>
parents: 1
diff changeset
    18
	DataTypeReaderBase(const integer_t typeId, const string_t typeCode) :
1
c80d55cdb42d copy of .cpp and .h from relpipe-lib-writer.cpp
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    19
	typeId(typeId), typeCode(typeCode) {
c80d55cdb42d copy of .cpp and .h from relpipe-lib-writer.cpp
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    20
	}
c80d55cdb42d copy of .cpp and .h from relpipe-lib-writer.cpp
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    21
2
fc3a84a62dd9 rename writers to readers
František Kučera <franta-hg@frantovo.cz>
parents: 1
diff changeset
    22
	virtual ~DataTypeReaderBase() {
1
c80d55cdb42d copy of .cpp and .h from relpipe-lib-writer.cpp
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    23
	};
c80d55cdb42d copy of .cpp and .h from relpipe-lib-writer.cpp
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    24
c80d55cdb42d copy of .cpp and .h from relpipe-lib-writer.cpp
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    25
	/**
c80d55cdb42d copy of .cpp and .h from relpipe-lib-writer.cpp
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    26
	 * @param input input stream, should be at position where the value is to be read; the stream will not be closed afred reading
c80d55cdb42d copy of .cpp and .h from relpipe-lib-writer.cpp
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    27
	 * @return read value in form of the string representation of given data type.
c80d55cdb42d copy of .cpp and .h from relpipe-lib-writer.cpp
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    28
	 * E.g. integer 123 is returned as a character string "123",
c80d55cdb42d copy of .cpp and .h from relpipe-lib-writer.cpp
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    29
	 * boolean true is returned as a character string "true".
c80d55cdb42d copy of .cpp and .h from relpipe-lib-writer.cpp
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    30
	 * See Relational pipes format specification for details.
c80d55cdb42d copy of .cpp and .h from relpipe-lib-writer.cpp
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    31
	 */
c80d55cdb42d copy of .cpp and .h from relpipe-lib-writer.cpp
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    32
	virtual string_t readString(std::istream &input) = 0;
c80d55cdb42d copy of .cpp and .h from relpipe-lib-writer.cpp
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    33
c80d55cdb42d copy of .cpp and .h from relpipe-lib-writer.cpp
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    34
	/**
c80d55cdb42d copy of .cpp and .h from relpipe-lib-writer.cpp
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    35
	 * @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
c80d55cdb42d copy of .cpp and .h from relpipe-lib-writer.cpp
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    36
	 * @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
c80d55cdb42d copy of .cpp and .h from relpipe-lib-writer.cpp
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    37
	 * E.g. integer 123 is passed as a character string "123"
c80d55cdb42d copy of .cpp and .h from relpipe-lib-writer.cpp
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    38
	 * boolean true is passed as a character string "true".
c80d55cdb42d copy of .cpp and .h from relpipe-lib-writer.cpp
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    39
	 * See Relational pipes format specification for details.
c80d55cdb42d copy of .cpp and .h from relpipe-lib-writer.cpp
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    40
	 */
c80d55cdb42d copy of .cpp and .h from relpipe-lib-writer.cpp
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    41
	virtual void writeString(std::ostream& output, const string_t &stringValue) = 0;
c80d55cdb42d copy of .cpp and .h from relpipe-lib-writer.cpp
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    42
c80d55cdb42d copy of .cpp and .h from relpipe-lib-writer.cpp
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    43
	/**
c80d55cdb42d copy of .cpp and .h from relpipe-lib-writer.cpp
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    44
	 * @param dataType data type code as defined in DDP L0
c80d55cdb42d copy of .cpp and .h from relpipe-lib-writer.cpp
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    45
	 * @return whether this class supports conversions of this type
c80d55cdb42d copy of .cpp and .h from relpipe-lib-writer.cpp
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    46
	 */
c80d55cdb42d copy of .cpp and .h from relpipe-lib-writer.cpp
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    47
	virtual bool supports(const integer_t &dataType);
c80d55cdb42d copy of .cpp and .h from relpipe-lib-writer.cpp
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    48
c80d55cdb42d copy of .cpp and .h from relpipe-lib-writer.cpp
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    49
	/**
c80d55cdb42d copy of .cpp and .h from relpipe-lib-writer.cpp
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    50
	 * @param dataType data type name as defined in DDP L0
c80d55cdb42d copy of .cpp and .h from relpipe-lib-writer.cpp
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    51
	 * @return whether this class supports conversions of this type
c80d55cdb42d copy of .cpp and .h from relpipe-lib-writer.cpp
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    52
	 */
c80d55cdb42d copy of .cpp and .h from relpipe-lib-writer.cpp
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    53
	virtual bool supports(const string_t &dataType);
c80d55cdb42d copy of .cpp and .h from relpipe-lib-writer.cpp
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    54
c80d55cdb42d copy of .cpp and .h from relpipe-lib-writer.cpp
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    55
	integer_t getTypeId();
c80d55cdb42d copy of .cpp and .h from relpipe-lib-writer.cpp
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    56
c80d55cdb42d copy of .cpp and .h from relpipe-lib-writer.cpp
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    57
	string_t getTypeCode();
c80d55cdb42d copy of .cpp and .h from relpipe-lib-writer.cpp
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    58
};
c80d55cdb42d copy of .cpp and .h from relpipe-lib-writer.cpp
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    59
c80d55cdb42d copy of .cpp and .h from relpipe-lib-writer.cpp
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    60
}
c80d55cdb42d copy of .cpp and .h from relpipe-lib-writer.cpp
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    61
}