test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
l1t::TableRow Class Reference

#include <Setting.h>

Public Member Functions

std::vector< std::string > getColumnNames ()
 
std::vector< std::string > getRow ()
 
std::string getRowAsStr ()
 
template<class varType >
varType getRowValue (const std::string &col)
 
void setLogStringVar (std::string *strVar)
 
void setRowColumns (const std::vector< std::string > &columns)
 
void setRowTypes (const std::vector< std::string > &types)
 
void setTableId (const std::string &id)
 
 TableRow ()
 
 TableRow (const std::vector< std::string > &row, std::string *lt)
 
 ~TableRow ()
 

Private Attributes

std::shared_ptr< std::map
< std::string, int > > 
colDict_
 
std::shared_ptr< std::vector
< std::string > > 
columns_
 
std::string * logText_
 
std::shared_ptr< std::vector
< std::string > > 
row_
 
std::string tableId_
 
std::shared_ptr< std::vector
< std::string > > 
types_
 

Detailed Description

Definition at line 22 of file Setting.h.

Constructor & Destructor Documentation

l1t::TableRow::TableRow ( )
inline

Definition at line 25 of file Setting.h.

25 {};
l1t::TableRow::TableRow ( const std::vector< std::string > &  row,
std::string *  lt 
)

Definition at line 178 of file Setting.cc.

References logText_, lt, and row_.

179 {
180  row_ = std::shared_ptr< std::vector<std::string> >(new std::vector<std::string>(row));
181  logText_ = lt;
182 }
std::shared_ptr< std::vector< std::string > > row_
Definition: Setting.h:40
std::string * logText_
Definition: Setting.h:38
< trclass="colgroup">< tdclass="colgroup"colspan=5 > DT local reconstruction</td ></tr >< tr >< td >< ahref="classDTRecHit1DPair.html"> DTRecHit1DPair</a ></td >< td >< ahref="DataFormats_DTRecHit.html"> edm::RangeMap & lt
l1t::TableRow::~TableRow ( )
inline

Definition at line 31 of file Setting.h.

31 {};

Member Function Documentation

std::vector<std::string> l1t::TableRow::getColumnNames ( )
inline

Definition at line 34 of file Setting.h.

References columns_.

34 {return *columns_;};
std::shared_ptr< std::vector< std::string > > columns_
Definition: Setting.h:42
std::vector<std::string> l1t::TableRow::getRow ( )
inline

Definition at line 32 of file Setting.h.

References row_.

32 { return *row_; };
std::shared_ptr< std::vector< std::string > > row_
Definition: Setting.h:40
std::string l1t::TableRow::getRowAsStr ( )

Definition at line 208 of file Setting.cc.

References row_.

Referenced by getRowValue().

209 {
210  std::ostringstream str;
211  for (auto it=row_->begin(); it!=row_->end(); ++it)
212  str << *it << " ";
213 
214  return str.str();
215 }
std::shared_ptr< std::vector< std::string > > row_
Definition: Setting.h:40
template<class varType >
varType l1t::TableRow::getRowValue ( const std::string &  col)

Definition at line 115 of file Setting.h.

References colDict_, getRowAsStr(), logText_, row_, and tableId_.

116 {
117  std::map<std::string,int>::const_iterator it = colDict_->find(col);
118  if( it == colDict_->end() )
119  throw std::runtime_error ("Column " + col + "not found in table " + tableId_);
120 
121  if ( logText_ )
122  {
123  std::ostringstream tempStr;
124  tempStr << "l1t::Setting::getRowValue\tReturning value " << convertVariable<varType>(row_->at(it->second)) << " from table " << tableId_ << " and row " << this->getRowAsStr() << std::endl;
125  logText_->append(tempStr.str());
126  }
127  return convertVariable<varType>(row_->at(it->second));
128 }
std::shared_ptr< std::map< std::string, int > > colDict_
Definition: Setting.h:43
std::shared_ptr< std::vector< std::string > > row_
Definition: Setting.h:40
std::string * logText_
Definition: Setting.h:38
std::string tableId_
Definition: Setting.h:37
std::string getRowAsStr()
Definition: Setting.cc:208
int col
Definition: cuy.py:1008
void l1t::TableRow::setLogStringVar ( std::string *  strVar)
inline

Definition at line 30 of file Setting.h.

References logText_.

30 {logText_ = strVar;};
std::string * logText_
Definition: Setting.h:38
void l1t::TableRow::setRowColumns ( const std::vector< std::string > &  columns)

Definition at line 184 of file Setting.cc.

References colDict_, mps_check::columns, columns_, and i.

185 {
186  if( columns_.get() == 0 )
187  columns_ = std::shared_ptr< std::vector<std::string> >(new std::vector<std::string>(columns));
188  else
189  *columns_ = columns;
190 
191  if( colDict_.get() == 0 )
192  colDict_ = std::shared_ptr< std::map<std::string,int> >(new std::map<std::string,int>());
193 
194  colDict_->clear();
195 
196  for(unsigned int i=0; i<columns.size(); i++)
197  (*colDict_)[ columns[i] ] = i;
198 }
std::shared_ptr< std::map< std::string, int > > colDict_
Definition: Setting.h:43
int i
Definition: DBlmapReader.cc:9
std::shared_ptr< std::vector< std::string > > columns_
Definition: Setting.h:42
tuple columns
Definition: mps_check.py:210
void l1t::TableRow::setRowTypes ( const std::vector< std::string > &  types)

Definition at line 200 of file Setting.cc.

References types_.

201 {
202  if( types_.get() == 0 )
203  types_ = std::shared_ptr< std::vector<std::string> >(new std::vector<std::string>(types));
204  else
205  *types_ = types;
206 }
std::shared_ptr< std::vector< std::string > > types_
Definition: Setting.h:41
void l1t::TableRow::setTableId ( const std::string &  id)
inline

Definition at line 27 of file Setting.h.

References tableId_.

27 { tableId_ = id; };
std::string tableId_
Definition: Setting.h:37

Member Data Documentation

std::shared_ptr< std::map<std::string,int> > l1t::TableRow::colDict_
private

Definition at line 43 of file Setting.h.

Referenced by getRowValue(), and setRowColumns().

std::shared_ptr< std::vector<std::string> > l1t::TableRow::columns_
private

Definition at line 42 of file Setting.h.

Referenced by getColumnNames(), and setRowColumns().

std::string* l1t::TableRow::logText_
private

Definition at line 38 of file Setting.h.

Referenced by getRowValue(), setLogStringVar(), and TableRow().

std::shared_ptr< std::vector<std::string> > l1t::TableRow::row_
private

Definition at line 40 of file Setting.h.

Referenced by getRow(), getRowAsStr(), getRowValue(), and TableRow().

std::string l1t::TableRow::tableId_
private

Definition at line 37 of file Setting.h.

Referenced by getRowValue(), and setTableId().

std::shared_ptr< std::vector<std::string> > l1t::TableRow::types_
private

Definition at line 41 of file Setting.h.

Referenced by setRowTypes().