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 *ret=nullptr, std::vector< void * > const &values=std::vector< void * >()) const
 Call a static function. More...
 
void invoke (ObjectWithDict const &obj, ObjectWithDict *ret=nullptr, std::vector< void * > const &values=std::vector< void * >()) const
 Call a member 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.

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  }

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

Member Function Documentation

◆ begin()

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

Definition at line 98 of file FunctionWithDict.cc.

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

References function_.

◆ declaringType()

TypeWithDict edm::FunctionWithDict::declaringType ( ) const

Definition at line 50 of file FunctionWithDict.cc.

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

References function_.

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

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  }

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

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

◆ functionParameterSize()

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

Definition at line 64 of file FunctionWithDict.cc.

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

References function_, and writedatasetfile::required.

◆ invoke() [1/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.

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  }

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

◆ invoke() [2/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.

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  }

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

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

◆ isConst()

bool edm::FunctionWithDict::isConst ( ) const

Definition at line 52 of file FunctionWithDict.cc.

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

References function_.

◆ isConstructor()

bool edm::FunctionWithDict::isConstructor ( ) const

Definition at line 54 of file FunctionWithDict.cc.

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

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

Referenced by FunctionWithDict().

◆ isDestructor()

bool edm::FunctionWithDict::isDestructor ( ) const

Definition at line 56 of file FunctionWithDict.cc.

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

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

Referenced by FunctionWithDict().

◆ isOperator()

bool edm::FunctionWithDict::isOperator ( ) const

Definition at line 58 of file FunctionWithDict.cc.

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

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

◆ isPublic()

bool edm::FunctionWithDict::isPublic ( ) const

Definition at line 60 of file FunctionWithDict.cc.

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

References function_.

Referenced by FunctionWithDict().

◆ isStatic()

bool edm::FunctionWithDict::isStatic ( ) const

Definition at line 62 of file FunctionWithDict.cc.

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

References function_, and reco::parser::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.

71 { return function_->GetNargs(); }

References function_.

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

◆ typeName()

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

Definition at line 38 of file FunctionWithDict.cc.

38 { return function_->GetReturnTypeNormalizedName(); }

References function_.

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

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
runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:355
edm::FunctionWithDict::function_
TMethod * function_
Definition: FunctionWithDict.h:29
edm::TypeWithDict::byName
static TypeWithDict byName(std::string const &name)
Definition: TypeWithDict.cc:74
reco::parser::kIsOperator
Definition: ErrorCodes.h:39
cms::cuda::assert
assert(be >=bs)
TtSemiLepEvtBuilder_cfi.meth
meth
Definition: TtSemiLepEvtBuilder_cfi.py:59
edm::FunctionWithDict::isDestructor
bool isDestructor() const
Definition: FunctionWithDict.cc:56
reco::parser::kIsDestructor
Definition: ErrorCodes.h:38
contentValuesCheck.values
values
Definition: contentValuesCheck.py:38
getGTfromDQMFile.obj
obj
Definition: getGTfromDQMFile.py:32
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
edm::FunctionWithDict::funcptr_
TInterpreter::CallFuncIFacePtr_t funcptr_
Definition: FunctionWithDict.h:30
writedatasetfile.required
required
Definition: writedatasetfile.py:8
reco::parser::kIsStatic
Definition: ErrorCodes.h:34
edm::FunctionWithDict::isConstructor
bool isConstructor() const
Definition: FunctionWithDict.cc:54
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
reco::parser::kIsConstructor
Definition: ErrorCodes.h:37
edm::FunctionWithDict::isPublic
bool isPublic() const
Definition: FunctionWithDict.cc:60