CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
edm::FunctionWithDict Class Reference

#include <FunctionWithDict.h>

Public Member Functions

IterWithDict< TMethodArg > begin () const
 
TypeWithDict declaringType () const
 
IterWithDict< TMethodArg > end () const
 
TypeWithDict finalReturnType () const
 
size_t functionParameterSize (bool required=false) const
 
 FunctionWithDict ()
 
 FunctionWithDict (TMethod *)
 
void invoke (ObjectWithDict const &obj, ObjectWithDict *ret=nullptr, std::vector< void *> const &values=std::vector< void *>()) const
 Call a member function. More...
 
void invoke (ObjectWithDict *ret=nullptr, std::vector< void *> const &values=std::vector< void *>()) const
 Call a static function. More...
 
bool isConst () const
 
bool isConstructor () const
 
bool isDestructor () const
 
bool isOperator () const
 
bool isPublic () const
 
bool isStatic () const
 
std::string name () const
 
 operator bool () const
 
size_t size () const
 
std::string typeName () const
 

Private Attributes

TInterpreter::CallFuncIFacePtr_t funcptr_
 
TMethod * function_
 

Detailed Description

Definition at line 27 of file FunctionWithDict.h.

Constructor & Destructor Documentation

◆ FunctionWithDict() [1/2]

edm::FunctionWithDict::FunctionWithDict ( )

Definition at line 19 of file FunctionWithDict.cc.

19 : function_(nullptr) {}

◆ FunctionWithDict() [2/2]

edm::FunctionWithDict::FunctionWithDict ( TMethod *  meth)
explicit

Definition at line 21 of file FunctionWithDict.cc.

References funcptr_, isConstructor(), isDestructor(), isPublic(), and TtSemiLepEvtBuilder_cfi::meth.

21  : function_(meth) {
22  if (meth and isPublic() and not isDestructor() and not isConstructor()) {
23  TMethodCall caller(meth);
24  auto callFunc = caller.GetCallFunc();
25  funcptr_ = gInterpreter->CallFunc_IFacePtr(callFunc);
26  }
27  }
TInterpreter::CallFuncIFacePtr_t funcptr_

Member Function Documentation

◆ begin()

IterWithDict< TMethodArg > edm::FunctionWithDict::begin ( void  ) const

Definition at line 98 of file FunctionWithDict.cc.

References function_.

98  {
99  if (function_ == nullptr) {
100  return IterWithDict<TMethodArg>();
101  }
102  return IterWithDict<TMethodArg>(function_->GetListOfMethodArgs());
103  }

◆ declaringType()

TypeWithDict edm::FunctionWithDict::declaringType ( ) const

Definition at line 50 of file FunctionWithDict.cc.

References function_.

50 { return TypeWithDict(function_->GetClass()); }

◆ end()

IterWithDict< TMethodArg > edm::FunctionWithDict::end ( void  ) const

Definition at line 105 of file FunctionWithDict.cc.

105 { return IterWithDict<TMethodArg>(); }

◆ finalReturnType()

TypeWithDict edm::FunctionWithDict::finalReturnType ( ) const

Definition at line 40 of file FunctionWithDict.cc.

References edm::TypeWithDict::byName(), function_, and B2GTnPMonitor_cfi::item.

Referenced by reco::parser::MethodInvoker::MethodInvoker().

40  {
41  auto const& item = returnTypeMap.find(function_);
42  if (item != returnTypeMap.end()) {
43  return item->second;
44  }
45  TypeWithDict theType = TypeWithDict::byName(function_->GetReturnTypeNormalizedName());
46  returnTypeMap.insert(std::make_pair(function_, theType));
47  return theType;
48  }
static TypeWithDict byName(std::string const &name)
Definition: TypeWithDict.cc:74

◆ functionParameterSize()

size_t edm::FunctionWithDict::functionParameterSize ( bool  required = false) const

Definition at line 64 of file FunctionWithDict.cc.

References function_, and writedatasetfile::required.

64  {
65  if (required) {
66  return function_->GetNargs() - function_->GetNargsOpt();
67  }
68  return function_->GetNargs();
69  }

◆ invoke() [1/2]

void edm::FunctionWithDict::invoke ( ObjectWithDict const &  obj,
ObjectWithDict ret = nullptr,
std::vector< void *> const &  values = std::vector<void*>() 
) const

Call a member function.

