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 Types | Private Member Functions | Private Attributes | Static Private Attributes
ConfigurationDBHandler Class Reference
Inheritance diagram for ConfigurationDBHandler:

Public Member Functions

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

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 38 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, XERCES_CPP_NAMESPACE_USE::transcode(), xc_Data, xc_elements, xc_encoding, xc_header, xc_name, xc_Parameter, and xc_type.

41  : m_items(items) {
47  xc_elements=XMLString::transcode("elements");
49  xc_header[0]=XMLString::transcode("CFGBrick");
51  xc_header[2]=XMLString::transcode("Pattern");
52  m_items.clear();
53  }
enum ConfigurationDBHandler::@66 m_mode
XMLCh * transcode(const T &fInput)
std::list< ConfigurationDatabaseStandardXMLParser::Item > & m_items
virtual ConfigurationDBHandler::~ConfigurationDBHandler ( )
inlinevirtual

Definition at line 54 of file ConfigurationDatabaseStandardXMLParser.cc.

References 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, XERCES_CPP_NAMESPACE_USE::transcode(), xc_Data, xc_elements, xc_encoding, xc_name, xc_Parameter, and xc_type.

48  : m_dataEncoding(encoding), m_items(items), m_parameters(parameters) {
54  xc_elements=XMLString::transcode("elements");
56  m_items.clear();
57  m_parameters.clear();
58  }
dictionary parameters
Definition: Parameters.py:2
enum ConfigurationDBHandler::@66 m_mode
XMLCh * transcode(const T &fInput)
std::map< std::string, std::string > & m_parameters
std::list< ConfigurationDatabaseStandardXMLParser::Item > & m_items
virtual ConfigurationDBHandler::~ConfigurationDBHandler ( )
inlinevirtual

Member Function Documentation

void ConfigurationDBHandler::characters ( const XMLCh *const  chars,
const unsigned int  length 
)
overridevirtual

Definition at line 162 of file ConfigurationDatabaseStandardXMLParser.cc.

References i, m_mode, m_text, m_workc, m_workx, md_Idle, hltrates_dqm_sourceclient-live_cfg::offset, and XERCES_CPP_NAMESPACE_USE::transcode().

162  {
163  if (m_mode==md_Idle) return;
164  unsigned int offset=0;
165  while (offset<length) {
166  unsigned int i=0;
167  for (i=0; i<length-offset && i<255; i++) m_workx[i]=chars[i+offset];
168  m_workx[i]=0; // terminate string
170  m_text+=m_workc;
171  offset+=i;
172  }
173  }
int i
Definition: DBlmapReader.cc:9
enum ConfigurationDBHandler::@66 m_mode
XMLCh * transcode(const T &fInput)
virtual void ConfigurationDBHandler::characters ( const XMLCh *const  chars,
const unsigned int  length 
)
overridevirtual
bool ConfigurationDBHandler::cvt2String ( const XMLCh *  val,
std::string &  ou 
)
inlineprivate

Definition at line 69 of file ConfigurationDatabaseStandardXMLParser.cc.

References fetchall_from_DQM_v2::release, and XERCES_CPP_NAMESPACE_USE::transcode().

Referenced by startElement().

69  {
70  if (val==0) return false;
71  char* tool=XMLString::transcode(val);
72  ou=tool;
73  XMLString::release(&tool);
74  return true;
75  }
XMLCh * transcode(const T &fInput)
bool ConfigurationDBHandler::cvt2String ( const XMLCh *  val,
std::string &  ou 
)
inlineprivate

Definition at line 72 of file HcalPatternXMLParser.cc.

References fetchall_from_DQM_v2::release, and XERCES_CPP_NAMESPACE_USE::transcode().

72  {
73  if (val==0) return false;
74  char* tool=XMLString::transcode(val);
75  ou=tool;
76  XMLString::release(&tool);
77  return true;
78  }
XMLCh * transcode(const T &fInput)
void ConfigurationDBHandler::endElement ( const XMLCh *const  uri,
const XMLCh *const  localname,
const XMLCh *const  qname 
)
overridevirtual

