#include <CaloOnlineTools/HcalOnlineDb/interface/LutXml.h>
Public Types | |
typedef struct LutXml::_Config | Config |
Public Member Functions | |
void | addLut (Config &_config) |
std::string & | getCurrentBrick (void) |
void | init (void) |
LutXml () | |
virtual | ~LutXml () |
Protected Member Functions | |
DOMElement * | addData (string _elements, string _encoding, std::vector< unsigned int > _lut) |
DOMElement * | addParameter (string _name, string _type, int _value) |
DOMElement * | addParameter (string _name, string _type, string _value) |
Protected Attributes | |
DOMElement * | brickElem |
Classes | |
struct | _Config |
Usage: <usage>
Definition at line 28 of file LutXml.h.
typedef struct LutXml::_Config LutXml::Config |
LutXml::LutXml | ( | ) |
Definition at line 50 of file LutXml.cc.
References init().
00050 : XMLDOMBlock( "CFGBrickSet", 1 ) 00051 { 00052 init(); 00053 }
DOMElement * LutXml::addData | ( | string | _elements, | |
string | _encoding, | |||
std::vector< unsigned int > | _lut | |||
) | [protected] |
Definition at line 92 of file LutXml.cc.
References XMLProcessor::_toXMLCh(), brickElem, XMLDOMBlock::document, and iter.
Referenced by addLut().
00093 { 00094 DOMElement * child = document -> createElement( XMLProcessor::_toXMLCh( "Data" ) ); 00095 child -> setAttribute( XMLProcessor::_toXMLCh("elements"), XMLProcessor::_toXMLCh( _elements ) ); 00096 child -> setAttribute( XMLProcessor::_toXMLCh("encoding"), XMLProcessor::_toXMLCh( _encoding ) ); 00097 00098 stringstream buf; 00099 00100 for (std::vector<unsigned int>::const_iterator iter = _lut.begin();iter!=_lut.end();iter++){ 00101 char buf2[8]; 00102 sprintf(buf2,"%x",(*iter)); 00103 buf << buf2 << " "; 00104 //buf << (*iter) << " "; 00105 } 00106 00107 string _value = buf . str(); 00108 00109 DOMText * data_value = document -> createTextNode( XMLProcessor::_toXMLCh(_value)); 00110 child -> appendChild( data_value ); 00111 00112 brickElem -> appendChild( child ); 00113 00114 return child; 00115 }
void LutXml::addLut | ( | LutXml::Config & | _config | ) |
Definition at line 68 of file LutXml.cc.
References XMLProcessor::_toXMLCh(), addData(), addParameter(), brickElem, LutXml::_Config::crate, LutXml::_Config::creationstamp, LutXml::_Config::creationtag, LutXml::_Config::depth, XMLDOMBlock::document, LutXml::_Config::fiber, LutXml::_Config::fiberchan, LutXml::_Config::formatrevision, LutXml::_Config::generalizedindex, LutXml::_Config::ieta, LutXml::_Config::iphi, LutXml::_Config::lut, LutXml::_Config::lut_type, LutXml::_Config::slot, LutXml::_Config::targetfirmware, and LutXml::_Config::topbottom.
00069 { 00070 DOMElement * rootElem = document -> getDocumentElement(); 00071 00072 brickElem = document->createElement( XMLProcessor::_toXMLCh("CFGBrick") ); 00073 rootElem->appendChild(brickElem); 00074 00075 addParameter( "IETA", "int", _config.ieta ); 00076 addParameter( "IPHI", "int", _config.iphi ); 00077 addParameter( "DEPTH", "int", _config.depth ); 00078 addParameter( "CRATE", "int", _config.crate ); 00079 addParameter( "SLOT", "int", _config.slot ); 00080 addParameter( "TOPBOTTOM", "int", _config.topbottom ); 00081 addParameter( "FIBER", "int", _config.fiber ); 00082 addParameter( "FIBERCHAN", "int", _config.fiberchan ); 00083 addParameter( "LUT_TYPE", "int", _config.lut_type ); 00084 addParameter( "CREATIONTAG", "string", _config.creationtag ); 00085 addParameter( "CREATIONSTAMP", "string", _config.creationstamp ); 00086 addParameter( "FORMATREVISION", "string", _config.formatrevision ); 00087 addParameter( "TARGETFIRMWARE", "string", _config.targetfirmware ); 00088 addParameter( "GENERALIZEDINDEX", "int", _config.generalizedindex ); 00089 addData( "128", "hex", _config.lut ); 00090 }
DOMElement * LutXml::addParameter | ( | string | _name, | |
string | _type, | |||
int | _value | |||
) | [protected] |
Definition at line 134 of file LutXml.cc.
References addParameter().
00135 { 00136 char buf[128]; 00137 sprintf(buf, "%d", _value); 00138 string str_value = buf; 00139 return addParameter( _name, _type, str_value ); 00140 }
DOMElement * LutXml::addParameter | ( | string | _name, | |
string | _type, | |||
string | _value | |||
) | [protected] |
Definition at line 119 of file LutXml.cc.
References XMLProcessor::_toXMLCh(), brickElem, and XMLDOMBlock::document.
Referenced by addLut(), and addParameter().
00120 { 00121 DOMElement * child = document -> createElement( XMLProcessor::_toXMLCh( "Parameter" ) ); 00122 child -> setAttribute( XMLProcessor::_toXMLCh("name"), XMLProcessor::_toXMLCh( _name ) ); 00123 child -> setAttribute( XMLProcessor::_toXMLCh("type"), XMLProcessor::_toXMLCh( _type ) ); 00124 DOMText * parameter_value = document -> createTextNode( XMLProcessor::_toXMLCh(_value)); 00125 child -> appendChild( parameter_value ); 00126 00127 brickElem -> appendChild( child ); 00128 00129 return child; 00130 }
std::string & LutXml::getCurrentBrick | ( | void | ) |
Definition at line 145 of file LutXml.cc.
References brickElem, and XMLDOMBlock::getString().
Referenced by HcalLutManager::getLutXml().
DOMElement* LutXml::brickElem [protected] |
Definition at line 58 of file LutXml.h.
Referenced by addData(), addLut(), addParameter(), getCurrentBrick(), and init().