CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes
ConfigurationDBHandler Class Reference
Inheritance diagram for ConfigurationDBHandler:

Public Member Functions

void characters (const XMLCh *const chars, const XMLSize_t length) override
 
void characters (const XMLCh *const chars, const XMLSize_t length) override
 
 ConfigurationDBHandler (std::list< ConfigurationDatabaseStandardXMLParser::Item > &items)
 
 ConfigurationDBHandler (std::map< std::string, std::string > &parameters, std::vector< std::string > &items, std::string &encoding)
 
void endElement (const XMLCh *const uri, const XMLCh *const localname, const XMLCh *const qname) override
 
void endElement (const XMLCh *const uri, const XMLCh *const localname, const XMLCh *const qname) override
 
void ignorableWhitespace (const XMLCh *const chars, const XMLSize_t length) override
 
void ignorableWhitespace (const XMLCh *const chars, const XMLSize_t length) override
 
void startElement (const XMLCh *const uri, const XMLCh *const localname, const XMLCh *const qname, const Attributes &attrs) override
 
void startElement (const XMLCh *const uri, const XMLCh *const localname, const XMLCh *const qname, const Attributes &attrs) override
 
 ~ConfigurationDBHandler () override
 
 ~ConfigurationDBHandler () override
 

Private Types

enum  { md_Idle, md_Parameter, md_Data }
 
enum  { md_Idle, md_Parameter, md_Data }
 

Private Member Functions

bool cvt2String (const XMLCh *val, std::string &ou)
 
bool cvt2String (const XMLCh *val, std::string &ou)
 
bool isItemElement (const XMLCh *const localname)
 

Private Attributes

std::string & m_dataEncoding
 
std::list
< ConfigurationDatabaseStandardXMLParser::Item > & 
m_items
 
std::vector< std::string > & m_items
 
enum ConfigurationDBHandler:: { ... }  m_mode
 
enum ConfigurationDBHandler:: { ... }  m_mode
 
std::map< std::string,
std::string > & 
m_parameters
 
std::string m_pname
 
std::string m_ptype
 
std::string m_text
 
char m_workc [512]
 
ConfigurationDatabaseStandardXMLParser::Item m_workitem
 
XMLCh m_workx [256]
 
int n_elements
 
XMLCh * xc_Data
 
XMLCh * xc_elements
 
XMLCh * xc_encoding
 
XMLCh * xc_header [ITEMELEMENTNAMES]
 
XMLCh * xc_name
 
XMLCh * xc_Parameter
 
XMLCh * xc_type
 

Static Private Attributes

static const int ITEMELEMENTNAMES = 3
 

Detailed Description

Definition at line 37 of file ConfigurationDatabaseStandardXMLParser.cc.

Member Enumeration Documentation

anonymous enum
private
anonymous enum
private

Constructor & Destructor Documentation

ConfigurationDBHandler::ConfigurationDBHandler ( std::list< ConfigurationDatabaseStandardXMLParser::Item > &  items)
inline

Definition at line 41 of file ConfigurationDatabaseStandardXMLParser.cc.

References m_items, m_mode, md_Idle, xc_Data, xc_elements, xc_encoding, xc_header, xc_name, xc_Parameter, and xc_type.

41  : m_items(items) {
42  m_mode = md_Idle;
43  xc_Parameter = XMLString::transcode("Parameter");
44  xc_Data = XMLString::transcode("Data");
45  xc_name = XMLString::transcode("name");
46  xc_type = XMLString::transcode("type");
47  xc_elements = XMLString::transcode("elements");
48  xc_encoding = XMLString::transcode("encoding");
49  xc_header[0] = XMLString::transcode("CFGBrick");
50  xc_header[1] = XMLString::transcode("LUT");
51  xc_header[2] = XMLString::transcode("Pattern");
52  m_items.clear();
53  }
enum ConfigurationDBHandler::@69 m_mode
std::list< ConfigurationDatabaseStandardXMLParser::Item > & m_items
ConfigurationDBHandler::~ConfigurationDBHandler ( )
inlineoverride

Definition at line 54 of file ConfigurationDatabaseStandardXMLParser.cc.

References mps_fire::i, ITEMELEMENTNAMES, fetchall_from_DQM_v2::release, xc_Data, xc_elements, xc_encoding, xc_header, xc_name, xc_Parameter, and xc_type.

ConfigurationDBHandler::ConfigurationDBHandler ( std::map< std::string, std::string > &  parameters,
std::vector< std::string > &  items,
std::string &  encoding 
)
inline

Definition at line 48 of file HcalPatternXMLParser.cc.

References m_items, m_mode, m_parameters, md_Idle, xc_Data, xc_elements, xc_encoding, xc_name, xc_Parameter, and xc_type.

52  m_mode = md_Idle;
53  xc_Parameter = XMLString::transcode("Parameter");
54  xc_Data = XMLString::transcode("Data");
55  xc_name = XMLString::transcode("name");
56  xc_type = XMLString::transcode("type");
57  xc_elements = XMLString::transcode("elements");
58  xc_encoding = XMLString::transcode("encoding");
59  m_items.clear();
60  m_parameters.clear();
61  }
enum ConfigurationDBHandler::@69 m_mode
std::list< ConfigurationDatabaseStandardXMLParser::Item > & m_items
std::map< std::string, std::string > & m_parameters
ConfigurationDBHandler::~ConfigurationDBHandler ( )
inlineoverride

