ATLAS Offline Software
Loading...
Searching...
No Matches
ExpressionParsing::TMethodWrapper Class Reference

#include <xAODVariableProxyLoaders.h>

Inheritance diagram for ExpressionParsing::TMethodWrapper:
Collaboration diagram for ExpressionParsing::TMethodWrapper:

Public Member Functions

 TMethodWrapper (const std::type_info &elementTypeinfo, const std::string &methodName)
 TMethodWrapper (const TMethodWrapper &)=delete
TMethodWrapperoperator= (const TMethodWrapper &)=delete
virtual ~TMethodWrapper ()
IProxyLoader::VariableType variableType ()
virtual bool isValid (const SG::AuxElement *auxElement) const
virtual bool isValid (const SG::AuxVectorData *auxVectorData) const
virtual int getIntValue (const SG::AuxElement *auxElement) const
virtual double getDoubleValue (const SG::AuxElement *auxElement) const
virtual std::vector< int > getVecIntValue (const SG::AuxVectorData *auxVectorData)
virtual std::vector< double > getVecDoubleValue (const SG::AuxVectorData *auxVectorData)

Private Attributes

RootUtils::TSMethodCall m_methodCall ATLAS_THREAD_SAFE
bool m_valid

Detailed Description

Definition at line 103 of file xAODVariableProxyLoaders.h.

Constructor & Destructor Documentation

◆ TMethodWrapper() [1/2]

ExpressionParsing::TMethodWrapper::TMethodWrapper ( const std::type_info & elementTypeinfo,
const std::string & methodName )

Definition at line 15 of file xAODVariableProxyLoaders.cxx.

17 : m_valid(false)
18 {
19 TClass *cls = TClass::GetClass(elementTypeinfo);
20 if (!cls) {
21 cls = TClass::GetClass(SG::normalizedTypeinfoName(elementTypeinfo).c_str());
22 if (!cls) return;
23 }
24
25 m_methodCall.setProto (cls, methodName, "");
26
27 m_valid = m_methodCall.call() != nullptr;
28 }
std::string normalizedTypeinfoName(const std::type_info &info)
Convert a type_info to a normalized string representation (matching the names used in the root dictio...

◆ TMethodWrapper() [2/2]

ExpressionParsing::TMethodWrapper::TMethodWrapper ( const TMethodWrapper & )
delete

◆ ~TMethodWrapper()

ExpressionParsing::TMethodWrapper::~TMethodWrapper ( )
virtual

Definition at line 30 of file xAODVariableProxyLoaders.cxx.

31 {
32 }

Member Function Documentation

◆ getDoubleValue()

double ExpressionParsing::TMethodWrapper::getDoubleValue ( const SG::AuxElement * auxElement) const
virtual

Implements ExpressionParsing::BaseAccessorWrapper.

Definition at line 68 of file xAODVariableProxyLoaders.cxx.

69 {
70 double retDouble;
71 auto aux_nc ATLAS_THREAD_SAFE = const_cast<SG::AuxElement*>(auxElement); // required by TMethodCall
72 m_methodCall.call()->Execute(aux_nc, retDouble);
73 return retDouble;
74 }
RootUtils::TSMethodCall m_methodCall ATLAS_THREAD_SAFE

◆ getIntValue()

int ExpressionParsing::TMethodWrapper::getIntValue ( const SG::AuxElement * auxElement) const
virtual

Implements ExpressionParsing::BaseAccessorWrapper.

Definition at line 60 of file xAODVariableProxyLoaders.cxx.

61 {
62 long retLong;
63 auto aux_nc ATLAS_THREAD_SAFE = const_cast<SG::AuxElement*>(auxElement); // required by TMethodCall
64 m_methodCall.call()->Execute(aux_nc, retLong);
65 return (int) retLong;
66 }

◆ getVecDoubleValue()

std::vector< double > ExpressionParsing::TMethodWrapper::getVecDoubleValue ( const SG::AuxVectorData * auxVectorData)
virtual

Implements ExpressionParsing::BaseAccessorWrapper.

Definition at line 81 of file xAODVariableProxyLoaders.cxx.

82 {
83 throw std::runtime_error("TMethodWrapper doesn't deal with containers");
84 }

◆ getVecIntValue()

std::vector< int > ExpressionParsing::TMethodWrapper::getVecIntValue ( const SG::AuxVectorData * auxVectorData)
virtual

Implements ExpressionParsing::BaseAccessorWrapper.

Definition at line 76 of file xAODVariableProxyLoaders.cxx.

77 {
78 throw std::runtime_error("TMethodWrapper doesn't deal with containers");
79 }

◆ isValid() [1/2]

bool ExpressionParsing::TMethodWrapper::isValid ( const SG::AuxElement * auxElement) const
virtual

Implements ExpressionParsing::BaseAccessorWrapper.

Definition at line 50 of file xAODVariableProxyLoaders.cxx.

51 {
52 return m_valid;
53 }

◆ isValid() [2/2]

bool ExpressionParsing::TMethodWrapper::isValid ( const SG::AuxVectorData * auxVectorData) const
virtual

Implements ExpressionParsing::BaseAccessorWrapper.

Definition at line 55 of file xAODVariableProxyLoaders.cxx.

56 {
57 return m_valid;
58 }

◆ operator=()

TMethodWrapper & ExpressionParsing::TMethodWrapper::operator= ( const TMethodWrapper & )
delete

◆ variableType()

IProxyLoader::VariableType ExpressionParsing::TMethodWrapper::variableType ( )

Definition at line 34 of file xAODVariableProxyLoaders.cxx.

35 {
36 TMethodCall* mc = m_methodCall.call();
37 if (!mc) return IProxyLoader::VT_UNK;
38 switch (mc->ReturnType()) {
39 case TMethodCall::kLong:
41 case TMethodCall::kDouble:
43 case TMethodCall::kString:
44 case TMethodCall::kOther:
45 case TMethodCall::kNone:
46 default: return IProxyLoader::VT_UNK;
47 }
48 }

Member Data Documentation

◆ ATLAS_THREAD_SAFE

RootUtils::TSMethodCall m_methodCall ExpressionParsing::TMethodWrapper::ATLAS_THREAD_SAFE
mutableprivate

Definition at line 119 of file xAODVariableProxyLoaders.h.

◆ m_valid

bool ExpressionParsing::TMethodWrapper::m_valid
private

Definition at line 120 of file xAODVariableProxyLoaders.h.


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