5#ifndef INCLUDE_PERSISTENCYSVC_ITECHNOLOGYSPECIFICATTRIBUTES_H
6#define INCLUDE_PERSISTENCYSVC_ITECHNOLOGYSPECIFICATTRIBUTES_H
25 template<
class T > T
attribute(
const std::string& attributeName,
26 const std::string& option =
"" ) {
28 const std::type_info& typeInfo =
typeid(T);
30 static_cast< void*
>( &
data ),
33 std::ostringstream
error;
34 error <<
"Failed to retrieve attribute " << attributeName <<
" of type " << typeInfo.name();
35 throw std::runtime_error(
error.str() +
" (APR: \" ITechnologySpecificAttributes \" from \" PersistencySvc \")");
41 template<
class T >
bool setAttribute(
const std::string& attributeName,
42 const T& atttibuteValue,
43 const std::string& option =
"" ) {
45 static_cast< const void*
>( &atttibuteValue ),
57 const std::type_info& typeInfo,
58 const std::string& option ) = 0;
63 const std::type_info& typeInfo,
64 const std::string& option ) = 0;
char data[hepevt_bytes_allocation_ATLAS]
ITechnologySpecificAttributes is the interface for an object holding technology-specific attributes.
virtual bool setAttributeOfType(const std::string &attributeName, const void *data, const std::type_info &typeInfo, const std::string &option)=0
The actual method setting the attribute data given a name.
T attribute(const std::string &attributeName, const std::string &option="")
Templated method to retrieve an attribute.
bool setAttribute(const std::string &attributeName, const T &atttibuteValue, const std::string &option="")
Templated method to set an attribute.
virtual ~ITechnologySpecificAttributes()
Default destructor.
virtual bool attributeOfType(const std::string &attributeName, void *data, const std::type_info &typeInfo, const std::string &option)=0
The actual method returning the attribute data given a name.