6 : nrBitsAddress_(0), nrBitsData_(0), addressMask_(0), dataMask_(0), data_(), m_codeInWidth(12), m_outWidth(32) {
22 std::ifstream fstream;
24 if (!fstream.good()) {
26 throw cms::Exception(
"FileOpenError") <<
"Failed to open LUT file: " << inFileName;
28 int readCode =
read(fstream);
47 throw cms::Exception(
"Uninitialized") <<
"If you're not loading a LUT from file you need to implement lookupPacked.";
65 unsigned maxIn = (1 <<
maxWidth) - 1;
66 return (
in < maxIn ?
in : maxIn);
74 return readHeaderCode;
76 std::vector<std::pair<unsigned int, float> > entries;
82 std::istringstream lineStream(
line);
83 std::pair<unsigned int, float>
entry;
84 while (lineStream >>
entry.first >>
entry.second) {
87 entries.push_back(
entry);
89 maxAddress =
entry.first;
92 std::sort(entries.begin(), entries.end());
93 if (entries.empty()) {
98 if (std::adjacent_find(entries.begin(), entries.end(), [](
auto const&
a,
auto const&
b) {
99 return a.first ==
b.first;
100 }) != entries.end()) {
104 if (entries.front().first != 0 ||
105 std::adjacent_find(entries.begin(), entries.end(), [](
auto const&
a,
auto const&
b) {
106 return a.first + 1 !=
b.first;
107 }) != entries.end()) {
113 data_.resize(maxAddress + 1, 0);
119 std::transform(entries.begin(), entries.end(),
data_.begin(), [](
auto const&
x) {
return x.second; });
125 for (
unsigned int address = 0; address <
data_.size(); address++) {
135 int startPos =
stream.tellg();
138 if (
line.find(
"#<header>") == 0) {
139 std::istringstream lineStream(
line);