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

Detailed Description

Definition at line 28 of file SiPixelConfigWriter.h.

Constructor & Destructor Documentation

SiPixelConfigWriter::SiPixelConfigWriter ( )

Creator.

Definition at line 11 of file SiPixelConfigWriter.cc.

11  {
12 }
SiPixelConfigWriter::~SiPixelConfigWriter ( )

Destructor.

Definition at line 16 of file SiPixelConfigWriter.cc.

16  {
17 
18 }

Member Function Documentation

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

Definition at line 59 of file SiPixelConfigWriter.cc.

References qtxml::_toDOMS().

Referenced by SiPixelActionExecutor::fillLayout().

59  {
60 
61  lastRow->appendChild(theDoc->createTextNode(qtxml::_toDOMS("\n")));
62  DOMElement* e1 = theDoc->createElement(qtxml::_toDOMS("column"));
63  lastRow->appendChild(e1);
64 
65 
66  DOMElement* e2 = theDoc->createElement(qtxml::_toDOMS(element));
67  e2->setAttribute(qtxml::_toDOMS("name"),qtxml::_toDOMS(name));
68  e1->appendChild(e2);
69  }
xercesc::DOMElement * lastRow
XMLCh * _toDOMS(std::string temp)
xercesc::DOMDocument * theDoc
void SiPixelConfigWriter::createLayout ( std::string &  name)

Definition at line 41 of file SiPixelConfigWriter.cc.

References qtxml::_toDOMS().

Referenced by SiPixelActionExecutor::createLayout().

41  {
42  lastLayout = theDoc->createElement(qtxml::_toDOMS("layout"));
43  lastLayout->setAttribute(qtxml::_toDOMS("name"), qtxml::_toDOMS(name));
44  theTopElement->appendChild(lastLayout);
45 }
xercesc::DOMElement * lastLayout
XMLCh * _toDOMS(std::string temp)
xercesc::DOMElement * theTopElement
xercesc::DOMDocument * theDoc
void SiPixelConfigWriter::createRow ( )

Definition at line 49 of file SiPixelConfigWriter.cc.

References qtxml::_toDOMS().

Referenced by SiPixelActionExecutor::createLayout(), and SiPixelActionExecutor::fillLayout().

49  {
50  lastLayout->appendChild(theDoc->createTextNode(qtxml::_toDOMS("\n")));
51 
52  lastRow = theDoc->createElement(qtxml::_toDOMS("row"));
53  lastLayout->appendChild(lastRow);
54  lastLayout->appendChild(theDoc->createTextNode(qtxml::_toDOMS("\n")));
55 }
xercesc::DOMElement * lastRow
xercesc::DOMElement * lastLayout
XMLCh * _toDOMS(std::string temp)
xercesc::DOMDocument * theDoc
bool SiPixelConfigWriter::init ( void  )

Write XML file.

Definition at line 22 of file SiPixelConfigWriter.cc.

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

Referenced by SiPixelActionExecutor::createLayout().

22  {
23  try {
25  }
26  catch (const XMLException& toCatch) {
27  cout << "Problem to initialise XML !!! " << endl;
28  return false;
29  }
30  DOMImplementation* domImpl = DOMImplementationRegistry::getDOMImplementation(qtxml::_toDOMS("Range"));
31  domWriter = (dynamic_cast<DOMImplementation*>(domImpl))->createDOMWriter();
32  domWriter->canSetFeature(XMLUni::fgDOMWRTFormatPrettyPrint, true);
33  theDoc = domImpl->createDocument(0,qtxml::_toDOMS("Layouts"), 0);
34  theTopElement = theDoc->getDocumentElement();
35  theTopElement->appendChild(theDoc->createTextNode(qtxml::_toDOMS("\n")));
36  return true;
37 }
xercesc::DOMWriter * domWriter
void xercesInitialize()
Definition: Xerces.cc:17
xercesc::DOMImplementation * domImpl
XMLCh * _toDOMS(std::string temp)
tuple cout
Definition: gather_cfg.py:121
xercesc::DOMElement * theTopElement
xercesc::DOMDocument * theDoc
void SiPixelConfigWriter::write ( std::string &  fname)

Definition at line 73 of file SiPixelConfigWriter.cc.

Referenced by pkg.AbstractPkg::generate().

73  {
74  XMLFormatTarget* formTarget = new LocalFileFormatTarget(fname.c_str());
75  domWriter->writeNode(formTarget, *theTopElement);
76  delete formTarget;
77  theDoc->release();
78 
79 
80 }
xercesc::DOMWriter * domWriter
string fname
main script
xercesc::DOMElement * theTopElement
xercesc::DOMDocument * theDoc

Member Data Documentation

xercesc::DOMImplementation* SiPixelConfigWriter::domImpl
private

Definition at line 52 of file SiPixelConfigWriter.h.

xercesc::DOMWriter* SiPixelConfigWriter::domWriter
private

Definition at line 53 of file SiPixelConfigWriter.h.

xercesc::DOMElement* SiPixelConfigWriter::lastLayout
private

Definition at line 49 of file SiPixelConfigWriter.h.

xercesc::DOMElement* SiPixelConfigWriter::lastRow
private
xercesc::DOMDocument* SiPixelConfigWriter::theDoc
private

Definition at line 51 of file SiPixelConfigWriter.h.

xercesc::DOMElement* SiPixelConfigWriter::theTopElement
private

Definition at line 48 of file SiPixelConfigWriter.h.