Description: A class implimentating a look up table
Implementation: Internally stores data in vector filled with 32 bit ints address and output is masked to specifed number of bits vector only allocates as necessary, eg we may have a 32 bit address but we obviously dont want to allocate a 4gb vector
Error handling: currently waiting guidance on how to deal with this Exceptions are currently forbiden, emulator fails should not impact on the rest of the software chain. As such, everything silently fails gracefully
- Author
- : Sam Harper - RAL, Jim Brooke - Bristol
Definition at line 29 of file LUT.h.
int l1t::LUT::read |
( |
std::istream & |
stream | ) |
|
Definition at line 11 of file LUT.cc.
16 return readHeaderCode;
18 std::vector<std::pair<unsigned int, int> > entries;
24 std::istringstream lineStream(
line);
25 std::pair<unsigned int, int>
entry;
26 while (lineStream >>
entry.first >>
entry.second) {
29 entries.push_back(
entry);
31 maxAddress =
entry.first;
34 std::sort(entries.begin(), entries.end());
35 if (entries.empty()) {
40 if (std::adjacent_find(entries.begin(), entries.end(), [](
auto const&
a,
auto const&
b) {
41 return a.first ==
b.first;
42 }) != entries.end()) {
46 if (entries.front().first != 0 ||
47 std::adjacent_find(entries.begin(), entries.end(), [](
auto const&
a,
auto const&
b) {
48 return a.first + 1 !=
b.first;
49 }) != entries.end()) {
55 data_.resize(maxAddress + 1, 0);
61 std::transform(entries.begin(), entries.end(),
data_.begin(), [](
auto const&
x) {
return x.second; });
References a, addressMask_, b, data_, dataMask_, DUP_ENTRIES, mps_splice::entry, spr::find(), mps_splice::line, SiStripPI::max, MAX_ADDRESS_OUTOFRANGE, MISS_ENTRIES, NO_ENTRIES, readHeader_(), cms::cuda::stream, AlCaHLTBitMon_QueryRunRegistry::string, SUCCESS, and HcalDetIdTransform::transform().
Referenced by l1t::convertToLUT(), edmIntegrityCheck.PublishToFileSystem::get(), LUT(), l1t::MicroGMTLUT::MicroGMTLUT(), and XMLConfigReader::readLUTs().