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 181 of file xAODAccessor.h.

Constructor & Destructor Documentation

◆ AccessorFactory()

ExpressionParsing::AccessorFactory::AccessorFactory ( )
inline

Definition at line 183 of file xAODAccessor.h.

183 {
184 m_kits.insert( std::make_pair(typeid(float).hash_code(), std::make_unique<AccessorKit<float,IProxyLoader::VT_VECDOUBLE> >()));
185 m_kits.insert( std::make_pair(typeid(double).hash_code(), std::make_unique<AccessorKit<double,IProxyLoader::VT_VECDOUBLE> >()));
186 m_kits.insert( std::make_pair(typeid(bool).hash_code(), std::make_unique<AccessorKit<bool,IProxyLoader::VT_VECINT> >()));
187 m_kits.insert( std::make_pair(typeid(unsigned char).hash_code(), std::make_unique<AccessorKit<unsigned char,IProxyLoader::VT_VECINT> >()));
188 m_kits.insert( std::make_pair(typeid(unsigned short).hash_code(), std::make_unique<AccessorKit<unsigned short,IProxyLoader::VT_VECINT> >()));
189 m_kits.insert( std::make_pair(typeid(unsigned int).hash_code(), std::make_unique<AccessorKit<unsigned int,IProxyLoader::VT_VECINT> >()));
190 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
191 m_kits.insert( std::make_pair(typeid(char).hash_code(), std::make_unique<AccessorKit<char,IProxyLoader::VT_VECINT> >()));
192 m_kits.insert( std::make_pair(typeid(short).hash_code(), std::make_unique<AccessorKit<short,IProxyLoader::VT_VECINT> >()));
193 m_kits.insert( std::make_pair(typeid(int).hash_code(), std::make_unique<AccessorKit<int,IProxyLoader::VT_VECINT> >()));
194 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
195 }
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 198 of file xAODAccessor.h.

200 {
201 return getKit(auxid).create(key,auxid, decor_key);
202 }
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 204 of file xAODAccessor.h.

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

◆ 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 214 of file xAODAccessor.h.

214 {
215 const std::type_info* the_type_info = SG::AuxTypeRegistry::instance().getType (auxid);
216 if (!the_type_info) {
217 std::stringstream msg;
218 msg << "ExpressionParsing::AccessorFactory: no type information about " << auxid
219 << " (" << SG::AuxTypeRegistry::instance().getName(auxid) << ")";
220 throw std::runtime_error(msg.str());
221 }
222 std::map<std::size_t, std::unique_ptr<IAccessorKit> >::const_iterator
223 iter = m_kits.find(the_type_info->hash_code());
224 if (iter == m_kits.end()) {
225 std::stringstream msg;
226 msg << "ExpressionParsing::AccessorFactory: no type information about " << auxid
227 << " (" << SG::AuxTypeRegistry::instance().getName(auxid) << ")";
228 throw std::runtime_error(msg.str());
229 }
230 return *(iter->second);
231 }
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 232 of file xAODAccessor.h.


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