CMS 3D CMS Logo

ConfigurationDBHandler Class Reference

List of all members.

Public Member Functions

virtual void characters (const XMLCh *const chars, const unsigned int length)
virtual void characters (const XMLCh *const chars, const unsigned int length)
 ConfigurationDBHandler (std::map< std::string, std::string > &parameters, std::vector< std::string > &items, std::string &encoding)
 ConfigurationDBHandler (std::list< ConfigurationDatabaseStandardXMLParser::Item > &items)
virtual void endElement (const XMLCh *const uri, const XMLCh *const localname, const XMLCh *const qname)
virtual void endElement (const XMLCh *const uri, const XMLCh *const localname, const XMLCh *const qname)
virtual void ignorableWhitespace (const XMLCh *chars, const unsigned int length)
virtual void ignorableWhitespace (const XMLCh *chars, const unsigned int length)
virtual void startElement (const XMLCh *const uri, const XMLCh *const localname, const XMLCh *const qname, const Attributes &attrs)
virtual void startElement (const XMLCh *const uri, const XMLCh *const localname, const XMLCh *const qname, const Attributes &attrs)
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::vector< std::string > & m_items
std::list
< ConfigurationDatabaseStandardXMLParser::Item > & 
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_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]

Enumerator:
md_Idle 
md_Parameter 
md_Data 

Definition at line 39 of file ConfigurationDatabaseStandardXMLParser.cc.

anonymous enum [private]

Enumerator:
md_Idle 
md_Parameter 
md_Data 

Definition at line 45 of file HcalPatternXMLParser.cc.


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

00041                                                                                        : m_items(items) {
00042       m_mode=md_Idle;
00043       xc_Parameter=XMLString::transcode("Parameter");
00044       xc_Data=XMLString::transcode("Data");
00045       xc_name=XMLString::transcode("name");
00046       xc_type=XMLString::transcode("type");
00047       xc_elements=XMLString::transcode("elements");      
00048       xc_encoding=XMLString::transcode("encoding");
00049       xc_header[0]=XMLString::transcode("CFGBrick");
00050       xc_header[1]=XMLString::transcode("LUT");
00051       xc_header[2]=XMLString::transcode("Pattern");
00052       m_items.clear();
00053     }

virtual ConfigurationDBHandler::~ConfigurationDBHandler (  )  [inline, virtual]

Definition at line 54 of file ConfigurationDatabaseStandardXMLParser.cc.

References i, ITEMELEMENTNAMES, 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 47 of file HcalPatternXMLParser.cc.

References transcode().

00047                                                                                                                       : m_dataEncoding(encoding), m_items(items), m_parameters(parameters) {
00048       m_mode=md_Idle;
00049       xc_Parameter=XMLString::transcode("Parameter");
00050       xc_Data=XMLString::transcode("Data");
00051       xc_name=XMLString::transcode("name");
00052       xc_type=XMLString::transcode("type");
00053       xc_elements=XMLString::transcode("elements");      
00054       xc_encoding=XMLString::transcode("encoding");
00055       m_items.clear();
00056       m_parameters.clear();
00057     }

virtual ConfigurationDBHandler::~ConfigurationDBHandler (  )  [inline, virtual]

Definition at line 58 of file HcalPatternXMLParser.cc.

References release().


Member Function Documentation

virtual void ConfigurationDBHandler::characters ( const XMLCh *const   chars,
const unsigned int  length 
) [virtual]

void ConfigurationDBHandler::characters ( const XMLCh *const   chars,
const unsigned int  length 
) [virtual]

Definition at line 162 of file ConfigurationDatabaseStandardXMLParser.cc.

References i, m_mode, m_text, m_workc, m_workx, md_Idle, offset, and transcode().

00162                                                                                        {
00163     if (m_mode==md_Idle) return;
00164     unsigned int offset=0;
00165     while (offset<length) {
00166       unsigned int i=0;
00167       for (i=0; i<length-offset && i<255; i++) m_workx[i]=chars[i+offset];
00168       m_workx[i]=0; // terminate string
00169       XMLString::transcode(m_workx,m_workc,511);
00170       m_text+=m_workc;
00171       offset+=i;
00172     }
00173   }