Member Function Documentation

void ConfigurationDBHandler::characters ( const XMLCh *const  chars,
const XMLSize_t  length 
)
override

Definition at line 181 of file ConfigurationDatabaseStandardXMLParser.cc.

References mps_fire::i, m_mode, m_text, m_workc, m_workx, md_Idle, and hltrates_dqm_sourceclient-live_cfg::offset.

181  {
182  if (m_mode == md_Idle)
183  return;
184  unsigned int offset = 0;
185  while (offset < length) {
186  unsigned int i = 0;
187  for (i = 0; i < length - offset && i < 255; i++)
188  m_workx[i] = chars[i + offset];
189  m_workx[i] = 0; // terminate string
190  XMLString::transcode(m_workx, m_workc, 511);
191  m_text += m_workc;
192  offset += i;
193  }
194 }
enum ConfigurationDBHandler::@69 m_mode
void ConfigurationDBHandler::characters ( const XMLCh *const  chars,
const XMLSize_t  length 
)
override
bool ConfigurationDBHandler::cvt2String ( const XMLCh *  val,
std::string &  ou 
)
inlineprivate

Definition at line 73 of file ConfigurationDatabaseStandardXMLParser.cc.

References fetchall_from_DQM_v2::release.

Referenced by startElement().

73  {
74  if (val == nullptr)
75  return false;
76  char *tool = XMLString::transcode(val);
77  ou = tool;
78  XMLString::release(&tool);
79  return true;
80  }
bool ConfigurationDBHandler::cvt2String ( const XMLCh *  val,
std::string &  ou 
)
inlineprivate

Definition at line 79 of file HcalPatternXMLParser.cc.

References fetchall_from_DQM_v2::release.

79  {
80  if (val == nullptr)
81  return false;
82  char* tool = XMLString::transcode(val);
83  ou = tool;
84  XMLString::release(&tool);
85  return true;
86  }
void ConfigurationDBHandler::endElement ( const XMLCh *const  uri,
const XMLCh *const  localname,
const XMLCh *const  qname 
)
override

Definition at line 148 of file ConfigurationDatabaseStandardXMLParser.cc.

References mps_splice::entry, isItemElement(), m_items, m_mode, m_pname, m_text, m_workitem, md_Data, md_Idle, md_Parameter, submitPVResolutionJobs::q, and AlCaHLTBitMon_QueryRunRegistry::string.

150  {
151  if (m_mode == md_Idle)
152  return;
153 
154  if (isItemElement(localname)) {
155  } else if (m_mode == md_Parameter) {
156  m_workitem.parameters[m_pname] = m_text; // ignore the type for now...
157  } else if (m_mode == md_Data) {
158  // parse the text
160  for (std::string::iterator q = m_text.begin(); q != m_text.end(); q++) {
161  if (isspace(*q)) {
162  if (entry.empty())
163  continue;
164  m_workitem.items.push_back(entry);
165  entry = "";
166  } else
167  entry += *q;
168  }
169  if (!entry.empty())
170  m_workitem.items.push_back(entry);
171  m_items.push_back(m_workitem); // save it
172  }
173 
174  m_mode = md_Idle;
175 }
enum ConfigurationDBHandler::@69 m_mode
ConfigurationDatabaseStandardXMLParser::Item m_workitem
std::list< ConfigurationDatabaseStandardXMLParser::Item > & m_items
bool isItemElement(const XMLCh *const localname)
list entry
Definition: mps_splice.py:68
void ConfigurationDBHandler::endElement ( const XMLCh *const  uri,
const XMLCh *const  localname,
const XMLCh *const  qname 
)
override
void ConfigurationDBHandler::ignorableWhitespace ( const XMLCh *const  chars,
const XMLSize_t  length 
)
override

Definition at line 176 of file ConfigurationDatabaseStandardXMLParser.cc.

References m_mode, m_text, and md_Idle.

176  {
177  if (m_mode == md_Idle)
178  return;
179  m_text += ' ';
180 }
enum ConfigurationDBHandler::@69 m_mode
void ConfigurationDBHandler::ignorableWhitespace ( const XMLCh *const  chars,
const XMLSize_t  length 
)
override
bool ConfigurationDBHandler::isItemElement ( const XMLCh *const  localname)
inlineprivate

Definition at line 93 of file ConfigurationDatabaseStandardXMLParser.cc.

References mps_fire::i, ITEMELEMENTNAMES, and xc_header.

Referenced by endElement(), and startElement().

93  {
94  for (int i = 0; i < ITEMELEMENTNAMES; i++)
95  if (!XMLString::compareIString(localname, xc_header[i]))
96  return true;
97  return false;
98  }
void ConfigurationDBHandler::startElement ( const XMLCh *const  uri,
const XMLCh *const  localname,
const XMLCh *const  qname,
const Attributes &  attrs 
)
override

Definition at line 101 of file ConfigurationDatabaseStandardXMLParser.cc.

References cvt2String(), isItemElement(), findQualityFiles::jj, m_mode, m_pname, m_ptype, m_text, m_workitem, md_Data, md_Idle, md_Parameter, n_elements, AlCaHLTBitMon_QueryRunRegistry::string, edmIntegrityCheck::work(), xc_Data, xc_elements, xc_encoding, xc_name, xc_Parameter, and xc_type.

104  {
105  if (m_mode != md_Idle)
106  return;
108  cvt2String(localname, work);
109  if (isItemElement(localname)) {
110  m_workitem.parameters.clear();
111  m_workitem.items.clear();
112  m_workitem.encoding.clear();
113  } else if (!XMLString::compareIString(localname, xc_Parameter)) {
114  // parameter name
115  if (!cvt2String(attrs.getValue(xc_name), m_pname))
116  return;
117  // parameter type
118  if (!cvt2String(attrs.getValue(xc_type), m_ptype))
119  return;
120  // switch mode
122  m_text = "";
123  } else if (!XMLString::compareIString(localname, xc_Data)) {
124  m_workitem.items.clear();
125  // elements
126  std::string strElements;
127  if (!cvt2String(attrs.getValue(xc_elements), strElements))
128  return;
129  n_elements = atoi(strElements.c_str());
130  // encoding
131  m_workitem.encoding = "";
132  cvt2String(attrs.getValue(xc_encoding), m_workitem.encoding);
133  // switch mode
134  m_mode = md_Data;
135  m_text = "";
136  // other attributes
137  for (unsigned int jj = 0; jj < attrs.getLength(); jj++) {
138  if (!XMLString::compareIString(xc_elements, attrs.getValue(jj)) ||
139  !XMLString::compareIString(xc_encoding, attrs.getValue(jj)))
140  continue; // already handled these two
141  std::string atkey, atvalue;
142  cvt2String(attrs.getLocalName(jj), atkey);
143  cvt2String(attrs.getValue(jj), atvalue);
144  m_workitem.parameters[atkey] = atvalue;
145  }
146  }
147 }
enum ConfigurationDBHandler::@69 m_mode
bool cvt2String(const XMLCh *val, std::string &ou)
ConfigurationDatabaseStandardXMLParser::Item m_workitem
bool isItemElement(const XMLCh *const localname)
void ConfigurationDBHandler::startElement ( const XMLCh *const  uri,
const XMLCh *const  localname,
const XMLCh *const  qname,
const Attributes &  attrs 
)
override

Member Data Documentation

const int ConfigurationDBHandler::ITEMELEMENTNAMES = 3
staticprivate
std::string& ConfigurationDBHandler::m_dataEncoding
private

Definition at line 90 of file HcalPatternXMLParser.cc.

std::list<ConfigurationDatabaseStandardXMLParser::Item>& ConfigurationDBHandler::m_items
private

Definition at line 87 of file ConfigurationDatabaseStandardXMLParser.cc.

Referenced by ConfigurationDBHandler(), and endElement().

std::vector<std::string>& ConfigurationDBHandler::m_items
private

Definition at line 91 of file HcalPatternXMLParser.cc.

enum { ... } ConfigurationDBHandler::m_mode
enum { ... } ConfigurationDBHandler::m_mode
std::map<std::string, std::string>& ConfigurationDBHandler::m_parameters
private

Definition at line 92 of file HcalPatternXMLParser.cc.

Referenced by ConfigurationDBHandler().

std::string ConfigurationDBHandler::m_pname
private

Definition at line 84 of file ConfigurationDatabaseStandardXMLParser.cc.

Referenced by endElement(), and startElement().

std::string ConfigurationDBHandler::m_ptype
private

Definition at line 84 of file ConfigurationDatabaseStandardXMLParser.cc.

Referenced by startElement().

std::string ConfigurationDBHandler::m_text
private
char ConfigurationDBHandler::m_workc
private

Definition at line 91 of file ConfigurationDatabaseStandardXMLParser.cc.

Referenced by characters().

ConfigurationDatabaseStandardXMLParser::Item ConfigurationDBHandler::m_workitem
private

Definition at line 86 of file ConfigurationDatabaseStandardXMLParser.cc.

Referenced by endElement(), and startElement().

XMLCh ConfigurationDBHandler::m_workx
private

Definition at line 92 of file ConfigurationDatabaseStandardXMLParser.cc.

Referenced by characters().

int ConfigurationDBHandler::n_elements
private

Definition at line 85 of file ConfigurationDatabaseStandardXMLParser.cc.

Referenced by startElement().

XMLCh * ConfigurationDBHandler::xc_Data
private
XMLCh * ConfigurationDBHandler::xc_elements
private
XMLCh * ConfigurationDBHandler::xc_encoding
private
XMLCh* ConfigurationDBHandler::xc_header[ITEMELEMENTNAMES]
private
XMLCh * ConfigurationDBHandler::xc_name
private
XMLCh * ConfigurationDBHandler::xc_Parameter
private
XMLCh * ConfigurationDBHandler::xc_type
private