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 25 of file SiStripConfigWriter.h.

Constructor & Destructor Documentation

SiStripConfigWriter::SiStripConfigWriter ( )

Creator.

Definition at line 11 of file SiStripConfigWriter.cc.

11 {}
SiStripConfigWriter::~SiStripConfigWriter ( )

Destructor.

Definition at line 15 of file SiStripConfigWriter.cc.

15 {}

Member Function Documentation

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

Definition at line 59 of file SiStripConfigWriter.cc.

References qtxml::_toDOMS().

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

59  {
60  theLastElement->appendChild(theDoc->createTextNode(qtxml::_toDOMS("\n")));
61  DOMElement* newElement = theDoc->createElement(qtxml::_toDOMS(tag));
62  newElement->setAttribute(qtxml::_toDOMS("name"), qtxml::_toDOMS(name));
63  theLastElement->appendChild(newElement);
64 }
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 68 of file SiStripConfigWriter.cc.

References qtxml::_toDOMS().

71  {
72  theLastElement->appendChild(theDoc->createTextNode(qtxml::_toDOMS("\n")));
73  DOMElement* newElement = theDoc->createElement(qtxml::_toDOMS(tag));
74  newElement->setAttribute(qtxml::_toDOMS("name"), qtxml::_toDOMS(name));
75  newElement->setAttribute(qtxml::_toDOMS(att_name), qtxml::_toDOMS(att_val));
76 
77  theLastElement->appendChild(newElement);
78 }
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 82 of file SiStripConfigWriter.cc.

References qtxml::_toDOMS().

87  {
88  theLastElement->appendChild(theDoc->createTextNode(qtxml::_toDOMS("\n")));
89  DOMElement* newElement = theDoc->createElement(qtxml::_toDOMS(tag));
90  newElement->setAttribute(qtxml::_toDOMS("name"), qtxml::_toDOMS(name));
91  newElement->setAttribute(qtxml::_toDOMS(att_name1), qtxml::_toDOMS(att_val1));
92  newElement->setAttribute(qtxml::_toDOMS(att_name2), qtxml::_toDOMS(att_val2));
93  theLastElement->appendChild(newElement);
94 }
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 98 of file SiStripConfigWriter.cc.

References qtxml::_toDOMS().

105  {
106  theLastElement->appendChild(theDoc->createTextNode(qtxml::_toDOMS("\n")));
107  DOMElement* newElement = theDoc->createElement(qtxml::_toDOMS(tag));
108  newElement->setAttribute(qtxml::_toDOMS("name"), qtxml::_toDOMS(name));
109  newElement->setAttribute(qtxml::_toDOMS(att_name1), qtxml::_toDOMS(att_val1));
110  newElement->setAttribute(qtxml::_toDOMS(att_name2), qtxml::_toDOMS(att_val2));
111  newElement->setAttribute(qtxml::_toDOMS(att_name3), qtxml::_toDOMS(att_val3));
112  theLastElement->appendChild(newElement);
113 }
XMLCh * _toDOMS(std::string temp)
xercesc::DOMElement * theLastElement
xercesc::DOMDocument * theDoc
void SiStripConfigWriter::createElement ( std::string  tag)

Definition at line 42 of file SiStripConfigWriter.cc.

References qtxml::_toDOMS().

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

42  {
43  theTopElement->appendChild(theDoc->createTextNode(qtxml::_toDOMS("\n")));
44  theLastElement = theDoc->createElement(qtxml::_toDOMS(tag));
45  theTopElement->appendChild(theLastElement);
46 }
XMLCh * _toDOMS(std::string temp)
xercesc::DOMElement * theLastElement
xercesc::DOMElement * theTopElement
xercesc::DOMDocument * theDoc
void SiStripConfigWriter::createElement ( std::string  tag,
std::string  name 
)

Definition at line 50 of file SiStripConfigWriter.cc.

References qtxml::_toDOMS().

50  {
51  theTopElement->appendChild(theDoc->createTextNode(qtxml::_toDOMS("\n")));
52  theLastElement = theDoc->createElement(qtxml::_toDOMS(tag));
53  theLastElement->setAttribute(qtxml::_toDOMS("name"), qtxml::_toDOMS(name));
54  theTopElement->appendChild(theLastElement);
55 }
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 19 of file SiStripConfigWriter.cc.

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

Referenced by TrackingActionExecutor::createShiftReport().

19  {
21 
22  unique_ptr<DOMImplementation> domImpl(DOMImplementationRegistry::getDOMImplementation(qtxml::_toDOMS("Range")));
23  if (domImpl == nullptr)
24  return false;
25  theDomWriter = domImpl->createLSSerializer();
26  if (theDomWriter == nullptr)
27  return false;
28  if (theDomWriter->getDomConfig()->canSetParameter(XMLUni::fgDOMWRTFormatPrettyPrint, true))
29  theDomWriter->getDomConfig()->setParameter(XMLUni::fgDOMWRTFormatPrettyPrint, true);
30  theDoc = domImpl->createDocument(nullptr, qtxml::_toDOMS(main), nullptr);
31  if (theDoc == nullptr)
32  return false;
33  theTopElement = theDoc->getDocumentElement();
34  theOutput = domImpl->createLSOutput();
35  if (theOutput == nullptr)
36  return false;
37  return true;
38 }
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 117 of file SiStripConfigWriter.cc.

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

117  {
118  XMLFormatTarget* formTarget = new LocalFileFormatTarget(fname.c_str());
119  theOutput->setByteStream(formTarget);
121  delete formTarget;
122  theOutput->release();
123  theDoc->release();
124  theDomWriter->release();
125 }
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 57 of file SiStripConfigWriter.h.

xercesc::DOMLSSerializer* SiStripConfigWriter::theDomWriter
private

Definition at line 58 of file SiStripConfigWriter.h.

xercesc::DOMElement* SiStripConfigWriter::theLastElement
private

Definition at line 56 of file SiStripConfigWriter.h.

xercesc::DOMLSOutput* SiStripConfigWriter::theOutput
private

Definition at line 59 of file SiStripConfigWriter.h.

xercesc::DOMElement* SiStripConfigWriter::theTopElement
private

Definition at line 55 of file SiStripConfigWriter.h.