bool ConfigurationDBHandler::cvt2String ( const XMLCh *  val,
std::string &  ou 
) [inline, private]

Definition at line 71 of file HcalPatternXMLParser.cc.

References release(), and transcode().

00071                                                             {
00072       if (val==0) return false;
00073       char* tool=XMLString::transcode(val);
00074       ou=tool;
00075       XMLString::release(&tool);
00076       return true;
00077     }

bool ConfigurationDBHandler::cvt2String ( const XMLCh *  val,
std::string &  ou 
) [inline, private]

Definition at line 69 of file ConfigurationDatabaseStandardXMLParser.cc.

References release(), and transcode().

Referenced by startElement().

00069                                                             {
00070       if (val==0) return false;
00071       char* tool=XMLString::transcode(val);
00072       ou=tool;
00073       XMLString::release(&tool);
00074       return true;
00075     }

virtual void ConfigurationDBHandler::endElement ( const XMLCh *const   uri,
const XMLCh *const   localname,
const XMLCh *const   qname 
) [virtual]

void ConfigurationDBHandler::endElement ( const XMLCh *const   uri,
const XMLCh *const   localname,
const XMLCh *const   qname 
) [virtual]

Definition at line 136 of file ConfigurationDatabaseStandardXMLParser.cc.

References isItemElement(), m_items, m_mode, m_pname, m_text, m_workitem, md_Data, md_Idle, and md_Parameter.

00136                                                                                                                          {
00137     if (m_mode==md_Idle) return;
00138 
00139     if (isItemElement(localname)) {
00140     } else if (m_mode==md_Parameter) {
00141       m_workitem.parameters[m_pname]=m_text; // ignore the type for now...
00142     } else if (m_mode==md_Data) {
00143       // parse the text
00144       std::string entry;
00145       for (std::string::iterator q=m_text.begin(); q!=m_text.end(); q++) {
00146         if (isspace(*q)) {
00147           if (entry.empty()) continue;
00148           m_workitem.items.push_back(entry);
00149           entry="";
00150         } else entry+=*q;
00151       }
00152       if (!entry.empty()) m_workitem.items.push_back(entry);
00153       m_items.push_back(m_workitem); // save it
00154     }
00155 
00156     m_mode=md_Idle;
00157   }

virtual void ConfigurationDBHandler::ignorableWhitespace ( const XMLCh *  chars,
const unsigned int  length 
) [virtual]

void ConfigurationDBHandler::ignorableWhitespace ( const XMLCh *  chars,
const unsigned int  length 
) [virtual]

Definition at line 158 of file ConfigurationDatabaseStandardXMLParser.cc.

References m_mode, m_text, and md_Idle.

00158                                                                                                   {
00159     if (m_mode==md_Idle) return;
00160     m_text+=' ';
00161   }

bool ConfigurationDBHandler::isItemElement ( const XMLCh *const   localname  )  [inline, private]

Definition at line 88 of file ConfigurationDatabaseStandardXMLParser.cc.

References i, ITEMELEMENTNAMES, and xc_header.

Referenced by endElement(), and startElement().

00088                                                      {
00089       for (int i=0; i<ITEMELEMENTNAMES; i++)
00090         if (!XMLString::compareIString(localname,xc_header[i])) return true;
00091       return false;
00092     }

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

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

Definition at line 95 of file ConfigurationDatabaseStandardXMLParser.cc.

References cvt2String(), isItemElement(), m_mode, m_pname, m_ptype, m_text, m_workitem, md_Data, md_Idle, md_Parameter, n_elements, xc_Data, xc_elements, xc_encoding, xc_name, xc_Parameter, and xc_type.

