4#ifndef _ExpressionEvaluation_MethodAccessor_h_
5#define _ExpressionEvaluation_MethodAccessor_h_
17#include "TVirtualCollectionProxy.h"
31 template <
class T_Cont,
typename T_src>
35 const TVirtualCollectionProxy &collection_proxy,
37 [[maybe_unused]]
unsigned int n_elements)
46 std::size_t
size(
const T_Cont &)
const {
51 T_src
get(
const T_Cont &)
const {
58 T_src
get(
const T_Cont &, std::size_t idx)
const {
59 void *element_data=(*m_collectionProxy)[idx];
70 TVirtualCollectionProxy &collection_proxy)
93 template <
class T_Cont,
typename T_src>
103 std::size_t
size(
const T_Cont &cont)
const {
108 T_src
get(
const T_Cont &)
const {
115 T_src
get(
const T_Cont &, [[maybe_unused]] std::size_t idx)
const {
150 TVirtualCollectionProxy *proxy=
nullptr)
const = 0;
153 TVirtualCollectionProxy *proxy=
nullptr)
const = 0;
158 template <
class T_src>
170 TVirtualCollectionProxy *proxy)
const override {
172 const auto msg =
"Cannot use method access of types SG::AuxVectorBase without a collection proxy.";
173 throw std::logic_error(
msg);
181 TVirtualCollectionProxy *proxy=
nullptr)
const override {
191 template <
class T_Aux,
class T_ScalarVectorHelper>
194 TVirtualCollectionProxy *proxy,
199 T_ScalarVectorHelper> >(key,
208 T_ScalarVectorHelper> >(key,
218 template <
typename T>
219 static std::pair<std::string, std::pair<std::unique_ptr<IMethodAccessorKit>, TInterpreter::EReturnType> >
keyAndIntMethodKit() {
222 TInterpreter::EReturnType::kLong));
224 template <
typename T>
225 static std::pair<std::string, std::pair<std::unique_ptr<IMethodAccessorKit>, TInterpreter::EReturnType> >
keyAndDoubleMethodKit() {
228 TInterpreter::EReturnType::kDouble));
249 TVirtualCollectionProxy *proxy=
nullptr)
const {
250 return getKit(method_wrapper).
create(key,std::move(method_wrapper), proxy);
257 TVirtualCollectionProxy *proxy=
nullptr)
const {
258 return getKit(method_wrapper).
create(key,std::move(method_wrapper), proxy);
267 std::map<std::string, std::pair<std::unique_ptr<IMethodAccessorKit>, TInterpreter::EReturnType> >
::const_iterator
269 if (iter ==
m_kits.end()) {
270 const std::string amsg =
"ExpressionParsing::MethodAccessorFactory: no kit for return type " + method_wrapper.
getReturnTypeNormalizedName()
271 +
" wrapper " +
typeid(method_wrapper).name();
272 throw std::runtime_error(amsg);
274 return *(iter->second.first);
276 std::map<std::string, std::pair<std::unique_ptr<IMethodAccessorKit>, TInterpreter::EReturnType> >
m_kits;
char data[hepevt_bytes_allocation_ATLAS]
Property holding a SG store/key/clid from which a ReadHandle is made.
Handle class for reading from StoreGate.
Helper for thread-safe TMethodCall. Extracted from Type.
Define macros for attributes used to control the static checker.
Auxiliary class to create the corresponding auxiliary helper object.
CollectionMethodHelper< T_Cont, T_src > create(const EventContext &, SG::ReadHandle< T_Cont > &handle) const
Kit(RootUtils::ClingCallWrapper< T_src > &&method_wrapper, TVirtualCollectionProxy &collection_proxy)
RootUtils::ClingCallWrapper< T_src > m_methodWrapper
const TVirtualCollectionProxy * m_collectionProxy
std::unique_ptr< TVirtualCollectionProxy > m_collectionProxy
RootUtils::ClingCallWrapper< T_src > m_methodWrapper
T_src get(const T_Cont &) const
Get the scalar provided by the container.
std::size_t size(const T_Cont &) const
CollectionMethodHelper(const RootUtils::ClingCallWrapper< T_src > &method_wrapper, const TVirtualCollectionProxy &collection_proxy, const void *data, unsigned int n_elements)
T_src get(const T_Cont &, std::size_t idx) const
Get the specified element of the vector provided by the container.
Generic accessor to access xAOD object content.
virtual std::unique_ptr< IAccessor > create(const SG::ReadHandleKey< SG::AuxElement > &key, RootUtils::ClingCallWrapperUncheckedReturnValue<> &&method_wrapper, TVirtualCollectionProxy *proxy=nullptr) const =0
friend class MethodAccessorFactory
virtual ~IMethodAccessorKit()
virtual std::unique_ptr< IAccessor > create(const SG::ReadHandleKey< SG::AuxVectorBase > &key, RootUtils::ClingCallWrapperUncheckedReturnValue<> &&method_wrapper, TVirtualCollectionProxy *proxy=nullptr) const =0
Auxiliary class to create a specific accessor which calls a method of an AuxElement or AuxVectorBase.
virtual std::unique_ptr< IAccessor > create(const SG::ReadHandleKey< SG::AuxElement > &key, RootUtils::ClingCallWrapperUncheckedReturnValue<> &&method_wrapper, TVirtualCollectionProxy *proxy=nullptr) const override
create an accessor which called the specified method of an AuxElement.
ExpressionParsing::IAccessor::VariableType m_vectorType
virtual std::unique_ptr< IAccessor > create(const SG::ReadHandleKey< SG::AuxVectorBase > &key, RootUtils::ClingCallWrapperUncheckedReturnValue<> &&method_wrapper, TVirtualCollectionProxy *proxy) const override
create an accessor which called the specified method of an AuxVectorBase.
MethodAccessorKit(ExpressionParsing::IAccessor::VariableType scalar_type, ExpressionParsing::IAccessor::VariableType vector_type)
std::unique_ptr< IAccessor > createAccessor(const SG::ReadHandleKey< T_Aux > &key, RootUtils::ClingCallWrapperUncheckedReturnValue<> &&method_wrapper, TVirtualCollectionProxy *proxy, ExpressionParsing::IAccessor::VariableType variable_type) const
ExpressionParsing::IAccessor::VariableType m_scalarType
std::unique_ptr< IAccessor > create(const SG::ReadHandleKey< SG::AuxElement > &key, RootUtils::ClingCallWrapperUncheckedReturnValue<> &&method_wrapper, TVirtualCollectionProxy *proxy=nullptr) const
Create an accessor which calls the specified method of an AuxElement.
std::map< std::string, std::pair< std::unique_ptr< IMethodAccessorKit >, TInterpreter::EReturnType > > m_kits
static std::pair< std::string, std::pair< std::unique_ptr< IMethodAccessorKit >, TInterpreter::EReturnType > > keyAndIntMethodKit()
std::unique_ptr< IAccessor > create(const SG::ReadHandleKey< SG::AuxVectorBase > &key, RootUtils::ClingCallWrapperUncheckedReturnValue<> &&method_wrapper, TVirtualCollectionProxy *proxy=nullptr) const
Create an accessor which calls the specified method of an AuxVectorBase.
const IMethodAccessorKit & getKit(const RootUtils::ClingCallWrapperUncheckedReturnValue<> &method_wrapper) const
Get an specific class which creates the accessor for the given method.
static std::pair< std::string, std::pair< std::unique_ptr< IMethodAccessorKit >, TInterpreter::EReturnType > > keyAndDoubleMethodKit()
Auxiliary class to create the corresponding auxiliary helper object.
MethodHelper< T_Cont, T_src > create(const EventContext &, SG::ReadHandle< T_Cont > &handle) const
RootUtils::ClingCallWrapper< T_src > m_methodWrapper
Kit(RootUtils::ClingCallWrapper< T_src > &&method_wrapper)
T_src get(const T_Cont &) const
Get the scalar provided by the container.
MethodHelper(const RootUtils::ClingCallWrapper< T_src > &method_wrapper, const void *data)
RootUtils::ClingCallWrapper< T_src > m_methodWrapper
std::size_t size(const T_Cont &cont) const
T_src get(const T_Cont &, std::size_t idx) const
Get the specified element of the vector provided by the container.
Intermediate helper class wrapping a cling method call with arbitrary return type.
std::string getReturnTypeNormalizedName() const
the normalized name of the function return type.
Helper class to wrap a cling method call of an object's method with defined return type and argument ...
Property holding a SG store/key/clid from which a ReadHandle is made.
const_pointer_type cptr()
Dereference the pointer.
Namespace holding all the expression evaluation code.
const SG::AuxVectorData * getVectorData(const T &cont)
CxxUtils::CachedUniquePtrT< T_Derived > Singleton< T_Derived >::s_instance ATLAS_THREAD_SAFE
std::size_t getContainerSize(const T &cont)
ClingCallWrapper< T_ReturnValue, T_MethodArgs... > getClingCallWrapperChecked(ClingCallWrapperUncheckedReturnValue< T_MethodArgs... > &&call_wrapper)
wrap a cling method call for a method with defined arguments and return types.
std::string getNormalizedTypeName()
Convert a type_info to a normalized string representation (matching the names used in the root dictio...