36 for (
auto it=rows.begin(); it!=rows.end(); ++it)
62 if (
type_.find(
"bool") != std::string::npos )
64 std::ostringstream convString;
66 if (
type_.find(
"vector") != std::string::npos )
71 std::vector<std::string>
vals;
74 for(std::vector<std::string>::iterator it=vals.begin(); it!=vals.end(); ++it)
76 if ( it->find(
"true") != std::string::npos )
84 if ( value.find(
"true") != std::string::npos )
99 if (
type_.find(
"vector:uint") == std::string::npos )
100 throw std::runtime_error(
"Cannot build LUT from type: " +
type_ +
". Only vector:unsigned int is allowed.");
105 std::vector<unsigned int> vec = getVector<unsigned int>();
108 if (addrWidth == 0) {
109 size_t nEntries = vec.size();
110 while (nEntries >>= 1) {
116 std::stringstream ss;
117 ss <<
"#<header> V1 " << addrWidth <<
" " << dataWidth <<
" </header>" << std::endl;
119 for (; i < vec.size() && i < (size_t)(1<<addrWidth); ++
i) {
120 ss << i <<
" " << vec[
i] << std::endl;
123 if (padding >= 0 && i < (
size_t)(1<<addrWidth)) {
124 for (; i < (size_t)(1<<addrWidth); ++
i) {
125 ss << i <<
" " << padding << std::endl;
146 if (
type_.find(
"table") == std::string::npos)
147 throw std::runtime_error(
"You cannot add a table row in type: " +
type_ +
". Type is not table.");
149 std::vector<std::string>
vals;
182 row_ = std::shared_ptr< std::vector<std::string> >(
new std::vector<std::string>(row));
188 if( columns_.get() == 0 )
189 columns_ = std::shared_ptr< std::vector<std::string> >(
new std::vector<std::string>(columns));
193 if( colDict_.get() == 0 )
194 colDict_ = std::shared_ptr< std::map<std::string,int> >(
new std::map<std::string,int>());
198 for(
unsigned int i=0;
i<columns.size();
i++)
199 (*colDict_)[ columns[
i] ] =
i;
204 if( types_.get() == 0 )
205 types_ = std::shared_ptr< std::vector<std::string> >(
new std::vector<std::string>(types));
212 std::ostringstream
str;
213 for (
auto it=row_->begin(); it!=row_->end(); ++it)
void addTableRow(const std::string &row, const std::vector< std::string > &types, const std::vector< std::string > &columns)
void setValue(const std::string &value)
void setRowTypes(const std::vector< std::string > &types)
Setting & operator=(const Setting &aSet)
int read(std::istream &stream)
std::vector< std::string > str2VecStr_(const std::string &aStr, const std::string &delim)
l1t::LUT getLUT(size_t addrWidth=0, size_t dataWidth=31, int padding=-1, std::string delim=",")
std::string getRowAsStr()
std::vector< TableRow > TableRows_
void setRowColumns(const std::vector< std::string > &columns)