1+ // / @file testMessageList.cxx
2+ // / @brief Unit test for message_list.h template class
3+
4+ // TODO: this is for the moment only testing compilation
5+ // ideally, this test program is only compiled when the test
6+ // is going to be executed. By using add_executable in the cmake
7+ // configuartion, the program is always build (though not installed)
8+
19#include " message_list.h"
210#include " memory-format.h"
311
715using namespace AliceO2 ;
816using namespace Format ;
917
18+ // a simple message type, just a pointer to some payload
1019typedef const uint8_t * SimpleMsg_t;
1120
21+ // a simple header definition
1222struct SimpleHeader_t {
1323 uint32_t id;
1424 uint32_t specification;
@@ -17,11 +27,15 @@ struct SimpleHeader_t {
1727 SimpleHeader_t (uint32_t _id, uint32_t _spec) : id(_id), specification(_spec) {}
1828};
1929
30+ // print operator for the simple header
2031std::ostream& operator <<(std::ostream& stream, SimpleHeader_t header) {
2132 stream << " Header ID: " << header.id << std::endl;
2233 stream << " Header Specification: " << std::hex << header.specification ;
2334}
2435
36+ // more complex message type, some class which wraps around payload
37+ // implements type conversion operator to return pointer to payload
38+ // buffer
2539class TestMsg {
2640public:
2741 TestMsg () : mBuffer (nullptr ), mBufferSize (0 ) {}
@@ -52,6 +66,8 @@ class TestMsg {
5266 unsigned mBufferSize ;
5367};
5468
69+ // helper function to print entries of the message list by using
70+ // iterator
5571template <typename ListType>
5672void print_list (ListType& list, typename ListType::HdrComparison hdrsel = typename ListType::HdrComparison ()) {
5773 for (typename ListType::iterator it = list.begin (hdrsel);
0 commit comments