Definition at line 74 of file FunctionWithDict.cc.

References cms::cuda::assert(), data, funcptr_, getGTfromDQMFile::obj, runTheMatrix::ret, and contentValuesCheck::values.

Referenced by reco::parser::MethodInvoker::invoke().

76  {
77  void** data = const_cast<void**>(values.data());
78  assert(funcptr_.fGeneric);
79  if (ret == nullptr) {
80  (*funcptr_.fGeneric)(obj.address(), values.size(), data, nullptr);
81  return;
82  }
83  (*funcptr_.fGeneric)(obj.address(), values.size(), data, ret->address());
84  }
ret
prodAgent to be discontinued
assert(be >=bs)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
TInterpreter::CallFuncIFacePtr_t funcptr_

◆ invoke() [2/2]

void edm::FunctionWithDict::invoke ( ObjectWithDict ret = nullptr,
std::vector< void *> const &  values = std::vector<void*>() 
) const

Call a static function.

Definition at line 87 of file FunctionWithDict.cc.

References cms::cuda::assert(), data, funcptr_, runTheMatrix::ret, and contentValuesCheck::values.

88  {
89  void** data = const_cast<void**>(values.data());
90  assert(funcptr_.fGeneric);
91  if (ret == nullptr) {
92  (*funcptr_.fGeneric)(nullptr, values.size(), data, nullptr);
93  return;
94  }
95  (*funcptr_.fGeneric)(nullptr, values.size(), data, ret->address());
96  }
ret
prodAgent to be discontinued
assert(be >=bs)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
TInterpreter::CallFuncIFacePtr_t funcptr_

◆ isConst()

bool edm::FunctionWithDict::isConst ( ) const

Definition at line 52 of file FunctionWithDict.cc.

References function_.

52 { return function_->Property() & kIsConstMethod; }

◆ isConstructor()

bool edm::FunctionWithDict::isConstructor ( ) const

Definition at line 54 of file FunctionWithDict.cc.

References function_, and reco::parser::kIsConstructor.

Referenced by FunctionWithDict().

54 { return function_->ExtraProperty() & kIsConstructor; }

◆ isDestructor()

bool edm::FunctionWithDict::isDestructor ( ) const

Definition at line 56 of file FunctionWithDict.cc.

References function_, and reco::parser::kIsDestructor.

Referenced by FunctionWithDict().

56 { return function_->ExtraProperty() & kIsDestructor; }

◆ isOperator()

bool edm::FunctionWithDict::isOperator ( ) const

Definition at line 58 of file FunctionWithDict.cc.

References function_, and reco::parser::kIsOperator.

58 { return function_->ExtraProperty() & kIsOperator; }

◆ isPublic()

bool edm::FunctionWithDict::isPublic ( ) const

Definition at line 60 of file FunctionWithDict.cc.

References function_.

Referenced by FunctionWithDict().

60 { return function_->Property() & kIsPublic; }

◆ isStatic()

bool edm::FunctionWithDict::isStatic ( ) const

Definition at line 62 of file FunctionWithDict.cc.

References function_, and reco::parser::kIsStatic.

62 { return function_->Property() & kIsStatic; }

◆ name()

std::string edm::FunctionWithDict::name ( void  ) const

◆ operator bool()

edm::FunctionWithDict::operator bool ( ) const
explicit

Definition at line 29 of file FunctionWithDict.cc.

29  {
30  if (function_ == nullptr) {
31  return false;
32  }
33  return function_->IsValid();
34  }

◆ size()

size_t edm::FunctionWithDict::size ( void  ) const

Definition at line 71 of file FunctionWithDict.cc.

References function_.

Referenced by ntupleDataFormat._Collection::__iter__(), and ntupleDataFormat._Collection::__len__().

71 { return function_->GetNargs(); }

◆ typeName()

std::string edm::FunctionWithDict::typeName ( ) const

Definition at line 38 of file FunctionWithDict.cc.

References function_.

Referenced by reco::parser::MethodInvoker::returnTypeName().

38 { return function_->GetReturnTypeNormalizedName(); }

Member Data Documentation

◆ funcptr_

TInterpreter::CallFuncIFacePtr_t edm::FunctionWithDict::funcptr_
private

Definition at line 30 of file FunctionWithDict.h.

Referenced by FunctionWithDict(), and invoke().

◆ function_

TMethod* edm::FunctionWithDict::function_
private