1 #include "gearxml/XMLHandlerMgr.h"
3 #include "gearxml/GearParametersXML.h"
4 #include "gearxml/TPCParametersXML.h"
5 #include "gearxml/CalorimeterParametersXML.h"
6 #include "gearxml/ZPlanarParametersXML.h"
7 #include "gearxml/FTDParametersXML.h"
8 #include "gearxml/TrackerPlanesParametersXML.h"
9 #include "gearxml/SiPlanesParametersXML.h"
10 #include "gearxml/tinyxml.h"
12 #include "gear/GEAR.h"
24 XMLHandlerMgr* XMLHandlerMgr::instance() {
26 static XMLHandlerMgr _me ;
37 XMLHandlerMap::iterator it_end = _map.end() ;
39 for( XMLHandlerMap::iterator it = _map.begin() ; it != it_end ; ++ it ) {
46 XMLHandlerMgr::XMLHandlerMgr() {
70 XMLHandlerMap::iterator it = _map.find( type ) ;
72 if( it != _map.end() ) {
76 it->second = handler ;
80 _map.insert( std::make_pair( type , handler ) ) ;
93 std::stringstream str ;
94 str <<
"XMLParser::getAttribute [" << name <<
"] not an XMLElement " ;
101 std::stringstream str ;
102 str <<
"XMLParser::getAttribute missing attribute \"" << name
103 <<
"\" in element <" << el->
Value() <<
"/> " ;
107 return std::string( at ) ;
112 const std::string& defaultValue) {
114 std::string result( defaultValue ) ;
134 std::stringstream str ;
135 str <<
"XMLParser::getAttribute [" << name <<
"] not an XMLElement " ;
143 std::stringstream str ;
144 str <<
"XMLParser::getChildElementValue missing element \"" << name
145 <<
"\" in element <" << el->
Value() <<
"/> " ;
157 const std::string& defaultValue)
162 throw ParseException(
"XMLParser::getAttribute not an XMLElement " ) ;
XML handler for ZPlanarParameters.
std::string getOptionalXMLAttribute(const TiXmlNode *node, const std::string &name, const std::string &defaultValue)
Helper method used for parsing XML.
Interface for XML handlers of GEAR classes.
XML handler for SiPlanesParameters.
XML handler for CalorimeterParameters.
const char * Value() const
The meaning of 'value' changes for the specific type of TiXmlNode.
Abstract XML handler for TPCParameters.
std::string getOptionalChildElementValue(const TiXmlNode *node, const std::string &name, const std::string &defaultValue)
Helper method used for parsing XML - returns the attribute 'value' of the optional named child elemen...
XML handler for GearParameters.
XML handler for FTDParameters.
const XMLHandler * getHandler(const std::string &type)
XMLHandler for given type.
XML handler for TrackerPlanesParameters.
The parent class for everything in the Document Object Model.
const char * Attribute(const char *name) const
Given an attribute name, Attribute() returns the value for the attribute of that name, or null if none exists.
ParseException used for parse errors, e.g.
std::string getXMLAttribute(const TiXmlNode *node, const std::string &name)
Helper method used for parsing XML.
const TiXmlElement * ToElement() const
Cast to a more defined type. Will return null not of the requested type.
The element is a container class.
~XMLHandlerMgr()
the destructor
std::string getChildElementValue(const TiXmlNode *node, const std::string &name)
Helper method used for parsing XML - returns the attribute 'value' of the named child element as doub...
void setHandler(const std::string &type, XMLHandler *handler)
Register XMLHandler for type.
const TiXmlElement * FirstChildElement() const
Convenience function to get through elements.