1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
#include "DCCTrailerBlock.h"
#include "DCCDataParser.h"
#include "DCCDataMapper.h"
DCCTBTrailerBlock::DCCTBTrailerBlock(DCCTBDataParser* parser,
const uint32_t* buffer,
uint32_t numbBytes,
uint32_t wToEnd,
uint32_t wordEventOffset,
uint32_t expectedLength,
uint32_t expectedCRC)
: DCCTBBlockPrototype(parser, "DCCTRAILER", buffer, numbBytes, wToEnd, wordEventOffset),
expectedLength_(expectedLength) {
errors_["TRAILER::EVENT LENGTH"] = 0;
errors_["TRAILER::EOE"] = 0;
errors_["TRAILER::CRC"] = 0;
errors_["TRAILER::T"] = 0;
// Get data fields from the mapper and retrieve data ///////////////////////////////////////////
mapperFields_ = parser_->mapper()->trailerFields();
parseData();
////////////////////////////////////////////////////////////////////////////////////////////////
// check internal data ////
dataCheck();
///////////////////////////
}
void DCCTBTrailerBlock::dataCheck() {
std::string checkErrors("");
std::pair<bool, std::string> res;
res = checkDataField("EVENT LENGTH", expectedLength_);
if (!res.first) {
checkErrors += res.second;
(errors_["TRAILER::EVENT LENGTH"])++;
}
res = checkDataField("EOE", EOE);
if (!res.first) {
checkErrors += res.second;
(errors_["TRAILER::EOE"])++;
}
res = checkDataField("T", 0);
if (!res.first) {
checkErrors += res.second;
(errors_["TRAILER::T"])++;
}
//checkErrors += checkDataField("CRC",expectedCRC_);
if (!checkErrors.empty()) {
errorString_ += "\n ======================================================================\n";
errorString_ += std::string(" ") + name_ + std::string(" data fields checks errors : ");
errorString_ += checkErrors;
errorString_ += "\n ======================================================================";
blockError_ = true;
}
}
|