CMS 3D CMS Logo

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

#include <SiPixelConfigWriter.h>

Public Member Functions

void createColumn (std::string &element, std::string &name)
 
void createLayout (std::string &name)
 
void createRow ()
 
bool init ()
 Write XML file. More...
 
 SiPixelConfigWriter ()
 Creator. More...
 
void write (std::string &fname)
 
 ~SiPixelConfigWriter ()
 Destructor. More...
 

Private Attributes

xercesc::DOMDocument * theDoc
 
xercesc::DOMLSSerializer * theDomWriter
 
xercesc::DOMElement * theLastLayout
 
xercesc::DOMElement * theLastRow
 
xercesc::DOMLSOutput * theOutput
 
xercesc::DOMElement * theTopElement
 

Detailed Description

Definition at line 28 of file SiPixelConfigWriter.h.

Constructor & Destructor Documentation

SiPixelConfigWriter::SiPixelConfigWriter ( )

Creator.

Definition at line 12 of file SiPixelConfigWriter.cc.

12  {
13 }
SiPixelConfigWriter::~SiPixelConfigWriter ( )

Destructor.

Definition at line 17 of file SiPixelConfigWriter.cc.

17  {
18 
19 }

Member Function Documentation

void SiPixelConfigWriter::createColumn ( std::string &  element,
std::string &  name 
)

Definition at line 66 of file SiPixelConfigWriter.cc.

References qtxml::_toDOMS().

66  {
67 
68  theLastRow->appendChild(theDoc->createTextNode(qtxml::_toDOMS("\n")));
69  DOMElement* e1 = theDoc->createElement(qtxml::_toDOMS("column"));
70  theLastRow->appendChild(e1);
71 
72 
73  DOMElement* e2 = theDoc->createElement(qtxml::_toDOMS(element));
74  e2->setAttribute(qtxml::_toDOMS("name"),qtxml::_toDOMS(name));
75  e1->appendChild(e2);
76  }
xercesc::DOMElement * theLastRow
XMLCh * _toDOMS(std::string temp)
xercesc::DOMDocument * theDoc
void SiPixelConfigWriter::createLayout ( std::string &  name)

Definition at line 48 of file SiPixelConfigWriter.cc.

References qtxml::_toDOMS().

48  {
49  theLastLayout = theDoc->createElement(qtxml::_toDOMS("layout"));
50  theLastLayout->setAttribute(qtxml::_toDOMS("name"), qtxml::_toDOMS(name));
51  theTopElement->appendChild(theLastLayout);
52 }
xercesc::DOMElement * theLastLayout
XMLCh * _toDOMS(std::string temp)
xercesc::DOMElement * theTopElement
xercesc::DOMDocument * theDoc
void SiPixelConfigWriter::createRow ( )

Definition at line 56 of file SiPixelConfigWriter.cc.

References qtxml::_toDOMS().

56  {
57  theLastLayout->appendChild(theDoc->createTextNode(qtxml::_toDOMS("\n")));
58 
59  theLastRow = theDoc->createElement(qtxml::_toDOMS("row"));
60  theLastLayout->appendChild(theLastRow);
61  theLastLayout->appendChild(theDoc->createTextNode(qtxml::_toDOMS("\n")));
62 }
xercesc::DOMElement * theLastRow
xercesc::DOMElement * theLastLayout
XMLCh * _toDOMS(std::string temp)
xercesc::DOMDocument * theDoc
bool SiPixelConfigWriter::init ( void  )

Write XML file.

Definition at line 23 of file SiPixelConfigWriter.cc.

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

23  {
24  try {
26  }
27  catch (const XMLException& toCatch) {
28  cout << "Problem to initialise XML !!! " << endl;
29  return false;
30  }
31  unique_ptr<DOMImplementation> domImpl( DOMImplementationRegistry::getDOMImplementation(qtxml::_toDOMS("Range")));
32  if( domImpl == nullptr ) return false;
33  theDomWriter = domImpl->createLSSerializer();
34  if( theDomWriter == nullptr ) return false;
35  if( theDomWriter->getDomConfig()->canSetParameter( XMLUni::fgDOMWRTFormatPrettyPrint, true ))
36  theDomWriter->getDomConfig()->setParameter( XMLUni::fgDOMWRTFormatPrettyPrint, true );
37  theDoc = domImpl->createDocument(nullptr,qtxml::_toDOMS("Layouts"), nullptr);
38  if( theDoc == nullptr ) return false;
39  theTopElement = theDoc->getDocumentElement();
40  theTopElement->appendChild(theDoc->createTextNode(qtxml::_toDOMS("\n")));
41  theOutput = domImpl->createLSOutput();
42  if( theOutput == nullptr ) return false;
43  return true;
44 }
void xercesInitialize()
Definition: Xerces.cc:18
xercesc::DOMLSSerializer * theDomWriter
xercesc::DOMLSOutput * theOutput
XMLCh * _toDOMS(std::string temp)
xercesc::DOMElement * theTopElement
xercesc::DOMDocument * theDoc
void SiPixelConfigWriter::write ( std::string &  fname)

Definition at line 80 of file SiPixelConfigWriter.cc.

Referenced by pkg.AbstractPkg::generate().

80  {
81  XMLFormatTarget* formTarget = new LocalFileFormatTarget(fname.c_str());
82  theOutput->setByteStream(formTarget);
84  delete formTarget;
85  theOutput->release();
86  theDoc->release();
87  theDomWriter->release();
88 }
xercesc::DOMLSSerializer * theDomWriter
xercesc::DOMLSOutput * theOutput
string fname
main script
xercesc::DOMElement * theTopElement
xercesc::DOMDocument * theDoc

Member Data Documentation

xercesc::DOMDocument* SiPixelConfigWriter::theDoc
private

Definition at line 51 of file SiPixelConfigWriter.h.

xercesc::DOMLSSerializer* SiPixelConfigWriter::theDomWriter
private

Definition at line 52 of file SiPixelConfigWriter.h.

xercesc::DOMElement* SiPixelConfigWriter::theLastLayout
private

Definition at line 49 of file SiPixelConfigWriter.h.

xercesc::DOMElement* SiPixelConfigWriter::theLastRow
private

Definition at line 50 of file SiPixelConfigWriter.h.

xercesc::DOMLSOutput* SiPixelConfigWriter::theOutput
private

Definition at line 53 of file SiPixelConfigWriter.h.

xercesc::DOMElement* SiPixelConfigWriter::theTopElement
private

Definition at line 48 of file SiPixelConfigWriter.h.