00095                                                                                                                                                     {
00096     if (m_mode!=md_Idle) return; 
00097     std::string work;
00098     cvt2String(localname,work);
00099     if (isItemElement(localname)) {
00100       m_workitem.parameters.clear();
00101       m_workitem.items.clear();
00102       m_workitem.encoding.clear();
00103     } else if (!XMLString::compareIString(localname,xc_Parameter)) {
00104       // parameter name
00105       if (!cvt2String(attrs.getValue(xc_name),m_pname)) return;
00106       // parameter type
00107       if (!cvt2String(attrs.getValue(xc_type),m_ptype)) return;
00108       // switch mode
00109       m_mode=md_Parameter;
00110       m_text="";
00111     } else if (!XMLString::compareIString(localname,xc_Data)) {
00112       m_workitem.items.clear();
00113       // elements
00114       std::string strElements;
00115       if (!cvt2String(attrs.getValue(xc_elements),strElements)) return;
00116       n_elements=atoi(strElements.c_str());
00117       // encoding
00118       m_workitem.encoding="";
00119       cvt2String(attrs.getValue(xc_encoding),m_workitem.encoding);
00120       // switch mode
00121       m_mode=md_Data;
00122       m_text="";
00123       // other attributes
00124       for (unsigned int jj=0; jj<attrs.getLength(); jj++) {
00125         if (!XMLString::compareIString(xc_elements,attrs.getValue(jj)) ||
00126             !XMLString::compareIString(xc_encoding,attrs.getValue(jj))) 
00127           continue; // already handled these two
00128         std::string atkey,atvalue;
00129         cvt2String(attrs.getLocalName(jj),atkey);
00130         cvt2String(attrs.getValue(jj),atvalue);
00131         m_workitem.parameters[atkey]=atvalue;
00132       }
00133     }
00134    
00135   }


Member Data Documentation

const int ConfigurationDBHandler::ITEMELEMENTNAMES = 3 [static, private]

Definition at line 77 of file ConfigurationDatabaseStandardXMLParser.cc.

Referenced by isItemElement(), and ~ConfigurationDBHandler().

std::string& ConfigurationDBHandler::m_dataEncoding [private]

Definition at line 81 of file HcalPatternXMLParser.cc.

std::vector<std::string>& ConfigurationDBHandler::m_items [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().

enum { ... } ConfigurationDBHandler::m_mode [private]

enum { ... } ConfigurationDBHandler::m_mode [private]

Referenced by characters(), ConfigurationDBHandler(), endElement(), ignorableWhitespace(), and startElement().

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

Definition at line 83 of file HcalPatternXMLParser.cc.

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]

Definition at line 79 of file ConfigurationDatabaseStandardXMLParser.cc.

Referenced by characters(), endElement(), ignorableWhitespace(), and startElement().

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]

Definition at line 76 of file ConfigurationDatabaseStandardXMLParser.cc.

Referenced by ConfigurationDBHandler(), startElement(), and ~ConfigurationDBHandler().

XMLCh * ConfigurationDBHandler::xc_elements [private]

Definition at line 76 of file ConfigurationDatabaseStandardXMLParser.cc.

Referenced by ConfigurationDBHandler(), startElement(), and ~ConfigurationDBHandler().

XMLCh * ConfigurationDBHandler::xc_encoding [private]

Definition at line 76 of file ConfigurationDatabaseStandardXMLParser.cc.

Referenced by ConfigurationDBHandler(), startElement(), and ~ConfigurationDBHandler().

XMLCh* ConfigurationDBHandler::xc_header[ITEMELEMENTNAMES] [private]

Definition at line 78 of file ConfigurationDatabaseStandardXMLParser.cc.

Referenced by ConfigurationDBHandler(), isItemElement(), and ~ConfigurationDBHandler().

XMLCh * ConfigurationDBHandler::xc_name [private]

Definition at line 76 of file ConfigurationDatabaseStandardXMLParser.cc.

Referenced by ConfigurationDBHandler(), startElement(), and ~ConfigurationDBHandler().

XMLCh* ConfigurationDBHandler::xc_Parameter [private]

Definition at line 78 of file HcalPatternXMLParser.cc.

XMLCh* ConfigurationDBHandler::xc_Parameter [private]

Definition at line 76 of file ConfigurationDatabaseStandardXMLParser.cc.

Referenced by ConfigurationDBHandler(), startElement(), and ~ConfigurationDBHandler().

XMLCh * ConfigurationDBHandler::xc_type [private]

Definition at line 76 of file ConfigurationDatabaseStandardXMLParser.cc.

Referenced by ConfigurationDBHandler(), startElement(), and ~ConfigurationDBHandler().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:16:46 2009 for CMSSW by  doxygen 1.5.4