00001
00002
00003 #ifndef XAODCORE_TOOLS_AUXPERSINFO_H
00004 #define XAODCORE_TOOLS_AUXPERSINFO_H
00005
00006
00007 #include <stdexcept>
00008
00009
00010 #include "AthContainersInterfaces/IAuxTypeVector.h"
00011
00012 namespace xAOD {
00013
00025 template< class T >
00026 class AuxPersInfo : public SG::IAuxTypeVector {
00027
00028 public:
00030 typedef T& info_type;
00031
00033 AuxPersInfo( info_type info ) : m_info( info ) {}
00034
00035 virtual SG::IAuxTypeVector* clone() const {
00036 return new AuxPersInfo<T>(*this);
00037 }
00038
00039 virtual void* toPtr() {
00040 return &m_info;
00041 }
00042 virtual void* toVector() {
00043 return &m_info;
00044 }
00045 virtual size_t size() const {
00046 return 1;
00047 }
00048 virtual void resize( size_t sz ) {
00049 if( sz != 1 ) {
00050 throw std::runtime_error( "Calling resize with != 1 on a "
00051 "non-vector" );
00052 }
00053 }
00054 virtual void reserve( size_t sz ) {
00055 if( sz != 1 ) {
00056 throw std::runtime_error( "Calling reserve with != 1 on a "
00057 "non-vector" );
00058 }
00059 }
00060 virtual void shift( size_t , ptrdiff_t ) {
00061 throw std::runtime_error( "Calling shift on a non-vector" );
00062 }
00063
00064 virtual const std::type_info* objType() const {
00065 return &typeid(T);
00066 }
00067
00068 private:
00070 info_type m_info;
00071
00072 };
00073
00074 }
00075
00076 #endif // XAODCORE_TOOLS_AUXPERSINFO_H