src/DataTypeReaderBase.h
branchv_0
changeset 18 e11f1ad20826
parent 14 e8de089f95dd
child 29 755978b0935c
equal deleted inserted replaced
17:ec750c536705 18:e11f1ad20826
     1 #pragma once
     1 #pragma once
     2 
     2 
     3 #include <string>
     3 #include <string>
       
     4 #include <functional>
     4 #include "../include/relpipe/reader/TypeId.h"
     5 #include "../include/relpipe/reader/TypeId.h"
     5 #include "../include/relpipe/reader/typedefs.h"
     6 #include "../include/relpipe/reader/typedefs.h"
     6 
     7 
     7 namespace relpipe {
     8 namespace relpipe {
     8 namespace reader {
     9 namespace reader {
    22 
    23 
    23 	virtual ~DataTypeReaderBase() {
    24 	virtual ~DataTypeReaderBase() {
    24 	};
    25 	};
    25 
    26 
    26 	/**
    27 	/**
       
    28 	 * TODO: delete, use handler?
       
    29 	 * 
    27 	 * @param input input stream, should be at position where the value is to be read; the stream will not be closed afred reading
    30 	 * @param input input stream, should be at position where the value is to be read; the stream will not be closed afred reading
    28 	 * @return read value in form of the string representation of given data type.
    31 	 * @return read value in form of the string representation of given data type.
    29 	 * E.g. integer 123 is returned as a character string "123",
    32 	 * E.g. integer 123 is returned as a character string "123",
    30 	 * boolean true is returned as a character string "true".
    33 	 * boolean true is returned as a character string "true".
    31 	 * See Relational pipes format specification for details.
    34 	 * See Relational pipes format specification for details.
    32 	 */
    35 	 */
    33 	virtual string_t readString(std::istream &input) = 0;
    36 	virtual string_t readString(std::istream &input) = 0;
       
    37 
       
    38 	/**
       
    39 	 * The value is read from the input and then passed to the handler.
       
    40 	 * 
       
    41 	 * @param input
       
    42 	 * @param handler
       
    43 	 */
       
    44 	virtual void read(std::istream &input, std::function<void(const void *, const std::type_info&) > handler) = 0;
       
    45 
       
    46 	/**
       
    47 	 * TODO: documentation
       
    48 	 * 
       
    49 	 * @param input
       
    50 	 * @param handler
       
    51 	 */
       
    52 	virtual void read(std::istream &input, std::function<void(const string_t&, const void *, const std::type_info&) > handler) = 0;
    34 
    53 
    35 	/**
    54 	/**
    36 	 * @param dataType data type code as defined in DDP L0
    55 	 * @param dataType data type code as defined in DDP L0
    37 	 * @return whether this class supports conversions of this type
    56 	 * @return whether this class supports conversions of this type
    38 	 */
    57 	 */