equal
deleted
inserted
replaced
|
1 #include <relpipe/protocol/constants.h> |
|
2 |
1 #include "../include/relpipe/writer/RelationalWriter.h" |
3 #include "../include/relpipe/writer/RelationalWriter.h" |
2 #include "../include/relpipe/writer/Factory.h" |
4 #include "../include/relpipe/writer/Factory.h" |
3 #include "StreamRelationalWriter.h" |
5 #include "StreamRelationalWriter.h" |
4 |
6 |
5 namespace relpipe { |
7 namespace relpipe { |
7 |
9 |
8 RelationalWriter* Factory::create(std::ostream& output) { |
10 RelationalWriter* Factory::create(std::ostream& output) { |
9 return new StreamRelationalWriter(output); |
11 return new StreamRelationalWriter(output); |
10 } |
12 } |
11 |
13 |
|
14 /** |
|
15 * Some basic constants defined in lib-protocol are re-exported in public headers of lib-reader and lib-writer, |
|
16 * so we should check (during compile-time) that they match. |
|
17 */ |
|
18 #define PROTOCOL_VIOLATION_TYPE_ID_ERROR "type id does not match with protocol" |
|
19 static_assert((int) TypeId::BOOLEAN == relpipe::protocol::DATA_TYPE_ID_BOOLEAN, PROTOCOL_VIOLATION_TYPE_ID_ERROR); |
|
20 static_assert((int) TypeId::STRING == relpipe::protocol::DATA_TYPE_ID_STRING, PROTOCOL_VIOLATION_TYPE_ID_ERROR); |
|
21 static_assert((int) TypeId::INTEGER == relpipe::protocol::DATA_TYPE_ID_INTEGER, PROTOCOL_VIOLATION_TYPE_ID_ERROR); |
|
22 |
|
23 #define PROTOCOL_VIOLATION_TYPE_DEF_ERROR "type definition does not match with protocol" |
|
24 static_assert(std::is_same<relpipe::writer::boolean_t, typename relpipe::protocol::boolean_t>::value, PROTOCOL_VIOLATION_TYPE_DEF_ERROR); |
|
25 static_assert(std::is_same<relpipe::writer::integer_t, typename relpipe::protocol::integer_t>::value, PROTOCOL_VIOLATION_TYPE_DEF_ERROR); |
|
26 static_assert(std::is_same<relpipe::writer::string_t, typename relpipe::protocol::string_t>::value, PROTOCOL_VIOLATION_TYPE_DEF_ERROR); |
|
27 static_assert(std::is_same<relpipe::writer::octet_t, typename relpipe::protocol::octet_t>::value, PROTOCOL_VIOLATION_TYPE_DEF_ERROR); |
|
28 |
12 } |
29 } |
13 } |
30 } |