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 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::DOMImplementation * domImpl
 
xercesc::DOMWriter * domWriter
 
xercesc::DOMElement * lastElement
 
xercesc::DOMDocument * theDoc
 
xercesc::DOMElement * theTopElement
 

Detailed Description

Definition at line 32 of file SiStripConfigWriter.h.

Constructor & Destructor Documentation

SiStripConfigWriter::SiStripConfigWriter ( )

Creator.

Definition at line 9 of file SiStripConfigWriter.cc.

9  {
10 }
SiStripConfigWriter::~SiStripConfigWriter ( )

Destructor.

Definition at line 14 of file SiStripConfigWriter.cc.

14  {
15 
16 }

Member Function Documentation

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

Definition at line 53 of file SiStripConfigWriter.cc.

References qtxml::_toDOMS(), lastElement, and theDoc.

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

53  {
54 
55  lastElement->appendChild(theDoc->createTextNode(qtxml::_toDOMS("\n")));
56  xercesc::DOMElement* newElement = theDoc->createElement(qtxml::_toDOMS(tag));
57  newElement->setAttribute(qtxml::_toDOMS("name"), qtxml::_toDOMS(name));
58  lastElement->appendChild(newElement);
59 }
xercesc::DOMElement * lastElement
XMLCh * _toDOMS(std::string temp)
xercesc::DOMDocument * theDoc
void SiStripConfigWriter::createChildElement ( std::string  tag,
std::string  name,
std::string  att_name,
std::string  att_val 
)

Definition at line 63 of file SiStripConfigWriter.cc.

References qtxml::_toDOMS(), lastElement, and theDoc.

63  {
64 
65  lastElement->appendChild(theDoc->createTextNode(qtxml::_toDOMS("\n")));
66  xercesc::DOMElement* newElement = theDoc->createElement(qtxml::_toDOMS(tag));
67  newElement->setAttribute(qtxml::_toDOMS("name"), qtxml::_toDOMS(name));
68  newElement->setAttribute(qtxml::_toDOMS(att_name), qtxml::_toDOMS(att_val));
69 
70  lastElement->appendChild(newElement);
71 
72 }
xercesc::DOMElement * lastElement
XMLCh * _toDOMS(std::string temp)
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 76 of file SiStripConfigWriter.cc.

References qtxml::_toDOMS(), lastElement, and theDoc.

77  {
78  lastElement->appendChild(theDoc->createTextNode(qtxml::_toDOMS("\n")));
79  xercesc::DOMElement* newElement = theDoc->createElement(qtxml::_toDOMS(tag));
80  newElement->setAttribute(qtxml::_toDOMS("name"), qtxml::_toDOMS(name));
81  newElement->setAttribute(qtxml::_toDOMS(att_name1), qtxml::_toDOMS(att_val1));
82  newElement->setAttribute(qtxml::_toDOMS(att_name2), qtxml::_toDOMS(att_val2));
83  lastElement->appendChild(newElement);
84 
85 }
xercesc::DOMElement * lastElement
XMLCh * _toDOMS(std::string temp)
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 89 of file SiStripConfigWriter.cc.

References qtxml::_toDOMS(), lastElement, and theDoc.

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

Definition at line 36 of file SiStripConfigWriter.cc.

References qtxml::_toDOMS(), lastElement, theDoc, and theTopElement.

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

36  {
37  theTopElement->appendChild(theDoc->createTextNode(qtxml::_toDOMS("\n")));
38  lastElement = theDoc->createElement(qtxml::_toDOMS(tag));
39  theTopElement->appendChild(lastElement);
40 }
xercesc::DOMElement * lastElement
XMLCh * _toDOMS(std::string temp)
xercesc::DOMElement * theTopElement
xercesc::DOMDocument * theDoc
void SiStripConfigWriter::createElement ( std::string  tag,
std::string  name 
)

Definition at line 44 of file SiStripConfigWriter.cc.

References qtxml::_toDOMS(), lastElement, theDoc, and theTopElement.

44  {
45  theTopElement->appendChild(theDoc->createTextNode(qtxml::_toDOMS("\n")));
46  lastElement = theDoc->createElement(qtxml::_toDOMS(tag));
47  lastElement->setAttribute(qtxml::_toDOMS("name"), qtxml::_toDOMS(name));
48  theTopElement->appendChild(lastElement);
49 }
xercesc::DOMElement * lastElement
XMLCh * _toDOMS(std::string temp)
xercesc::DOMElement * theTopElement
xercesc::DOMDocument * theDoc
bool SiStripConfigWriter::init ( std::string  main)

Write XML file.

Definition at line 20 of file SiStripConfigWriter.cc.

References qtxml::_toDOMS(), domImpl, domWriter, theDoc, and theTopElement.

Referenced by SiStripActionExecutor::createShiftReport().

20  {
21  xercesc::XMLPlatformUtils::Initialize();
22 
23  xercesc::DOMImplementation* domImpl = xercesc::DOMImplementationRegistry::getDOMImplementation(qtxml::_toDOMS("Range"));
24  if (!domImpl) return false;
25  domWriter = (dynamic_cast<xercesc::DOMImplementation*>(domImpl))->createDOMWriter();
26  if (!domWriter) return false;
27  domWriter->canSetFeature(xercesc::XMLUni::fgDOMWRTFormatPrettyPrint, true);
28  theDoc = domImpl->createDocument(0,qtxml::_toDOMS(main), 0);
29  if (!theDoc) return false;
30  theTopElement = theDoc->getDocumentElement();
31  return true;
32 }
def main
— Main —############################
xercesc::DOMWriter * domWriter
xercesc::DOMImplementation * domImpl
XMLCh * _toDOMS(std::string temp)
xercesc::DOMElement * theTopElement
xercesc::DOMDocument * theDoc
void SiStripConfigWriter::write ( std::string  fname)

Definition at line 105 of file SiStripConfigWriter.cc.

References domWriter, theDoc, and theTopElement.

Referenced by SiStripActionExecutor::createShiftReport().

105  {
106  xercesc::XMLFormatTarget* formTarget = new xercesc::LocalFileFormatTarget(fname.c_str());
107  domWriter->writeNode(formTarget, *theTopElement);
108  delete formTarget;
109  theDoc->release();
110 }
xercesc::DOMWriter * domWriter
string fname
main script
xercesc::DOMElement * theTopElement
xercesc::DOMDocument * theDoc

Member Data Documentation

xercesc::DOMImplementation* SiStripConfigWriter::domImpl
private

Definition at line 61 of file SiStripConfigWriter.h.

Referenced by init().

xercesc::DOMWriter* SiStripConfigWriter::domWriter
private

Definition at line 62 of file SiStripConfigWriter.h.

Referenced by init(), and write().

xercesc::DOMElement* SiStripConfigWriter::lastElement
private

Definition at line 59 of file SiStripConfigWriter.h.

Referenced by createChildElement(), and createElement().

xercesc::DOMDocument* SiStripConfigWriter::theDoc
private

Definition at line 60 of file SiStripConfigWriter.h.

Referenced by createChildElement(), createElement(), init(), and write().

xercesc::DOMElement* SiStripConfigWriter::theTopElement
private

Definition at line 58 of file SiStripConfigWriter.h.

Referenced by createElement(), init(), and write().