ATLAS Offline Software
Loading...
Searching...
No Matches
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.
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.

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.

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 }
Auxiliary class to create a specific accessor which calls a method of an AuxElement or AuxVectorBase.
std::map< TMethodCall::EReturnType, std::unique_ptr< IMethodAccessorKit > > m_kits

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 }
virtual std::unique_ptr< IAccessor > create(const SG::ReadHandleKey< SG::AuxVectorBase > &key, RootUtils::TSMethodCall &&method_call, TVirtualCollectionProxy *proxy=nullptr) const =0
const IMethodAccessorKit & getKit(RootUtils::TSMethodCall &method_call) const
Get an specific class which creates the accessor for the given method.

◆ 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 }
TMethodCall * call()
Return a pointer to the thread-specific TMethodCall.
MsgStream & msg
Definition testRead.cxx:32

◆ instance()

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: