ATLAS Offline Software
Loading...
Searching...
No Matches
RootUtils::ClingCallWrapper< T_ReturnValue, T_MethodArgs > Class Template Reference

Helper class to wrap a cling method call of an object's method with defined return type and argument list. More...

#include <ClingCallWrapper.h>

Inheritance diagram for RootUtils::ClingCallWrapper< T_ReturnValue, T_MethodArgs >:
Collaboration diagram for RootUtils::ClingCallWrapper< T_ReturnValue, T_MethodArgs >:

Public Member Functions

T_ReturnValue operator() (const void *object, T_MethodArgs...args) const
 call the wrapped cling method.

Protected Member Functions

 ClingCallWrapper (ClingCallWrapperUncheckedReturnValue< T_MethodArgs... > &&call_wrapper)
 create a cling method wrapper for a method with defined argument list and return type (move).
 ClingCallWrapper (const ClingCallWrapperUncheckedReturnValue< T_MethodArgs... > &call_wrapper)
 create a cling method wrapper for a method with defined argument list and return type (copy).

Private Types

using TClingCallFuncWrapper_t

Private Member Functions

T_ReturnType call (const void *object, T_MethodArgs...args) const
bool isReturnTypeMatching () const
 Test whether the function return type and the template parameter are the same.
std::string getReturnTypeNormalizedName () const
 the normalized name of the function return type.

Private Attributes

TClingCallFuncWrapper_t m_methodWrapper
const TMethod * m_method
TMethodCall::EReturnType m_returnType

Friends

template<typename T_ReturnValueFunc, typename ... T_MethodArgsFunc>
ClingCallWrapper< T_ReturnValueFunc, T_MethodArgsFunc... > getClingCallWrapperChecked (ClingCallWrapperUncheckedReturnValue< T_MethodArgsFunc... > &&call_wrapper)

Detailed Description

template<typename T_ReturnValue, typename ... T_MethodArgs>
class RootUtils::ClingCallWrapper< T_ReturnValue, T_MethodArgs >

Helper class to wrap a cling method call of an object's method with defined return type and argument list.

Template Parameters
T_ReturnValuethe type of the return value
..T_MethofArgsthe types of the method argument (excluding the this pointer)

Definition at line 103 of file ClingCallWrapper.h.

Member Typedef Documentation

◆ TClingCallFuncWrapper_t

using RootUtils::ClingCallWrapperUncheckedReturnValue< T_MethodArgs >::TClingCallFuncWrapper_t
protectedinherited

Definition at line 63 of file ClingCallWrapper.h.

Constructor & Destructor Documentation

◆ ClingCallWrapper() [1/2]

template<typename T_ReturnValue, typename ... T_MethodArgs>
RootUtils::ClingCallWrapper< T_ReturnValue, T_MethodArgs >::ClingCallWrapper ( ClingCallWrapperUncheckedReturnValue< T_MethodArgs... > && call_wrapper)
inlineprotected

create a cling method wrapper for a method with defined argument list and return type (move).

Definition at line 110 of file ClingCallWrapper.h.

112 {}
ClingCallWrapperUncheckedReturnValue(TClingCallFuncWrapper_t method_wrapper, const TMethod *method)
Helper class to wrap a cling method call of an object's method with defined return type and argument ...

◆ ClingCallWrapper() [2/2]

template<typename T_ReturnValue, typename ... T_MethodArgs>
RootUtils::ClingCallWrapper< T_ReturnValue, T_MethodArgs >::ClingCallWrapper ( const ClingCallWrapperUncheckedReturnValue< T_MethodArgs... > & call_wrapper)
inlineprotected

create a cling method wrapper for a method with defined argument list and return type (copy).

Definition at line 114 of file ClingCallWrapper.h.

Member Function Documentation

◆ call()

T_ReturnType RootUtils::ClingCallWrapperUncheckedReturnValue< T_MethodArgs >::call ( const void * object,
T_MethodArgs... args ) const
inlineprotectedinherited

Definition at line 70 of file ClingCallWrapper.h.

70 {
72 std::array<void *, sizeof...(args)> arg_list{getPtr<T_MethodArgs>(args)...};
73
74 // it was already checked that the method is declared const
75 // the interface however requires a non const void pointer to the object independent of
76 // of the method being const or non-const.
77 void *non_const_obj ATLAS_THREAD_SAFE=const_cast<void *>(object);
79 return return_value;
80 }
Intermediate helper class wrapping a cling method call with arbitrary return type.
constexpr auto getPtr(typename std::remove_reference< T >::type &arg) noexcept

◆ getReturnTypeNormalizedName()

std::string RootUtils::ClingCallWrapperUncheckedReturnValue< T_MethodArgs >::getReturnTypeNormalizedName ( ) const
inlineinherited

the normalized name of the function return type.

Definition at line 90 of file ClingCallWrapper.h.

90 {
91 return m_method->GetReturnTypeNormalizedName();
92 }

◆ isReturnTypeMatching()

bool RootUtils::ClingCallWrapperUncheckedReturnValue< T_MethodArgs >::isReturnTypeMatching ( ) const
inlineinherited

Test whether the function return type and the template parameter are the same.

Returns
true if the template parameter and the return type are the same.

Definition at line 85 of file ClingCallWrapper.h.

85 {
86 return ROOT::Internal::GetDemangledTypeName(typeid(T_ReturnType)) == m_method->GetReturnTypeNormalizedName();
87 }

◆ operator()()

template<typename T_ReturnValue, typename ... T_MethodArgs>
T_ReturnValue RootUtils::ClingCallWrapper< T_ReturnValue, T_MethodArgs >::operator() ( const void * object,
T_MethodArgs... args ) const
inline

call the wrapped cling method.

Parameters
objectthe this pointer to an object which matches the TClass used to create the call_wrapper.
...argsthe arguments pass to the method call.
Returns
the return value of the called method.
Note
the object type is unchecked. If the pointer does not match the TClass that

Definition at line 124 of file ClingCallWrapper.h.

124 {
125 return this->template call<T_ReturnValue>(object, args...);
126 }
T_ReturnType call(const void *object, T_MethodArgs...args) const

◆ getClingCallWrapperChecked

template<typename T_ReturnValue, typename ... T_MethodArgs>
template<typename T_ReturnValueFunc, typename ... T_MethodArgsFunc>
ClingCallWrapper< T_ReturnValueFunc, T_MethodArgsFunc... > getClingCallWrapperChecked ( ClingCallWrapperUncheckedReturnValue< T_MethodArgsFunc... > && call_wrapper)
friend

Member Data Documentation

◆ m_method

const TMethod* RootUtils::ClingCallWrapperUncheckedReturnValue< T_MethodArgs >::m_method
privateinherited

Definition at line 95 of file ClingCallWrapper.h.

◆ m_methodWrapper

TClingCallFuncWrapper_t RootUtils::ClingCallWrapperUncheckedReturnValue< T_MethodArgs >::m_methodWrapper
privateinherited

Definition at line 94 of file ClingCallWrapper.h.

◆ m_returnType

TMethodCall::EReturnType RootUtils::ClingCallWrapperUncheckedReturnValue< T_MethodArgs >::m_returnType
privateinherited

Definition at line 96 of file ClingCallWrapper.h.

96{};

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