equal
deleted
inserted
replaced
1 #pragma once |
1 #pragma once |
2 |
2 |
3 #include <string> |
3 #include <string> |
|
4 #include "../include/relpipe/reader/TypeId.h" |
4 #include "../include/relpipe/reader/typedefs.h" |
5 #include "../include/relpipe/reader/typedefs.h" |
5 |
6 |
6 namespace relpipe { |
7 namespace relpipe { |
7 namespace reader { |
8 namespace reader { |
8 |
9 |
9 /** |
10 /** |
10 * This class contains common features that are independent from particular data type (generic/template type) |
11 * This class contains common features that are independent from particular data type (generic/template type) |
11 */ |
12 */ |
12 class DataTypeReaderBase { |
13 class DataTypeReaderBase { |
13 private: |
14 private: |
14 const integer_t typeId; |
15 const TypeId typeId; |
15 const string_t typeCode; |
16 const string_t typeCode; |
16 public: |
17 public: |
17 |
18 |
18 DataTypeReaderBase(const integer_t typeId, const string_t typeCode) : |
19 DataTypeReaderBase(const TypeId typeId, const string_t typeCode) : |
19 typeId(typeId), typeCode(typeCode) { |
20 typeId(typeId), typeCode(typeCode) { |
20 } |
21 } |
21 |
22 |
22 virtual ~DataTypeReaderBase() { |
23 virtual ~DataTypeReaderBase() { |
23 }; |
24 }; |
33 |
34 |
34 /** |
35 /** |
35 * @param dataType data type code as defined in DDP L0 |
36 * @param dataType data type code as defined in DDP L0 |
36 * @return whether this class supports conversions of this type |
37 * @return whether this class supports conversions of this type |
37 */ |
38 */ |
38 virtual bool supports(const integer_t &dataType); |
39 virtual bool supports(const TypeId &dataType) { |
|
40 return dataType == typeId; |
|
41 } |
39 |
42 |
40 /** |
43 /** |
41 * @param dataType data type name as defined in DDP L0 |
44 * @param dataType data type name as defined in DDP L0 |
42 * @return whether this class supports conversions of this type |
45 * @return whether this class supports conversions of this type |
43 */ |
46 */ |
44 virtual bool supports(const string_t &dataType); |
47 virtual bool supports(const string_t &dataType) { |
|
48 return dataType == typeCode; |
|
49 } |
45 |
50 |
46 integer_t getTypeId(); |
51 TypeId getTypeId() { |
|
52 return typeId; |
|
53 } |
47 |
54 |
48 string_t getTypeCode(); |
55 string_t getTypeCode() { |
|
56 return typeCode; |
|
57 } |
49 }; |
58 }; |
50 |
59 |
51 } |
60 } |
52 } |
61 } |