ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
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  }

◆ 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  }

◆ 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:
40  return IProxyLoader::VT_INT;
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:
SG::normalizedTypeinfoName
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...
Definition: normalizedTypeinfoName.cxx:120
SG::AuxElement
Base class for elements of a container that can have aux data.
Definition: AuxElement.h:446
CaloClusterListBadChannel.cls
cls
Definition: CaloClusterListBadChannel.py:8
ExpressionParsing::TMethodWrapper::ATLAS_THREAD_SAFE
RootUtils::TSMethodCall m_methodCall ATLAS_THREAD_SAFE
Definition: xAODVariableProxyLoaders.h:119
ExpressionParsing::IProxyLoader::VT_DOUBLE
@ VT_DOUBLE
Definition: IProxyLoader.h:21
ExpressionParsing::IProxyLoader::VT_UNK
@ VT_UNK
Definition: IProxyLoader.h:21
mc
Definition: mc.PG_single_nu_valid.py:1
ExpressionParsing::IProxyLoader::VT_INT
@ VT_INT
Definition: IProxyLoader.h:21
ExpressionParsing::TMethodWrapper::m_valid
bool m_valid
Definition: xAODVariableProxyLoaders.h:120