|
ATLAS Offline Software
|
Go to the documentation of this file.
4 #ifndef _ExpressionEvaluation_MethodAccessor_h_
5 #define _ExpressionEvaluation_MethodAccessor_h_
15 #include "TMethodCall.h"
16 #include "TVirtualCollectionProxy.h"
17 #include "TFunction.h"
29 template <
class T_Cont,
typename T_src>
33 : m_methodCall( method_call),
37 assert( m_methodCall.call() !=
nullptr );
43 std::size_t
size(
const T_Cont &)
const {
48 T_src
get(
const T_Cont &)
const {
56 T_src
get(
const T_Cont &, std::size_t
idx)
const {
58 void *element_data=(*m_collectionProxy)[
idx];
59 m_methodCall.call()->Execute(element_data, ret);
69 : m_methodCall(std::move(method_call)),
90 template <
class T_Cont,
typename T_src>
94 : m_methodCall( method_call),
98 assert( m_methodCall.call() !=
nullptr );
101 std::size_t
size(
const T_Cont &cont)
const {
106 T_src
get(
const T_Cont &)
const {
109 m_methodCall.
call()->Execute(data_nc, ret);
114 T_src
get(
const T_Cont &, [[maybe_unused]] std::size_t
idx)
const {
118 m_methodCall.
call()->Execute(data_nc, ret);
150 TVirtualCollectionProxy *
proxy=
nullptr)
const = 0;
153 TVirtualCollectionProxy *
proxy=
nullptr)
const = 0;
158 template <
class T_src>
170 TVirtualCollectionProxy *
proxy)
const override {
172 std::stringstream
msg;
173 msg <<
"Cannot use method access of types SG::AuxVectorBase without a collection proxy.";
174 throw std::logic_error(
msg.str());
176 return createAccessor<SG::AuxVectorBase, VectorHelper>(
key,std::move(method_call),
proxy,
m_vectorType);
182 TVirtualCollectionProxy *
proxy=
nullptr)
const override {
192 template <
class T_Aux,
class T_ScalarVectorHelper>
195 TVirtualCollectionProxy *
proxy,
200 T_ScalarVectorHelper> >(
key,
207 T_ScalarVectorHelper> >(
key,
226 TVirtualCollectionProxy *
proxy=
nullptr)
const {
234 TVirtualCollectionProxy *
proxy=
nullptr)
const {
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());
250 return *(iter->second);
252 std::map<TMethodCall::EReturnType, std::unique_ptr<IMethodAccessorKit> >
m_kits;
Property holding a SG store/key/clid from which a ReadHandle is made.
char data[hepevt_bytes_allocation_ATLAS]
RootUtils::TSMethodCall m_methodCall ATLAS_THREAD_SAFE
const_pointer_type cptr()
Dereference the pointer.
std::size_t size(const T_Cont &cont) const
std::size_t size(const T_Cont &) const
ExpressionParsing::IProxyLoader::VariableType m_vectorType
const IMethodAccessorKit & getKit(RootUtils::TSMethodCall &method_call) const
Get an specific class which creates the accessor for the given method.
MethodHelper< T_Cont, T_src > create(const EventContext &, SG::ReadHandle< T_Cont > &handle) const
Class to create accessor which call methods of an AuxElement of an AuxVectorBase container (singleton...
Generic accessor to access xAOD object content.
CollectionMethodHelper< T_Cont, T_src > create(const EventContext &, SG::ReadHandle< T_Cont > &handle) const
std::unique_ptr< TVirtualCollectionProxy > m_collectionProxy
Property holding a SG store/key/clid from which a ReadHandle is made.
CollectionMethodHelper(const RootUtils::TSMethodCall &method_call, const TVirtualCollectionProxy &collection_proxy, const void *data, [[maybe_unused]] unsigned int n_elements)
std::map< TMethodCall::EReturnType, std::unique_ptr< IMethodAccessorKit > > m_kits
Helper for making a thread-safe function call.
ExpressionParsing::IProxyLoader::VariableType m_scalarType
std::unique_ptr< IAccessor > create(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.
Auxiliary class to create the corresponding auxiliary helper object.
RootUtils::TSMethodCall m_methodCall ATLAS_THREAD_SAFE
virtual std::unique_ptr< IAccessor > create(const SG::ReadHandleKey< SG::AuxElement > &key, RootUtils::TSMethodCall &&method_call, TVirtualCollectionProxy *proxy=nullptr) const =0
Kit(RootUtils::TSMethodCall &&method_call, TVirtualCollectionProxy &collection_proxy)
MethodHelper(const RootUtils::TSMethodCall &method_call, const void *data)
Namespace holding all the expression evaluation code.
const TVirtualCollectionProxy * m_collectionProxy
virtual std::unique_ptr< IAccessor > create(const SG::ReadHandleKey< SG::AuxVectorBase > &key, RootUtils::TSMethodCall &&method_call, TVirtualCollectionProxy *proxy) const override
create an accessor which called the specified method of an AuxVectorBase.
std::unique_ptr< IAccessor > createAccessor(const SG::ReadHandleKey< T_Aux > &key, RootUtils::TSMethodCall &&method_call, TVirtualCollectionProxy *proxy, ExpressionParsing::IProxyLoader::VariableType variable_type) const
Auxiliary class to handle method calls of vector containers (AuxVectorBase)
RootUtils::TSMethodCall m_methodCall ATLAS_THREAD_SAFE
T_src get(const T_Cont &, std::size_t idx) const
Get the specified element of the vector provided by the container.
T_src get(const T_Cont &) const
Get the scalar provided by the container.
RootUtils::TSMethodCall m_methodCall ATLAS_THREAD_SAFE
virtual std::unique_ptr< IAccessor > create(const SG::ReadHandleKey< SG::AuxElement > &key, RootUtils::TSMethodCall &&method_call, TVirtualCollectionProxy *proxy=nullptr) const override
create an accessor which called the specified method of an AuxElement.
TMethodCall * call()
Return a pointer to the thread-specific TMethodCall.
virtual ~IMethodAccessorKit()
Convert a type_info to a normalized string representation (matching the names used in the root dictio...
Auxiliary class to create the corresponding auxiliary helper object.
virtual std::unique_ptr< IAccessor > create(const SG::ReadHandleKey< SG::AuxVectorBase > &key, RootUtils::TSMethodCall &&method_call, TVirtualCollectionProxy *proxy=nullptr) const =0
std::size_t getContainerSize(const T &cont)
std::unique_ptr< IAccessor > create(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.
Auxiliary class to create a specific accessor which calls a method of an AuxElement or AuxVectorBase.
const SG::AuxVectorData * getVectorData(const T &cont)
Auxiliary class to handle method calls of "scalar" containers (AuxElement).
T_src get(const T_Cont &) const
Get the scalar provided by the container.
Handle class for reading from StoreGate.
MethodAccessorKit(ExpressionParsing::IProxyLoader::VariableType scalar_type, ExpressionParsing::IProxyLoader::VariableType vector_type)
Define macros for attributes used to control the static checker.
Kit(RootUtils::TSMethodCall &&method_call)
T_src get(const T_Cont &, [[maybe_unused]] std::size_t idx) const
Get the specified element of the vector provided by the container.