ATLAS Offline Software
Loading...
Searching...
No Matches
ExpressionParsing::AccessorFactory Class Reference

Class which creates accessors for the specified xAOD object content (singleton). More...

#include <xAODAccessor.h>

Inheritance diagram for ExpressionParsing::AccessorFactory:
Collaboration diagram for ExpressionParsing::AccessorFactory:

Public Member Functions

 AccessorFactory ()
std::unique_ptr< IAccessorcreate (const SG::ReadHandleKey< SG::AuxElement > &key, SG::auxid_t auxid, const SG::ReadDecorHandleKey< SG::AuxElement > *decor_key=nullptr) const
 create an accessor for the specified content of an AuxElement.
std::unique_ptr< IAccessorcreate (const SG::ReadHandleKey< SG::AuxVectorBase > &key, SG::auxid_t auxid, const SG::ReadDecorHandleKey< SG::AuxVectorBase > *decor_key=nullptr) const
 create an accessor for the specified content of an AuxVectorBase.

Static Public Member Functions

static AccessorFactoryinstance ()

Private Member Functions

const IAccessorKitgetKit (SG::auxid_t auxid) const
 Get an auxiliary class which creates an accessor for the specified content.

Private Attributes

std::map< std::size_t, std::unique_ptr< IAccessorKit > > m_kits

Static Private Attributes

static CxxUtils::CachedUniquePtrT< AccessorFactory > s_instance ATLAS_THREAD_SAFE

Detailed Description

Class which creates accessors for the specified xAOD object content (singleton).

The accessors will either use xAOD accessor access or read decoration handles.

Definition at line 180 of file xAODAccessor.h.

Constructor & Destructor Documentation

◆ AccessorFactory()

ExpressionParsing::AccessorFactory::AccessorFactory ( )
inline

Definition at line 182 of file xAODAccessor.h.

182 {
183 m_kits.insert( std::make_pair(typeid(float).hash_code(), std::make_unique<AccessorKit<float,IProxyLoader::VT_VECDOUBLE> >()));
184 m_kits.insert( std::make_pair(typeid(double).hash_code(), std::make_unique<AccessorKit<double,IProxyLoader::VT_VECDOUBLE> >()));
185 m_kits.insert( std::make_pair(typeid(bool).hash_code(), std::make_unique<AccessorKit<bool,IProxyLoader::VT_VECINT> >()));
186 m_kits.insert( std::make_pair(typeid(unsigned char).hash_code(), std::make_unique<AccessorKit<unsigned char,IProxyLoader::VT_VECINT> >()));
187 m_kits.insert( std::make_pair(typeid(unsigned short).hash_code(), std::make_unique<AccessorKit<unsigned short,IProxyLoader::VT_VECINT> >()));
188 m_kits.insert( std::make_pair(typeid(unsigned int).hash_code(), std::make_unique<AccessorKit<unsigned int,IProxyLoader::VT_VECINT> >()));
189 m_kits.insert( std::make_pair(typeid(unsigned long).hash_code(), std::make_unique<AccessorKit<unsigned long,IProxyLoader::VT_VECINT> >())); // @TODO might get cropped if int interface is used
190 m_kits.insert( std::make_pair(typeid(char).hash_code(), std::make_unique<AccessorKit<char,IProxyLoader::VT_VECINT> >()));
191 m_kits.insert( std::make_pair(typeid(short).hash_code(), std::make_unique<AccessorKit<short,IProxyLoader::VT_VECINT> >()));
192 m_kits.insert( std::make_pair(typeid(int).hash_code(), std::make_unique<AccessorKit<int,IProxyLoader::VT_VECINT> >()));
193 m_kits.insert( std::make_pair(typeid(long).hash_code(), std::make_unique<AccessorKit<long,IProxyLoader::VT_VECINT> >())); // @TODO might get cropped if int interface is used
194 }
std::map< std::size_t, std::unique_ptr< IAccessorKit > > m_kits

Member Function Documentation

◆ create() [1/2]

std::unique_ptr< IAccessor > ExpressionParsing::AccessorFactory::create ( const SG::ReadHandleKey< SG::AuxElement > & key,
SG::auxid_t auxid,
const SG::ReadDecorHandleKey< SG::AuxElement > * decor_key = nullptr ) const
inline

create an accessor for the specified content of an AuxElement.

Definition at line 197 of file xAODAccessor.h.

199 {
200 return getKit(auxid).create(key,auxid, decor_key);
201 }
const IAccessorKit & getKit(SG::auxid_t auxid) const
Get an auxiliary class which creates an accessor for the specified content.
virtual std::unique_ptr< IAccessor > create(const SG::ReadHandleKey< SG::AuxVectorBase > &key, SG::auxid_t auxid, const SG::ReadDecorHandleKey< SG::AuxVectorBase > *decor_key=nullptr) const =0

◆ create() [2/2]

std::unique_ptr< IAccessor > ExpressionParsing::AccessorFactory::create ( const SG::ReadHandleKey< SG::AuxVectorBase > & key,
SG::auxid_t auxid,
const SG::ReadDecorHandleKey< SG::AuxVectorBase > * decor_key = nullptr ) const
inline

create an accessor for the specified content of an AuxVectorBase.

Definition at line 203 of file xAODAccessor.h.

205 {
206 return getKit(auxid).create(key,auxid, decor_key);
207 }

◆ getKit()

const IAccessorKit & ExpressionParsing::AccessorFactory::getKit ( SG::auxid_t auxid) const
inlineprivate

Get an auxiliary class which creates an accessor for the specified content.

Definition at line 213 of file xAODAccessor.h.

213 {
214 const std::type_info* the_type_info = SG::AuxTypeRegistry::instance().getType (auxid);
215 if (!the_type_info) {
216 std::stringstream msg;
217 msg << "ExpressionParsing::AccessorFactory: no type information about " << auxid
218 << " (" << SG::AuxTypeRegistry::instance().getName(auxid) << ")";
219 throw std::runtime_error(msg.str());
220 }
221 std::map<std::size_t, std::unique_ptr<IAccessorKit> >::const_iterator
222 iter = m_kits.find(the_type_info->hash_code());
223 if (iter == m_kits.end()) {
224 std::stringstream msg;
225 msg << "ExpressionParsing::AccessorFactory: no type information about " << auxid
226 << " (" << SG::AuxTypeRegistry::instance().getName(auxid) << ")";
227 throw std::runtime_error(msg.str());
228 }
229 return *(iter->second);
230 }
const std::type_info * getType(SG::auxid_t auxid) const
Return the type of an aux data item.
std::string getName(SG::auxid_t auxid) const
Return the name of an aux data item.
static AuxTypeRegistry & instance()
Return the singleton registry instance.
MsgStream & msg
Definition testRead.cxx:32

◆ instance()

Member Data Documentation

◆ ATLAS_THREAD_SAFE

◆ m_kits

std::map<std::size_t, std::unique_ptr<IAccessorKit> > ExpressionParsing::AccessorFactory::m_kits
private

Definition at line 231 of file xAODAccessor.h.


The documentation for this class was generated from the following file: