CMS 3D CMS Logo

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

anonymous enum
private
Enumerator
md_Idle 
md_Parameter 
md_Data 

Definition at line 38 of file ConfigurationDatabaseStandardXMLParser.cc.

◆ anonymous enum

anonymous enum
private
Enumerator
md_Idle 
md_Parameter 
md_Data 

Definition at line 45 of file HcalPatternXMLParser.cc.

Constructor & Destructor Documentation

◆ ConfigurationDBHandler() [1/2]

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

Definition at line 41 of file ConfigurationDatabaseStandardXMLParser.cc.

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  }

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

◆ ~ConfigurationDBHandler() [1/2]

ConfigurationDBHandler::~ConfigurationDBHandler ( )
inlineoverride

◆ ConfigurationDBHandler() [2/2]

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.

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  }

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

◆ ~ConfigurationDBHandler() [2/2]

ConfigurationDBHandler::~ConfigurationDBHandler ( )
inlineoverride

Member Function Documentation

◆ characters() [1/2]

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

Definition at line 181 of file ConfigurationDatabaseStandardXMLParser.cc.

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 }

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

◆ characters() [2/2]

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

◆ cvt2String() [1/2]

bool ConfigurationDBHandler::cvt2String ( const XMLCh *  val,
std::string &  ou 
)
inlineprivate

Definition at line 73 of file ConfigurationDatabaseStandardXMLParser.cc.

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  }

References fetchall_from_DQM_v2::release, and heppy_batch::val.

Referenced by startElement().

◆ cvt2String() [2/2]

bool ConfigurationDBHandler::cvt2String ( const XMLCh *  val,
std::string &  ou 
)
inlineprivate

Definition at line 79 of file HcalPatternXMLParser.cc.

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  }

References fetchall_from_DQM_v2::release, and heppy_batch::val.

◆ endElement() [1/2]

void ConfigurationDBHandler::endElement ( const XMLCh *const  uri,
const XMLCh *const  localname,
const XMLCh *const  qname 
)
override

Definition at line 148 of file ConfigurationDatabaseStandardXMLParser.cc.

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 }

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.

◆ endElement() [2/2]

void ConfigurationDBHandler::endElement ( const XMLCh *const  uri,
const XMLCh *const  localname,
const XMLCh *const  qname 
)
override

◆ ignorableWhitespace() [1/2]

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

Definition at line 176 of file ConfigurationDatabaseStandardXMLParser.cc.

176  {
177  if (m_mode == md_Idle)
178  return;
179  m_text += ' ';
180 }

References m_mode, m_text, and md_Idle.

◆ ignorableWhitespace() [2/2]

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

◆ isItemElement()

bool ConfigurationDBHandler::isItemElement ( const XMLCh *const  localname)
inlineprivate

Definition at line 93 of file ConfigurationDatabaseStandardXMLParser.cc.

93  {
94  for (int i = 0; i < ITEMELEMENTNAMES; i++)
95  if (!XMLString::compareIString(localname, xc_header[i]))
96  return true;
97  return false;
98  }

References mps_fire::i, ITEMELEMENTNAMES, and xc_header.

Referenced by endElement(), and startElement().

◆ startElement() [1/2]

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.

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 }

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.

◆ startElement() [2/2]

void ConfigurationDBHandler::startElement ( const XMLCh *const  uri,
const XMLCh *const  localname,
const XMLCh *const  qname,
const Attributes &  attrs 
)
override

Member Data Documentation

◆ ITEMELEMENTNAMES

const int ConfigurationDBHandler::ITEMELEMENTNAMES = 3
staticprivate

◆ m_dataEncoding

std::string& ConfigurationDBHandler::m_dataEncoding
private

Definition at line 90 of file HcalPatternXMLParser.cc.

◆ m_items [1/2]

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

Definition at line 87 of file ConfigurationDatabaseStandardXMLParser.cc.

Referenced by ConfigurationDBHandler(), and endElement().

◆ m_items [2/2]

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

Definition at line 91 of file HcalPatternXMLParser.cc.

◆ m_mode [1/2]

enum { ... } ConfigurationDBHandler::m_mode

◆ m_mode [2/2]

enum { ... } ConfigurationDBHandler::m_mode

◆ m_parameters

std::map<std::string, std::string>& ConfigurationDBHandler::m_parameters
private

Definition at line 92 of file HcalPatternXMLParser.cc.

Referenced by ConfigurationDBHandler().

◆ m_pname

std::string ConfigurationDBHandler::m_pname
private

Definition at line 84 of file ConfigurationDatabaseStandardXMLParser.cc.

Referenced by endElement(), and startElement().

◆ m_ptype

std::string ConfigurationDBHandler::m_ptype
private

Definition at line 84 of file ConfigurationDatabaseStandardXMLParser.cc.

Referenced by startElement().

◆ m_text

std::string ConfigurationDBHandler::m_text
private

◆ m_workc

char ConfigurationDBHandler::m_workc
private

Definition at line 91 of file ConfigurationDatabaseStandardXMLParser.cc.

Referenced by characters().

◆ m_workitem

ConfigurationDatabaseStandardXMLParser::Item ConfigurationDBHandler::m_workitem
private

Definition at line 86 of file ConfigurationDatabaseStandardXMLParser.cc.

Referenced by endElement(), and startElement().

◆ m_workx

XMLCh ConfigurationDBHandler::m_workx
private

Definition at line 92 of file ConfigurationDatabaseStandardXMLParser.cc.

Referenced by characters().

◆ n_elements

int ConfigurationDBHandler::n_elements
private

Definition at line 85 of file ConfigurationDatabaseStandardXMLParser.cc.

Referenced by startElement().

◆ xc_Data

XMLCh * ConfigurationDBHandler::xc_Data
private

◆ xc_elements

XMLCh * ConfigurationDBHandler::xc_elements
private

◆ xc_encoding

XMLCh * ConfigurationDBHandler::xc_encoding
private

◆ xc_header

XMLCh* ConfigurationDBHandler::xc_header[ITEMELEMENTNAMES]
private

◆ xc_name

XMLCh * ConfigurationDBHandler::xc_name
private

◆ xc_Parameter

XMLCh * ConfigurationDBHandler::xc_Parameter
private

◆ xc_type

XMLCh * ConfigurationDBHandler::xc_type
private
BeamSpotPI::parameters
parameters
Definition: BeamSpotPayloadInspectorHelper.h:30
ConfigurationDBHandler::xc_Parameter
XMLCh * xc_Parameter
Definition: ConfigurationDatabaseStandardXMLParser.cc:81
mps_fire.i
i
Definition: mps_fire.py:428
ConfigurationDBHandler::md_Data
Definition: ConfigurationDatabaseStandardXMLParser.cc:38
ConfigurationDBHandler::m_ptype
std::string m_ptype
Definition: ConfigurationDatabaseStandardXMLParser.cc:84
mps_splice.entry
entry
Definition: mps_splice.py:68
ConfigurationDBHandler::xc_Data
XMLCh * xc_Data
Definition: ConfigurationDatabaseStandardXMLParser.cc:81
ConfigurationDBHandler::xc_type
XMLCh * xc_type
Definition: ConfigurationDatabaseStandardXMLParser.cc:81
ConfigurationDBHandler::m_workitem
ConfigurationDatabaseStandardXMLParser::Item m_workitem
Definition: ConfigurationDatabaseStandardXMLParser.cc:86
ConfigurationDBHandler::ITEMELEMENTNAMES
static const int ITEMELEMENTNAMES
Definition: ConfigurationDatabaseStandardXMLParser.cc:82
mps_monitormerge.items
list items
Definition: mps_monitormerge.py:29
edmIntegrityCheck.work
work
Definition: edmIntegrityCheck.py:75
ConfigurationDBHandler::n_elements
int n_elements
Definition: ConfigurationDatabaseStandardXMLParser.cc:85
ConfigurationDBHandler::isItemElement
bool isItemElement(const XMLCh *const localname)
Definition: ConfigurationDatabaseStandardXMLParser.cc:93
ConfigurationDBHandler::cvt2String
bool cvt2String(const XMLCh *val, std::string &ou)
Definition: ConfigurationDatabaseStandardXMLParser.cc:73
ConfigurationDBHandler::m_pname
std::string m_pname
Definition: ConfigurationDatabaseStandardXMLParser.cc:84
ConfigurationDBHandler::md_Idle
Definition: ConfigurationDatabaseStandardXMLParser.cc:38
ConfigurationDBHandler::xc_elements
XMLCh * xc_elements
Definition: ConfigurationDatabaseStandardXMLParser.cc:81
ConfigurationDBHandler::m_items
std::list< ConfigurationDatabaseStandardXMLParser::Item > & m_items
Definition: ConfigurationDatabaseStandardXMLParser.cc:87
fetchall_from_DQM_v2.release
release
Definition: fetchall_from_DQM_v2.py:92
ConfigurationDBHandler::m_parameters
std::map< std::string, std::string > & m_parameters
Definition: HcalPatternXMLParser.cc:92
submitPVResolutionJobs.q
q
Definition: submitPVResolutionJobs.py:84
ConfigurationDBHandler::m_dataEncoding
std::string & m_dataEncoding
Definition: HcalPatternXMLParser.cc:90
ConfigurationDBHandler::md_Parameter
Definition: ConfigurationDatabaseStandardXMLParser.cc:38
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
ConfigurationDBHandler::m_workc
char m_workc[512]
Definition: ConfigurationDatabaseStandardXMLParser.cc:91
heppy_batch.val
val
Definition: heppy_batch.py:351
ConfigurationDBHandler::m_workx
XMLCh m_workx[256]
Definition: ConfigurationDatabaseStandardXMLParser.cc:92
ConfigurationDBHandler::xc_header
XMLCh * xc_header[ITEMELEMENTNAMES]
Definition: ConfigurationDatabaseStandardXMLParser.cc:83
ConfigurationDBHandler::xc_encoding
XMLCh * xc_encoding
Definition: ConfigurationDatabaseStandardXMLParser.cc:81
ConfigurationDBHandler::m_mode
enum ConfigurationDBHandler::@68 m_mode
ConfigurationDBHandler::m_text
std::string m_text
Definition: ConfigurationDatabaseStandardXMLParser.cc:84
findQualityFiles.jj
string jj
Definition: findQualityFiles.py:188
hltrates_dqm_sourceclient-live_cfg.offset
offset
Definition: hltrates_dqm_sourceclient-live_cfg.py:82
ConfigurationDBHandler::xc_name
XMLCh * xc_name
Definition: ConfigurationDatabaseStandardXMLParser.cc:81