ATLAS Offline Software
Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
ExpressionParsing::MethodAccessorFactory Class Reference

Class to create accessor which call methods of an AuxElement of an AuxVectorBase container (singleton). More...

#include <MethodAccessor.h>

Inheritance diagram for ExpressionParsing::MethodAccessorFactory:
Collaboration diagram for ExpressionParsing::MethodAccessorFactory:

Classes

class  IMethodAccessorKit
 
class  MethodAccessorKit
 Auxiliary class to create a specific accessor which calls a method of an AuxElement or AuxVectorBase. More...
 

Public Member Functions

 MethodAccessorFactory ()
 
std::unique_ptr< IAccessorcreate (const SG::ReadHandleKey< SG::AuxElement > &key, RootUtils::TSMethodCall &&method_call, TVirtualCollectionProxy *proxy=nullptr) const
 Create an accessor which calls the specified method of an AuxElement. More...
 
std::unique_ptr< IAccessorcreate (const SG::ReadHandleKey< SG::AuxVectorBase > &key, RootUtils::TSMethodCall &&method_call, TVirtualCollectionProxy *proxy=nullptr) const
 Create an accessor which calls the specified method of an AuxVectorBase. More...
 

Static Public Member Functions

static MethodAccessorFactoryinstance ()
 

Private Member Functions

const IMethodAccessorKitgetKit (RootUtils::TSMethodCall &method_call) const
 Get an specific class which creates the accessor for the given method. More...
 

Private Attributes

std::map< TMethodCall::EReturnType, std::unique_ptr< IMethodAccessorKit > > m_kits
 

Static Private Attributes

static CxxUtils::CachedUniquePtrT< MethodAccessorFactory > s_instance ATLAS_THREAD_SAFE
 

Detailed Description

Class to create accessor which call methods of an AuxElement of an AuxVectorBase container (singleton).

Definition at line 142 of file MethodAccessor.h.

Constructor & Destructor Documentation

◆ MethodAccessorFactory()

ExpressionParsing::MethodAccessorFactory::MethodAccessorFactory ( )
inline

Definition at line 217 of file MethodAccessor.h.

217  {
218  m_kits.insert( std::make_pair(TInterpreter::EReturnType::kLong,std::make_unique<MethodAccessorKit<long> >(IProxyLoader::VT_INT,IProxyLoader::VT_VECINT)));
219  m_kits.insert( std::make_pair(TInterpreter::EReturnType::kDouble,std::make_unique<MethodAccessorKit<double> >(IProxyLoader::VT_DOUBLE, IProxyLoader::VT_VECDOUBLE)));
220  }

Member Function Documentation

◆ create() [1/2]

std::unique_ptr<IAccessor> ExpressionParsing::MethodAccessorFactory::create ( const SG::ReadHandleKey< SG::AuxElement > &  key,
RootUtils::TSMethodCall &&  method_call,
TVirtualCollectionProxy *  proxy = nullptr 
) const
inline

Create an accessor which calls the specified method of an AuxElement.

Definition at line 224 of file MethodAccessor.h.

226  {
227  return getKit(method_call).create(key,std::move(method_call), proxy);
228  }

◆ create() [2/2]

std::unique_ptr<IAccessor> ExpressionParsing::MethodAccessorFactory::create ( const SG::ReadHandleKey< SG::AuxVectorBase > &  key,
RootUtils::TSMethodCall &&  method_call,
TVirtualCollectionProxy *  proxy = nullptr 
) const
inline

Create an accessor which calls the specified method of an AuxVectorBase.

Definition at line 232 of file MethodAccessor.h.

234  {
235  return getKit(method_call).create(key,std::move(method_call), proxy);
236  }

◆ getKit()

const IMethodAccessorKit& ExpressionParsing::MethodAccessorFactory::getKit ( RootUtils::TSMethodCall method_call) const
inlineprivate

Get an specific class which creates the accessor for the given method.

Definition at line 242 of file MethodAccessor.h.

242  {
243  std::map<TMethodCall::EReturnType, std::unique_ptr<IMethodAccessorKit> >::const_iterator
244  iter = m_kits.find(method_call.call()->ReturnType());
245  if (iter == m_kits.end()) {
246  std::stringstream msg;
247  msg << "ExpressionParsing::MethodAccessorFactory: no kit for return type " << method_call.call()->GetMethod()->GetReturnTypeNormalizedName ();
248  throw std::runtime_error(msg.str());
249  }
250  return *(iter->second);
251  }

◆ instance()

static MethodAccessorFactory & ExpressionParsing::Singleton< MethodAccessorFactory >::instance
inlinestaticinherited

Definition at line 90 of file PhysicsAnalysis/CommonTools/ExpressionEvaluation/src/Utils.h.

90  {
91  if (!s_instance) {
92  s_instance.set(std::make_unique<T_Derived>());
93  }
94  return *s_instance;
95  }

Member Data Documentation

◆ ATLAS_THREAD_SAFE

◆ m_kits

std::map<TMethodCall::EReturnType, std::unique_ptr<IMethodAccessorKit> > ExpressionParsing::MethodAccessorFactory::m_kits
private

Definition at line 252 of file MethodAccessor.h.


The documentation for this class was generated from the following file:
StateLessPT_NewConfig.proxy
proxy
Definition: StateLessPT_NewConfig.py:392
make_unique
std::unique_ptr< T > make_unique(Args &&... args)
Definition: SkimmingToolEXOT5.cxx:23
ExpressionParsing::MethodAccessorFactory::getKit
const IMethodAccessorKit & getKit(RootUtils::TSMethodCall &method_call) const
Get an specific class which creates the accessor for the given method.
Definition: MethodAccessor.h:242
ExpressionParsing::IProxyLoader::VT_VECDOUBLE
@ VT_VECDOUBLE
Definition: IProxyLoader.h:21
ExpressionParsing::MethodAccessorFactory::m_kits
std::map< TMethodCall::EReturnType, std::unique_ptr< IMethodAccessorKit > > m_kits
Definition: MethodAccessor.h:252
ExpressionParsing::IProxyLoader::VT_DOUBLE
@ VT_DOUBLE
Definition: IProxyLoader.h:21
ExpressionParsing::IProxyLoader::VT_VECINT
@ VT_VECINT
Definition: IProxyLoader.h:21
RootUtils::TSMethodCall::call
TMethodCall * call()
Return a pointer to the thread-specific TMethodCall.
Definition: TSMethodCall.cxx:109
ExpressionParsing::IProxyLoader::VT_INT
@ VT_INT
Definition: IProxyLoader.h:21
ExpressionParsing::MethodAccessorFactory::IMethodAccessorKit::create
virtual std::unique_ptr< IAccessor > create(const SG::ReadHandleKey< SG::AuxVectorBase > &key, RootUtils::TSMethodCall &&method_call, TVirtualCollectionProxy *proxy=nullptr) const =0
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37