CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 20 of file FunctionWithDict.cc.

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

Definition at line 23 of file FunctionWithDict.cc.

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

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

Member Function Documentation

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

Definition at line 132 of file FunctionWithDict.cc.

References function_.

132  {
133  if (function_ == nullptr) {
134  return IterWithDict<TMethodArg>();
135  }
136  return IterWithDict<TMethodArg>(function_->GetListOfMethodArgs());
137  }
TypeWithDict edm::FunctionWithDict::declaringType ( ) const

Definition at line 59 of file FunctionWithDict.cc.

References function_.

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

Definition at line 140 of file FunctionWithDict.cc.

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

Definition at line 48 of file FunctionWithDict.cc.

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

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

48  {
49  auto const& item = returnTypeMap.find(function_);
50  if(item != returnTypeMap.end()) {
51  return item->second;
52  }
53  TypeWithDict theType = TypeWithDict::byName(function_->GetReturnTypeNormalizedName());
54  returnTypeMap.insert(std::make_pair(function_, theType));
55  return theType;
56  }
static TypeWithDict byName(std::string const &name)
Definition: TypeWithDict.cc:60
size_t edm::FunctionWithDict::functionParameterSize ( bool  required = false) const

Definition at line 93 of file FunctionWithDict.cc.

References function_.

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

93  {
94  if (required) {
95  return function_->GetNargs() - function_->GetNargsOpt();
96  }
97  return function_->GetNargs();
98  }
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 107 of file FunctionWithDict.cc.

References edm::ObjectWithDict::address(), assert(), data, and funcptr_.

Referenced by reco::parser::MethodInvoker::invoke(), and ora::UniqueRefWriter::write().

108  {
109  void ** data = const_cast<void**>(values.data());
110  assert(funcptr_.fGeneric);
111  if (ret == nullptr) {
112  (*funcptr_.fGeneric)(obj.address(), values.size(), data, nullptr);
113  return;
114  }
115  (*funcptr_.fGeneric)(obj.address(), values.size(), data, ret->address());
116  }
assert(m_qm.get())
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 120 of file FunctionWithDict.cc.

References edm::ObjectWithDict::address(), assert(), data, and funcptr_.

121  {
122  void ** data = const_cast<void **>(values.data());
123  assert(funcptr_.fGeneric);
124  if (ret == nullptr) {
125  (*funcptr_.fGeneric)(nullptr, values.size(), data, nullptr);
126  return;
127  }
128  (*funcptr_.fGeneric)(nullptr, values.size(), data, ret->address());
129  }
assert(m_qm.get())
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
TInterpreter::CallFuncIFacePtr_t funcptr_
bool edm::FunctionWithDict::isConst ( ) const

Definition at line 64 of file FunctionWithDict.cc.

References function_.

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

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

Definition at line 79 of file FunctionWithDict.cc.

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

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

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

Definition at line 84 of file FunctionWithDict.cc.

References function_.

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

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

Definition at line 88 of file FunctionWithDict.cc.

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

Referenced by reco::checkMethod().

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

Definition at line 31 of file FunctionWithDict.cc.

31  {
32  if (function_ == nullptr) {
33  return false;
34  }
35  return function_->IsValid();
36  }
size_t edm::FunctionWithDict::size ( void  ) const

Definition at line 101 of file FunctionWithDict.cc.

References function_.

101  {
102  return function_->GetNargs();
103  }
std::string edm::FunctionWithDict::typeName ( ) const

Definition at line 43 of file FunctionWithDict.cc.

References function_.

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

43  {
44  return function_->GetReturnTypeNormalizedName();
45  }

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