4 #include <boost/cstdint.hpp>
19 template <
int NAddressBits,
int NDataBits>
29 friend std::ostream& operator << (std::ostream& os, const L1GctLut<NAddressBits, NDataBits>&
lut)
38 os <<
lut.printHeader();
40 for (
int a=0;
a<=maxAddress;
a +=
width) {
41 os <<
lut.printLine(
a);
49 uint16_t
lutValue (
const uint16_t lutAddress)
const;
55 template <
int KAddressBits,
int KDataBits>
59 template <
int KAddressBits,
int KDataBits>
72 virtual uint16_t
value (
const uint16_t lutAddress)
const=0;
74 template <
int KAddressBits,
int KDataBits>
89 template <
int NAddressBits,
int NDataBits>
91 template <
int NAddressBits,
int NDataBits>
94 template <
int NAddressBits,
int NDataBits>
97 template <
int NAddressBits,
int NDataBits>
100 template <
int NAddressBits,
int NDataBits>
103 template <
int NAddressBits,
int NDataBits>
106 if (!m_setupOk)
return (uint16_t) 0;
107 uint16_t address=(lutAddress & MAX_ADDRESS_BITMASK);
108 uint16_t
data=(
value(address) & MAX_DATA_BITMASK);
112 template <
int NAddressBits,
int NDataBits>
113 template <
int KAddressBits,
int KDataBits>
116 if (KAddressBits==NAddressBits && KDataBits==NDataBits) {
118 for (uint16_t address=0; address<=MAX_ADDRESS_BITMASK; address++) {
119 if (this->lutValue(address)!=rhsLut.
lutValue(address)) { match =
false;
break; }
127 template <
int NAddressBits,
int NDataBits>
130 std::stringstream
ss;
131 ss << std::hex << std::showbase;
132 ss << std::setw(8) <<
"|";
133 for (
int a=0; ((
a<printWidth) && (
a<=MAX_ADDRESS_BITMASK)); ++
a) {
134 ss << std::setw(7) <<
a;
137 ss << std::setfill(
'-') << std::setw(8) <<
"+";
138 for (
int a=0; ((
a<printWidth) && (
a<=MAX_ADDRESS_BITMASK)); ++
a) {
139 ss << std::setw(7) <<
"-";
146 template <
int NAddressBits,
int NDataBits>
149 std::stringstream
ss;
150 ss << std::hex << std::showbase;
152 ss << std::setw(7) << a <<
"|";
153 for (
int c=0; ((
c<printWidth) && (a<=MAX_ADDRESS_BITMASK)); ++
c) {
154 uint16_t address =
static_cast<uint16_t
>(a++);
155 ss << std::setw(7) << lutValue(address);
void setVerbose()
control output messages
std::string printLine(const int add) const
void add(const std::vector< const T * > &source, std::vector< const T * > &dest)
virtual uint16_t value(const uint16_t lutAddress) const =0
uint16_t operator[](const uint16_t lutAddress) const
Access the look-up table contents for a given Address.
static const uint16_t MAX_ADDRESS_BITMASK
static const int printWidth
Base class for LookUp Tables.
int operator==(const L1GctLut< KAddressBits, KDataBits > &rhsLut) const
Equality check between look-up tables.
bool equalityCheck(const L1GctLut< KAddressBits, KDataBits > &c) const
static const uint16_t MAX_DATA_BITMASK
char data[epos_bytes_allocation]
uint16_t lutValue(const uint16_t lutAddress) const
Access the look-up table contents for a given Address.
int operator!=(const L1GctLut< KAddressBits, KDataBits > &rhsLut) const
Inequality check between look-up tables.
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
std::string printHeader() const
volatile std::atomic< bool > shutdown_flag false