Definition at line 136 of file ConfigurationDatabaseStandardXMLParser.cc.

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

136  {
137  if (m_mode==md_Idle) return;
138 
139  if (isItemElement(localname)) {
140  } else if (m_mode==md_Parameter) {
141  m_workitem.parameters[m_pname]=m_text; // ignore the type for now...
142  } else if (m_mode==md_Data) {
143  // parse the text
144  std::string entry;
145  for (std::string::iterator q=m_text.begin(); q!=m_text.end(); q++) {
146  if (isspace(*q)) {
147  if (entry.empty()) continue;
148  m_workitem.items.push_back(entry);
149  entry="";
150  } else entry+=*q;
151  }
152  if (!entry.empty()) m_workitem.items.push_back(entry);
153  m_items.push_back(m_workitem); // save it
154  }
155 
156  m_mode=md_Idle;
157  }
ConfigurationDatabaseStandardXMLParser::Item m_workitem
enum ConfigurationDBHandler::@66 m_mode
std::list< ConfigurationDatabaseStandardXMLParser::Item > & m_items
bool isItemElement(const XMLCh *const localname)
virtual void ConfigurationDBHandler::endElement ( const XMLCh *const  uri,
const XMLCh *const  localname,
const XMLCh *const  qname 
)
overridevirtual
void ConfigurationDBHandler::ignorableWhitespace ( const XMLCh *  chars,
const unsigned int  length 
)
overridevirtual

Definition at line 158 of file ConfigurationDatabaseStandardXMLParser.cc.

References m_mode, m_text, and md_Idle.

158  {
159  if (m_mode==md_Idle) return;
160  m_text+=' ';
161  }
enum ConfigurationDBHandler::@66 m_mode
virtual void ConfigurationDBHandler::ignorableWhitespace ( const XMLCh *  chars,
const unsigned int  length 
)
overridevirtual
bool ConfigurationDBHandler::isItemElement ( const XMLCh *const  localname)
inlineprivate

Definition at line 88 of file ConfigurationDatabaseStandardXMLParser.cc.

References i, ITEMELEMENTNAMES, and xc_header.

Referenced by endElement(), and startElement().

88  {
89  for (int i=0; i<ITEMELEMENTNAMES; i++)
90  if (!XMLString::compareIString(localname,xc_header[i])) return true;
91  return false;
92  }
int i
Definition: DBlmapReader.cc:9
void ConfigurationDBHandler::startElement ( const XMLCh *const  uri,
const XMLCh *const  localname,
const XMLCh *const  qname,
const Attributes &  attrs 
)
overridevirtual

Definition at line 95 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.

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

Member Data Documentation

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

Definition at line 82 of file HcalPatternXMLParser.cc.

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

Definition at line 82 of file ConfigurationDatabaseStandardXMLParser.cc.

Referenced by ConfigurationDBHandler(), and endElement().

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

Definition at line 83 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 84 of file HcalPatternXMLParser.cc.

Referenced by ConfigurationDBHandler().

std::string ConfigurationDBHandler::m_pname
private

Definition at line 79 of file ConfigurationDatabaseStandardXMLParser.cc.

Referenced by endElement(), and startElement().

std::string ConfigurationDBHandler::m_ptype
private

Definition at line 79 of file ConfigurationDatabaseStandardXMLParser.cc.

Referenced by startElement().

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

Definition at line 86 of file ConfigurationDatabaseStandardXMLParser.cc.

Referenced by characters().

ConfigurationDatabaseStandardXMLParser::Item ConfigurationDBHandler::m_workitem
private

Definition at line 81 of file ConfigurationDatabaseStandardXMLParser.cc.

Referenced by endElement(), and startElement().

XMLCh ConfigurationDBHandler::m_workx
private

Definition at line 87 of file ConfigurationDatabaseStandardXMLParser.cc.

Referenced by characters().

int ConfigurationDBHandler::n_elements
private

Definition at line 80 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