File indexing completed on 2024-04-06 12:10:36
0001
0002
0003
0004 #ifndef DCCTBBLOCKPROTOTYPE_HH
0005 #define DCCTBBLOCKPROTOTYPE_HH
0006
0007 #include <iostream>
0008 #include <string>
0009 #include <vector>
0010 #include <map>
0011 #include <utility>
0012 #include <set>
0013 #include <iostream>
0014 #include <iomanip>
0015 #include <cstdint>
0016
0017 class DCCTBDataParser;
0018 class DCCTBDataField;
0019 class DCCTBDataFieldComparator;
0020
0021 class DCCTBBlockPrototype {
0022 public:
0023 DCCTBBlockPrototype(DCCTBDataParser *parser,
0024 std::string name,
0025 const uint32_t *buffer,
0026 uint32_t numbBytes,
0027 uint32_t wordsToEndOfEvent,
0028 uint32_t wordEventOffset = 0);
0029
0030 virtual ~DCCTBBlockPrototype() {}
0031
0032 virtual void parseData();
0033 virtual void increment(uint32_t numb, std::string msg = "");
0034 virtual void seeIfIsPossibleToIncrement(uint32_t numb, std::string msg = "");
0035 virtual uint32_t getDataWord(uint32_t wordPosition, uint32_t bitPosition, uint32_t mask);
0036 virtual uint32_t getDataField(std::string name);
0037 virtual void setDataField(std::string name, uint32_t data);
0038
0039 virtual std::pair<bool, std::string> checkDataField(std::string name, uint32_t data);
0040 virtual void displayData(std::ostream &os = std::cout);
0041 virtual std::pair<bool, std::string> compare(DCCTBBlockPrototype *block);
0042
0043 std::map<std::string, uint32_t> &errorCounters() { return errors_; }
0044
0045
0046 std::string name() { return name_; }
0047
0048
0049 uint32_t size() { return blockSize_; }
0050
0051 std::string &errorString() { return errorString_; }
0052
0053
0054 uint32_t wOffset() { return wordEventOffset_; }
0055
0056 bool blockError() { return blockError_; }
0057
0058
0059
0060
0061 DCCTBDataParser *getParser() { return parser_; }
0062
0063 protected:
0064 std::string formatString(std::string myString, uint32_t minPositions);
0065
0066 const uint32_t *dataP_;
0067 const uint32_t *beginOfBuffer_;
0068
0069 uint32_t blockSize_;
0070 uint32_t wordCounter_;
0071 uint32_t wordEventOffset_;
0072 uint32_t wordsToEndOfEvent_;
0073
0074 bool blockError_;
0075
0076 std::string name_;
0077 std::string errorString_;
0078 std::string blockString_;
0079 std::string processingString_;
0080
0081 DCCTBDataParser *parser_;
0082
0083 std::map<std::string, uint32_t> dataFields_;
0084 std::map<std::string, uint32_t> errors_;
0085
0086 std::set<DCCTBDataField *, DCCTBDataFieldComparator> *mapperFields_;
0087 };
0088
0089 #endif