CMS 3D CMS Logo

Public Member Functions | Private Attributes

SiStripConfigWriter Class Reference

#include <SiStripConfigWriter.h>

List of all members.

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, std::string name)
void createElement (std::string tag)
bool init (std::string main)
 Write XML file.
 SiStripConfigWriter ()
 Creator.
void write (std::string fname)
 ~SiStripConfigWriter ()
 Destructor.

Private Attributes

xercesc::DOMImplementation * domImpl
xercesc::DOMWriter * domWriter
xercesc::DOMElement * lastElement
xercesc::DOMDocument * theDoc
xercesc::DOMElement * theTopElement

Detailed Description

* Base class for Parsers used by DQM

Date:
2008/12/26 09:05:28
Revision:
1.3
Author:
Suchandra Dutta

Definition at line 32 of file SiStripConfigWriter.h.


Constructor & Destructor Documentation

SiStripConfigWriter::SiStripConfigWriter ( )

Creator.

Definition at line 9 of file SiStripConfigWriter.cc.

                                         {
}
SiStripConfigWriter::~SiStripConfigWriter ( )

Destructor.

Definition at line 14 of file SiStripConfigWriter.cc.

                                          {

}

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().

                                                                          {

  lastElement->appendChild(theDoc->createTextNode(qtxml::_toDOMS("\n")));
  xercesc::DOMElement* newElement = theDoc->createElement(qtxml::_toDOMS(tag));
  newElement->setAttribute(qtxml::_toDOMS("name"), qtxml::_toDOMS(name));
  lastElement->appendChild(newElement);
}
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.

                                                                                                               {

  lastElement->appendChild(theDoc->createTextNode(qtxml::_toDOMS("\n")));
  xercesc::DOMElement* newElement = theDoc->createElement(qtxml::_toDOMS(tag));
  newElement->setAttribute(qtxml::_toDOMS("name"), qtxml::_toDOMS(name));
  newElement->setAttribute(qtxml::_toDOMS(att_name1), qtxml::_toDOMS(att_val1));  
  newElement->setAttribute(qtxml::_toDOMS(att_name2), qtxml::_toDOMS(att_val2));
  newElement->setAttribute(qtxml::_toDOMS(att_name3), qtxml::_toDOMS(att_val3));
  lastElement->appendChild(newElement);

}
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.

                                                                                                               {
  lastElement->appendChild(theDoc->createTextNode(qtxml::_toDOMS("\n")));
  xercesc::DOMElement* newElement = theDoc->createElement(qtxml::_toDOMS(tag));
  newElement->setAttribute(qtxml::_toDOMS("name"), qtxml::_toDOMS(name));
  newElement->setAttribute(qtxml::_toDOMS(att_name1), qtxml::_toDOMS(att_val1));  
  newElement->setAttribute(qtxml::_toDOMS(att_name2), qtxml::_toDOMS(att_val2));
  lastElement->appendChild(newElement);

}
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.

                                                                                                                 {

  lastElement->appendChild(theDoc->createTextNode(qtxml::_toDOMS("\n")));
  xercesc::DOMElement* newElement = theDoc->createElement(qtxml::_toDOMS(tag));
  newElement->setAttribute(qtxml::_toDOMS("name"), qtxml::_toDOMS(name));
  newElement->setAttribute(qtxml::_toDOMS(att_name), qtxml::_toDOMS(att_val));

  lastElement->appendChild(newElement);

}
void SiStripConfigWriter::createElement ( std::string  tag,
std::string  name 
)

Definition at line 44 of file SiStripConfigWriter.cc.

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

                                                                     {
  theTopElement->appendChild(theDoc->createTextNode(qtxml::_toDOMS("\n")));
  lastElement = theDoc->createElement(qtxml::_toDOMS(tag));
  lastElement->setAttribute(qtxml::_toDOMS("name"), qtxml::_toDOMS(name));
  theTopElement->appendChild(lastElement);
}
void SiStripConfigWriter::createElement ( std::string  tag)
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().

                                             {
  xercesc::XMLPlatformUtils::Initialize();

  xercesc::DOMImplementation* domImpl = xercesc::DOMImplementationRegistry::getDOMImplementation(qtxml::_toDOMS("Range"));
  if (!domImpl) return false;
  domWriter = (dynamic_cast<xercesc::DOMImplementation*>(domImpl))->createDOMWriter();
  if (!domWriter) return false;
  domWriter->canSetFeature(xercesc::XMLUni::fgDOMWRTFormatPrettyPrint, true);
  theDoc = domImpl->createDocument(0,qtxml::_toDOMS(main), 0);
  if (!theDoc) return false;
  theTopElement = theDoc->getDocumentElement();
  return true;
}
void SiStripConfigWriter::write ( std::string  fname)

Definition at line 105 of file SiStripConfigWriter.cc.

References domWriter, theDoc, and theTopElement.

Referenced by SiStripActionExecutor::createShiftReport().

                                               {
  xercesc::XMLFormatTarget* formTarget = new xercesc::LocalFileFormatTarget(fname.c_str());
  domWriter->writeNode(formTarget, *theTopElement);
  delete formTarget;
  theDoc->release(); 
}

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().