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

Constructor & Destructor Documentation

SiPixelConfigWriter::SiPixelConfigWriter ( )

Creator.

Definition at line 11 of file SiPixelConfigWriter.cc.

11 {}
SiPixelConfigWriter::~SiPixelConfigWriter ( )

Destructor.

Definition at line 15 of file SiPixelConfigWriter.cc.

15 {}

Member Function Documentation

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

Definition at line 65 of file SiPixelConfigWriter.cc.

References qtxml::_toDOMS(), and StorageManager_cfg::e1.

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

Definition at line 47 of file SiPixelConfigWriter.cc.

References qtxml::_toDOMS().

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

Definition at line 55 of file SiPixelConfigWriter.cc.

References qtxml::_toDOMS().

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

Write XML file.

Definition at line 19 of file SiPixelConfigWriter.cc.

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

19  {
20  try {
22  } catch (const XMLException &toCatch) {
23  cout << "Problem to initialise XML !!! " << endl;
24  return false;
25  }
26  unique_ptr<DOMImplementation> domImpl(DOMImplementationRegistry::getDOMImplementation(qtxml::_toDOMS("Range")));
27  if (domImpl == nullptr)
28  return false;
29  theDomWriter = domImpl->createLSSerializer();
30  if (theDomWriter == nullptr)
31  return false;
32  if (theDomWriter->getDomConfig()->canSetParameter(XMLUni::fgDOMWRTFormatPrettyPrint, true))
33  theDomWriter->getDomConfig()->setParameter(XMLUni::fgDOMWRTFormatPrettyPrint, true);
34  theDoc = domImpl->createDocument(nullptr, qtxml::_toDOMS("Layouts"), nullptr);
35  if (theDoc == nullptr)
36  return false;
37  theTopElement = theDoc->getDocumentElement();
38  theTopElement->appendChild(theDoc->createTextNode(qtxml::_toDOMS("\n")));
39  theOutput = domImpl->createLSOutput();
40  if (theOutput == nullptr)
41  return false;
42  return true;
43 }
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 77 of file SiPixelConfigWriter.cc.

Referenced by pkg.AbstractPkg::generate().

77  {
78  XMLFormatTarget *formTarget = new LocalFileFormatTarget(fname.c_str());
79  theOutput->setByteStream(formTarget);
81  delete formTarget;
82  theOutput->release();
83  theDoc->release();
84  theDomWriter->release();
85 }
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 43 of file SiPixelConfigWriter.h.

xercesc::DOMLSSerializer* SiPixelConfigWriter::theDomWriter
private

Definition at line 44 of file SiPixelConfigWriter.h.

xercesc::DOMElement* SiPixelConfigWriter::theLastLayout
private

Definition at line 41 of file SiPixelConfigWriter.h.

xercesc::DOMElement* SiPixelConfigWriter::theLastRow
private

Definition at line 42 of file SiPixelConfigWriter.h.

xercesc::DOMLSOutput* SiPixelConfigWriter::theOutput
private

Definition at line 45 of file SiPixelConfigWriter.h.

xercesc::DOMElement* SiPixelConfigWriter::theTopElement
private

Definition at line 40 of file SiPixelConfigWriter.h.