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 180 of file Setting.cc.

References logText_, lt, and row_.

181 {
182  row_ = std::shared_ptr< std::vector<std::string> >(new std::vector<std::string>(row));
183  logText_ = lt;
184 }
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 210 of file Setting.cc.

References row_.

Referenced by getRowValue().

211 {
212  std::ostringstream str;
213  for (auto it=row_->begin(); it!=row_->end(); ++it)
214  str << *it << " ";
215 
216  return str.str();
217 }
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:210
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 186 of file Setting.cc.

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

187 {
188  if( columns_.get() == 0 )
189  columns_ = std::shared_ptr< std::vector<std::string> >(new std::vector<std::string>(columns));
190  else
191  *columns_ = columns;
192 
193  if( colDict_.get() == 0 )
194  colDict_ = std::shared_ptr< std::map<std::string,int> >(new std::map<std::string,int>());
195 
196  colDict_->clear();
197 
198  for(unsigned int i=0; i<columns.size(); i++)
199  (*colDict_)[ columns[i] ] = i;
200 }
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 202 of file Setting.cc.

References types_.

203 {
204  if( types_.get() == 0 )
205  types_ = std::shared_ptr< std::vector<std::string> >(new std::vector<std::string>(types));
206  else
207  *types_ = types;
208 }
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().