CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
SiStripConfigWriter Class Reference

#include <SiStripConfigWriter.h>

Public Member Functions

void createChildElement (std::string tag, std::string name)
 
void createChildElement (std::string tag, std::string name, std::string att_name, std::string att_val)
 
void createChildElement (std::string tag, std::string name, std::string att_name1, std::string att_val1, std::string att_name2, std::string att_val2)
 
void createChildElement (std::string tag, std::string name, std::string att_name1, std::string att_val1, std::string att_name2, std::string att_val2, std::string att_name3, std::string att_val3)
 
void createElement (std::string tag)
 
void createElement (std::string tag, std::string name)
 
bool init (std::string main)
 Write XML file. More...
 
 SiStripConfigWriter ()
 Creator. More...
 
void write (std::string fname)
 
 ~SiStripConfigWriter ()
 Destructor. More...
 

Private Attributes

xercesc::DOMDocument * theDoc
 
xercesc::DOMLSSerializer * theDomWriter
 
xercesc::DOMElement * theLastElement
 
xercesc::DOMLSOutput * theOutput
 
xercesc::DOMElement * theTopElement
 

Detailed Description

Definition at line 30 of file SiStripConfigWriter.h.

Constructor & Destructor Documentation

SiStripConfigWriter::SiStripConfigWriter ( )

Creator.

Definition at line 11 of file SiStripConfigWriter.cc.

11  {
12 }
SiStripConfigWriter::~SiStripConfigWriter ( )

Destructor.

Definition at line 16 of file SiStripConfigWriter.cc.

16  {
17 }

Member Function Documentation

void SiStripConfigWriter::createChildElement ( std::string  tag,
std::string  name 
)

Definition at line 57 of file SiStripConfigWriter.cc.

References qtxml::_toDOMS().

Referenced by TrackingActionExecutor::printReportSummary(), SiStripActionExecutor::printReportSummary(), TrackingActionExecutor::printShiftHistoParameters(), and SiStripActionExecutor::printShiftHistoParameters().

57  {
58 
59  theLastElement->appendChild(theDoc->createTextNode(qtxml::_toDOMS("\n")));
60  DOMElement* newElement = theDoc->createElement(qtxml::_toDOMS(tag));
61  newElement->setAttribute(qtxml::_toDOMS("name"), qtxml::_toDOMS(name));
62  theLastElement->appendChild(newElement);
63 }
XMLCh * _toDOMS(std::string temp)
xercesc::DOMElement * theLastElement
xercesc::DOMDocument * theDoc
void SiStripConfigWriter::createChildElement ( std::string  tag,
std::string  name,
std::string  att_name,
std::string  att_val 
)

Definition at line 67 of file SiStripConfigWriter.cc.

References qtxml::_toDOMS().

67  {
68 
69  theLastElement->appendChild(theDoc->createTextNode(qtxml::_toDOMS("\n")));
70  DOMElement* newElement = theDoc->createElement(qtxml::_toDOMS(tag));
71  newElement->setAttribute(qtxml::_toDOMS("name"), qtxml::_toDOMS(name));
72  newElement->setAttribute(qtxml::_toDOMS(att_name), qtxml::_toDOMS(att_val));
73 
74  theLastElement->appendChild(newElement);
75 
76 }
XMLCh * _toDOMS(std::string temp)
xercesc::DOMElement * theLastElement
xercesc::DOMDocument * theDoc
void SiStripConfigWriter::createChildElement ( std::string  tag,
std::string  name,
std::string  att_name1,
std::string  att_val1,
std::string  att_name2,
std::string  att_val2 
)

Definition at line 80 of file SiStripConfigWriter.cc.

References qtxml::_toDOMS().

81  {
82  theLastElement->appendChild(theDoc->createTextNode(qtxml::_toDOMS("\n")));
83  DOMElement* newElement = theDoc->createElement(qtxml::_toDOMS(tag));
84  newElement->setAttribute(qtxml::_toDOMS("name"), qtxml::_toDOMS(name));
85  newElement->setAttribute(qtxml::_toDOMS(att_name1), qtxml::_toDOMS(att_val1));
86  newElement->setAttribute(qtxml::_toDOMS(att_name2), qtxml::_toDOMS(att_val2));
87  theLastElement->appendChild(newElement);
88 
89 }
XMLCh * _toDOMS(std::string temp)
xercesc::DOMElement * theLastElement
xercesc::DOMDocument * theDoc
void SiStripConfigWriter::createChildElement ( std::string  tag,
std::string  name,
std::string  att_name1,
std::string  att_val1,
std::string  att_name2,
std::string  att_val2,
std::string  att_name3,
std::string  att_val3 
)

Definition at line 93 of file SiStripConfigWriter.cc.

