CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
L1GtPatternLine.cc
Go to the documentation of this file.
1 
15 // this class header
17 
18 // system include files
19 #include <sstream>
20 #include <iostream>
21 
22 // user include files
24 
26  std::string colName = nextName(prefix);
27  // add three values for each column - the full 32bit value,
28  // one for the lower 16 bits and one for the higher 16 bits.
29  m_columns[colName] = value;
30  m_columns[colName + "_h"] = value >> 16;
31  m_columns[colName + "_l"] = value & 0xFFFF;
32 }
33 
34 void L1GtPatternLine::set(const std::string& name, uint32_t value) {
35  ColumnMap::iterator it = m_columns.find(name);
36  if (it == m_columns.end()) {
37  throw cms::Exception(__func__) << "Can't set field " << name << " to " << std::hex << value << ": not found";
38  }
39 
40  it->second = value;
41  m_columns[name + "_h"] = value >> 16;
42  m_columns[name + "_l"] = value & 0xFFFF;
43 }
44 
45 void L1GtPatternLine::print(std::ostream& out) const {
46  out << "BEGIN Columns: " << std::endl;
47  for (L1GtPatternLine::ColumnMap::const_iterator it = m_columns.begin(); it != m_columns.end(); ++it) {
48  out << it->first << ": " << std::hex << it->second << std::endl;
49  }
50  out << "END Columns." << std::endl;
51 }
52 
53 bool L1GtPatternLine::has(const std::string& colname) const { return m_columns.find(colname) != m_columns.end(); }
54 
56  int i = 1;
58  do {
59  result = name(prefix, i++);
60  } while (has(result));
61 
62  return result;
63 }
64 
65 std::string L1GtPatternLine::name(const std::string& prefix, unsigned int i) const {
66  std::ostringstream ss;
67  ss << prefix << i;
68  return ss.str();
69 }
70 
71 uint32_t L1GtPatternLine::get(const std::string& name) const {
72  ColumnMap::const_iterator it = m_columns.find(name);
73  if (it != m_columns.end()) {
74  return it->second;
75  }
76  return 0;
77 }
void set(const std::string &name, uint32_t value)
uint32_t get(const std::string &name) const
void print(std::ostream &out) const
tuple result
Definition: mps_fire.py:311
std::string nextName(const std::string &prefix)
bool has(const std::string &colname) const
std::string name(const std::string &prefix, unsigned int i) const
void push(const std::string &prefix, uint32_t value)
ColumnMap m_columns