Skip to content

Commit 59891b2

Browse files
adding documentation
1 parent 64e43d1 commit 59891b2

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

DataFormats/Generic/test/testMessageList.cxx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
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

@@ -7,8 +15,10 @@
715
using namespace AliceO2;
816
using namespace Format;
917

18+
// a simple message type, just a pointer to some payload
1019
typedef const uint8_t* SimpleMsg_t;
1120

21+
// a simple header definition
1222
struct 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
2031
std::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
2539
class TestMsg {
2640
public:
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
5571
template<typename ListType>
5672
void print_list(ListType& list, typename ListType::HdrComparison hdrsel = typename ListType::HdrComparison()) {
5773
for (typename ListType::iterator it = list.begin(hdrsel);

0 commit comments

Comments
 (0)