References qtxml::_toDOMS().

95  {
96 
97  theLastElement->appendChild(theDoc->createTextNode(qtxml::_toDOMS("\n")));
98  DOMElement* newElement = theDoc->createElement(qtxml::_toDOMS(tag));
99  newElement->setAttribute(qtxml::_toDOMS("name"), qtxml::_toDOMS(name));
100  newElement->setAttribute(qtxml::_toDOMS(att_name1), qtxml::_toDOMS(att_val1));
101  newElement->setAttribute(qtxml::_toDOMS(att_name2), qtxml::_toDOMS(att_val2));
102  newElement->setAttribute(qtxml::_toDOMS(att_name3), qtxml::_toDOMS(att_val3));
103  theLastElement->appendChild(newElement);
104 
105 }
XMLCh * _toDOMS(std::string temp)
xercesc::DOMElement * theLastElement
xercesc::DOMDocument * theDoc
void SiStripConfigWriter::createElement ( std::string  tag)
void SiStripConfigWriter::createElement ( std::string  tag,
std::string  name 
)

Definition at line 48 of file SiStripConfigWriter.cc.

References qtxml::_toDOMS().

48  {
49  theTopElement->appendChild(theDoc->createTextNode(qtxml::_toDOMS("\n")));
50  theLastElement = theDoc->createElement(qtxml::_toDOMS(tag));
51  theLastElement->setAttribute(qtxml::_toDOMS("name"), qtxml::_toDOMS(name));
52  theTopElement->appendChild(theLastElement);
53 }
XMLCh * _toDOMS(std::string temp)
xercesc::DOMElement * theLastElement
xercesc::DOMElement * theTopElement
xercesc::DOMDocument * theDoc
bool SiStripConfigWriter::init ( std::string  main)

Write XML file.

Definition at line 21 of file SiStripConfigWriter.cc.

References qtxml::_toDOMS(), and cms::concurrency::xercesInitialize().

Referenced by TrackingActionExecutor::createShiftReport(), and SiStripActionExecutor::createShiftReport().

21  {
23 
24  unique_ptr<DOMImplementation> domImpl( DOMImplementationRegistry::getDOMImplementation(qtxml::_toDOMS("Range")));
25  if( domImpl == nullptr ) return false;
26  theDomWriter = domImpl->createLSSerializer();
27  if( theDomWriter == nullptr ) return false;
28  if( theDomWriter->getDomConfig()->canSetParameter( XMLUni::fgDOMWRTFormatPrettyPrint, true ))
29  theDomWriter->getDomConfig()->setParameter( XMLUni::fgDOMWRTFormatPrettyPrint, true );
30  theDoc = domImpl->createDocument( 0, qtxml::_toDOMS(main), 0 );
31  if( theDoc == nullptr ) return false;
32  theTopElement = theDoc->getDocumentElement();
33  theOutput = domImpl->createLSOutput();
34  if( theOutput == nullptr ) return false;
35  return true;
36 }
xercesc::DOMLSSerializer * theDomWriter
void xercesInitialize()
Definition: Xerces.cc:18
xercesc::DOMLSOutput * theOutput
XMLCh * _toDOMS(std::string temp)
Definition: main.py:1
xercesc::DOMElement * theTopElement
xercesc::DOMDocument * theDoc
void SiStripConfigWriter::write ( std::string  fname)

Definition at line 109 of file SiStripConfigWriter.cc.

Referenced by TrackingActionExecutor::createShiftReport(), SiStripActionExecutor::createShiftReport(), and pkg.AbstractPkg::generate().

109  {
110  XMLFormatTarget* formTarget = new LocalFileFormatTarget(fname.c_str());
111  theOutput->setByteStream(formTarget);
113  delete formTarget;
114  theOutput->release();
115  theDoc->release();
116  theDomWriter->release();
117 }
xercesc::DOMLSSerializer * theDomWriter
xercesc::DOMLSOutput * theOutput
string fname
main script
xercesc::DOMElement * theTopElement
xercesc::DOMDocument * theDoc

Member Data Documentation

xercesc::DOMDocument* SiStripConfigWriter::theDoc
private

Definition at line 58 of file SiStripConfigWriter.h.

xercesc::DOMLSSerializer* SiStripConfigWriter::theDomWriter
private

Definition at line 59 of file SiStripConfigWriter.h.

xercesc::DOMElement* SiStripConfigWriter::theLastElement
private

Definition at line 57 of file SiStripConfigWriter.h.

xercesc::DOMLSOutput* SiStripConfigWriter::theOutput
private

Definition at line 60 of file SiStripConfigWriter.h.

xercesc::DOMElement* SiStripConfigWriter::theTopElement
private

Definition at line 56 of file SiStripConfigWriter.h.