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

edm::FunctionWithDict::FunctionWithDict ( )

Definition at line 19 of file FunctionWithDict.cc.

19 : function_(nullptr) {}
edm::FunctionWithDict::FunctionWithDict ( TMethod *  meth)
explicit

Definition at line 21 of file FunctionWithDict.cc.

References funcptr_, isConstructor(), isDestructor(), and isPublic().

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  }
bool isConstructor() const
TInterpreter::CallFuncIFacePtr_t funcptr_
bool isDestructor() const

Member Function Documentation

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  }
TypeWithDict edm::FunctionWithDict::declaringType ( ) const

Definition at line 50 of file FunctionWithDict.cc.

References function_.

50 { return TypeWithDict(function_->GetClass()); }
IterWithDict< TMethodArg > edm::FunctionWithDict::end ( void  ) const

Definition at line 105 of file FunctionWithDict.cc.

105 { return IterWithDict<TMethodArg>(); }
TypeWithDict edm::FunctionWithDict::finalReturnType ( ) const

Definition at line 40 of file FunctionWithDict.cc.

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

Referenced by reco::parser::MethodInvoker::MethodInvoker(), reco::returnType(), and FWTableViewManager::tableFormats().

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
size_t edm::FunctionWithDict::functionParameterSize ( bool  required = false) const

Definition at line 64 of file FunctionWithDict.cc.

References function_.

Referenced by reco::checkMethod(), and FWTableViewManager::tableFormats().

64  {
65  if (required) {
66  return function_->GetNargs() - function_->GetNargsOpt();
67  }
68  return function_->GetNargs();
69  }
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 edm::ObjectWithDict::address(), data, and funcptr_.

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  }
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
TInterpreter::CallFuncIFacePtr_t funcptr_
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 edm::ObjectWithDict::address(), data, and funcptr_.

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  }
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
TInterpreter::CallFuncIFacePtr_t funcptr_
bool edm::FunctionWithDict::isConst ( ) const

Definition at line 52 of file FunctionWithDict.cc.

References function_.

Referenced by reco::checkMethod(), fireworks::OptionNode::fillOptionForType(), and FWTableViewManager::tableFormats().

52 { return function_->Property() & kIsConstMethod; }
bool edm::FunctionWithDict::isConstructor ( ) const
bool edm::FunctionWithDict::isDestructor ( ) const
bool edm::FunctionWithDict::isOperator ( ) const

Definition at line 58 of file FunctionWithDict.cc.

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

Referenced by fireworks::OptionNode::fillOptionForType().

58 { return function_->ExtraProperty() & kIsOperator; }
bool edm::FunctionWithDict::isPublic ( ) const

Definition at line 60 of file FunctionWithDict.cc.

References function_.

Referenced by reco::checkMethod(), fireworks::OptionNode::fillOptionForType(), FunctionWithDict(), and FWTableViewManager::tableFormats().

60 { return function_->Property() & kIsPublic; }
bool edm::FunctionWithDict::isStatic ( ) const

Definition at line 62 of file FunctionWithDict.cc.

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

Referenced by reco::checkMethod().

62 { return function_->Property() & kIsStatic; }
std::string edm::FunctionWithDict::name ( void  ) const
edm::FunctionWithDict::operator bool ( ) const
explicit

Definition at line 29 of file FunctionWithDict.cc.

References function_.

29  {
30  if (function_ == nullptr) {
31  return false;
32  }
33  return function_->IsValid();
34  }
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(); }
std::string edm::FunctionWithDict::typeName ( ) const

Definition at line 38 of file FunctionWithDict.cc.

References function_.

Referenced by fireworks::OptionNode::OptionNode(), and reco::parser::MethodInvoker::returnTypeName().

38 { return function_->GetReturnTypeNormalizedName(); }

Member Data Documentation

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

Definition at line 30 of file FunctionWithDict.h.

Referenced by FunctionWithDict(), and invoke().

TMethod* edm::FunctionWithDict::function_
private