diff --git a/Detector/DetCRD/src/include/XMLHandlerDB.h b/Detector/DetCRD/src/include/XMLHandlerDB.h new file mode 100644 index 0000000000000000000000000000000000000000..7285d2bc0178b38af0a65d74247c67aa5c6c7269 --- /dev/null +++ b/Detector/DetCRD/src/include/XMLHandlerDB.h @@ -0,0 +1,23 @@ +#include "XML/XMLDetector.h" +#include <string> + +namespace { + /** Wrapper class to replace the Database class used in Mokka to read the parameters. + * Assumes parameters are stored as attributes of the corresponding xml element. + */ + struct XMLHandlerDB{ + xml_comp_t x_det ; + /** C'tor initializes the handle */ + XMLHandlerDB(xml_comp_t det) : x_det(det) {} + + double fetchDouble( const char* _name){ return x_det.attr<double>( dd4hep::xml::Strng_t(_name) ) ; } + + int fetchInt( const char* _name){ return x_det.attr<int>( dd4hep::xml::Strng_t(_name) ) ; } + + std::string fetchString( const char* _name){ return x_det.attr<std::string>( dd4hep::xml::Strng_t(_name) ) ;} + + /** allow this to be used as a 'pointer' ( as was used for Mokka Database object)*/ + XMLHandlerDB* operator->() { return this ; } + }; + +}