Emulation of the CINT CallFunc class.
The CINT C++ interpreter provides an interface for calling functions through the generated wrappers in dictionaries with the CallFunc class. This class provides the same functionality, using an interface as close as possible to CallFunc but the function metadata and calling service comes from the Cling C++ interpreter and the Clang C++ compiler, not CINT.
Definition at line 57 of file TClingCallFunc.h.
Public Member Functions | |
TClingCallFunc (cling::Interpreter *interp, const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt) | |
TClingCallFunc (const TClingCallFunc &rhs) | |
TClingCallFunc (const TClingMethodInfo &minfo, const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt) | |
~TClingCallFunc ()=default | |
void | Exec (void *address, TInterpreterValue *interpVal=0) |
void * | ExecDefaultConstructor (const TClingClassInfo *info, void *address=0, unsigned long nary=0UL) |
void | ExecDestructor (const TClingClassInfo *info, void *address=0, unsigned long nary=0UL, bool withFree=true) |
double | ExecDouble (void *address) |
long | ExecInt (void *address) |
long long | ExecInt64 (void *address) |
void | ExecWithArgsAndReturn (void *address, const void *args[]=0, int nargs=0, void *ret=0) |
void | ExecWithReturn (void *address, void *ret=0) |
TClingMethodInfo * | FactoryMethod () const |
int | get_wrapper_code (std::string &wrapper_name, std::string &wrapper) |
const clang::FunctionDecl * | GetDecl () |
const clang::FunctionDecl * | GetDecl () const |
TInterpreter::CallFuncIFacePtr_t | IFacePtr () |
void | IgnoreExtraArgs (bool ignore) |
void | Init () |
void | Init (const TClingMethodInfo &) |
void | Init (std::unique_ptr< TClingMethodInfo >) |
template<class T > | |
TClingCallFunc::ExecWithRetFunc_t | InitRetAndExecIntegral (QualType QT, cling::Value &ret) |
void * | InterfaceMethod () |
void | Invoke (cling::Value *result=0) const |
bool | IsValid () const |
TClingCallFunc & | operator= (const TClingCallFunc &rhs)=delete |
void | ResetArg () |
void | SetArg (double arg) |
void | SetArg (float arg) |
void | SetArg (long arg) |
void | SetArg (long long arg) |
void | SetArg (unsigned long arg) |
void | SetArg (unsigned long long arg) |
void | SetArgArray (long *argArr, int narg) |
void | SetArgs (const char *args) |
void | SetFunc (const TClingClassInfo *info, const char *method, const char *arglist, bool objectIsConst, long *poffset) |
void | SetFunc (const TClingClassInfo *info, const char *method, const char *arglist, long *poffset) |
void | SetFunc (const TClingMethodInfo *info) |
void | SetFuncProto (const TClingClassInfo *info, const char *method, const char *proto, bool objectIsConst, long *poffset, ROOT::EFunctionMatchMode mode=ROOT::kConversionMatch) |
void | SetFuncProto (const TClingClassInfo *info, const char *method, const char *proto, long *poffset, ROOT::EFunctionMatchMode mode=ROOT::kConversionMatch) |
void | SetFuncProto (const TClingClassInfo *info, const char *method, const llvm::SmallVectorImpl< clang::QualType > &proto, bool objectIsConst, long *poffset, ROOT::EFunctionMatchMode mode=ROOT::kConversionMatch) |
void | SetFuncProto (const TClingClassInfo *info, const char *method, const llvm::SmallVectorImpl< clang::QualType > &proto, long *poffset, ROOT::EFunctionMatchMode mode=ROOT::kConversionMatch) |
Private Types | |
enum | EReferenceType { kNotReference , kLValueReference , kRValueReference } |
using | ExecWithRetFunc_t = std::function< void(void *address, cling::Value &ret)> |
Private Member Functions | |
size_t | CalculateMinRequiredArguments () |
void | collect_type_info (clang::QualType &QT, std::ostringstream &typedefbuf, std::ostringstream &callbuf, std::string &type_name, EReferenceType &refType, bool &isPointer, int indent_level, bool forArgument) |
void * | compile_wrapper (const std::string &wrapper_name, const std::string &wrapper, bool withAccessControl=true) |
void | EvaluateArgList (const std::string &ArgList) |
void | exec (void *address, void *ret) |
void | exec_with_valref_return (void *address, cling::Value *ret) |
template<typename T > | |
T | ExecT (void *address) |
template<typename T > | |
void | execWithLL (void *address, cling::Value *val) |
template<typename T > | |
void | execWithULL (void *address, cling::Value *val) |
size_t | GetMinRequiredArguments () |
ExecWithRetFunc_t | InitRetAndExec (const clang::FunctionDecl *FD, cling::Value &ret) |
ExecWithRetFunc_t | InitRetAndExecBuiltin (clang::QualType QT, const clang::BuiltinType *BT, cling::Value &ret) |
template<class T > | |
ExecWithRetFunc_t | InitRetAndExecIntegral (clang::QualType QT, cling::Value &ret) |
ExecWithRetFunc_t | InitRetAndExecNoCtor (clang::QualType QT, cling::Value &ret) |
tcling_callfunc_ctor_Wrapper_t | make_ctor_wrapper (const TClingClassInfo *info) |
tcling_callfunc_dtor_Wrapper_t | make_dtor_wrapper (const TClingClassInfo *info) |
void | make_narg_call (const std::string &return_type, const unsigned N, std::ostringstream &typedefbuf, std::ostringstream &callbuf, const std::string &class_name, int indent_level) |
void | make_narg_call_with_return (const unsigned N, const std::string &class_name, std::ostringstream &buf, int indent_level) |
void | make_narg_ctor (const unsigned N, std::ostringstream &typedefbuf, std::ostringstream &callbuf, const std::string &class_name, int indent_level) |
void | make_narg_ctor_with_return (const unsigned N, const std::string &class_name, std::ostringstream &buf, int indent_level) |
tcling_callfunc_Wrapper_t | make_wrapper () |
Private Attributes | |
llvm::SmallVector< cling::Value, 8 > | fArgVals |
Stored function arguments, we own. More... | |
const clang::FunctionDecl * | fDecl = nullptr |
Decl for the method. More... | |
bool | fIgnoreExtraArgs: 1 |
If true, do not limit number of function arguments to declared number. More... | |
cling::Interpreter * | fInterp |
Cling interpreter, we do not own. More... | |
std::unique_ptr< TClingMethodInfo > | fMethod |
Current method, we own. More... | |
size_t | fMinRequiredArguments = -1 |
Number of required arguments. More... | |
const ROOT::TMetaUtils::TNormalizedCtxt & | fNormCtxt |
ROOT normalized context for that interpreter. More... | |
bool | fReturnIsRecordType: 1 |
tcling_callfunc_Wrapper_t | fWrapper |
Pointer to compiled wrapper, we do not own. More... | |
|
private |
Definition at line 86 of file TClingCallFunc.h.
|
private |
Enumerator | |
---|---|
kNotReference | |
kLValueReference | |
kRValueReference |
Definition at line 80 of file TClingCallFunc.h.
|
default |
|
inlineexplicit |
Definition at line 155 of file TClingCallFunc.h.
|
inlineexplicit |
Definition at line 161 of file TClingCallFunc.h.
|
inline |
Definition at line 169 of file TClingCallFunc.h.
|
private |
Definition at line 260 of file TClingCallFunc.cxx.
|
private |
Definition at line 273 of file TClingCallFunc.cxx.
|
private |
Definition at line 266 of file TClingCallFunc.cxx.
|
private |
Definition at line 2002 of file TClingCallFunc.cxx.
void TClingCallFunc::Exec | ( | void * | address, |
TInterpreterValue * | interpVal = 0 |
||
) |
Definition at line 2026 of file TClingCallFunc.cxx.
Definition at line 1465 of file TClingCallFunc.cxx.
Definition at line 1983 of file TClingCallFunc.cxx.
void * TClingCallFunc::ExecDefaultConstructor | ( | const TClingClassInfo * | info, |
void * | address = 0 , |
||
unsigned long | nary = 0UL |
||
) |
Definition at line 2101 of file TClingCallFunc.cxx.
void TClingCallFunc::ExecDestructor | ( | const TClingClassInfo * | info, |
void * | address = 0 , |
||
unsigned long | nary = 0UL , |
||
bool | withFree = true |
||
) |
Definition at line 2137 of file TClingCallFunc.cxx.
double TClingCallFunc::ExecDouble | ( | void * | address | ) |
Definition at line 2073 of file TClingCallFunc.cxx.
Definition at line 2063 of file TClingCallFunc.cxx.
long long TClingCallFunc::ExecInt64 | ( | void * | address | ) |
Definition at line 2068 of file TClingCallFunc.cxx.
|
private |
Definition at line 2043 of file TClingCallFunc.cxx.
void TClingCallFunc::ExecWithArgsAndReturn | ( | void * | address, |
const void * | args[] = 0 , |
||
int | nargs = 0 , |
||
void * | ret = 0 |
||
) |
Definition at line 2078 of file TClingCallFunc.cxx.
|
private |
Definition at line 1780 of file TClingCallFunc.cxx.
Definition at line 2090 of file TClingCallFunc.cxx.
|
private |
Definition at line 1788 of file TClingCallFunc.cxx.
TClingMethodInfo * TClingCallFunc::FactoryMethod | ( | ) | const |
Definition at line 2165 of file TClingCallFunc.cxx.
int TClingCallFunc::get_wrapper_code | ( | std::string & | wrapper_name, |
std::string & | wrapper | ||
) |
Definition at line 582 of file TClingCallFunc.cxx.
|
inline |
Definition at line 200 of file TClingCallFunc.h.
|
inline |
Definition at line 208 of file TClingCallFunc.h.
|
inlineprivate |
Definition at line 140 of file TClingCallFunc.h.
TInterpreter::CallFuncIFacePtr_t TClingCallFunc::IFacePtr | ( | ) |
Definition at line 2218 of file TClingCallFunc.cxx.
|
inline |
Definition at line 192 of file TClingCallFunc.h.
void TClingCallFunc::Init | ( | ) |
Definition at line 2170 of file TClingCallFunc.cxx.
void TClingCallFunc::Init | ( | const TClingMethodInfo & | minfo | ) |
Definition at line 2179 of file TClingCallFunc.cxx.
void TClingCallFunc::Init | ( | std::unique_ptr< TClingMethodInfo > | minfo | ) |
Definition at line 2185 of file TClingCallFunc.cxx.
|
private |
Definition at line 1968 of file TClingCallFunc.cxx.
|
private |
Definition at line 1809 of file TClingCallFunc.cxx.
|
private |
TClingCallFunc::ExecWithRetFunc_t TClingCallFunc::InitRetAndExecIntegral | ( | QualType | QT, |
cling::Value & | ret | ||
) |
Definition at line 1797 of file TClingCallFunc.cxx.
|
private |
Definition at line 1927 of file TClingCallFunc.cxx.
void * TClingCallFunc::InterfaceMethod | ( | ) |
Definition at line 2191 of file TClingCallFunc.cxx.
void TClingCallFunc::Invoke | ( | cling::Value * | result = 0 | ) | const |
bool TClingCallFunc::IsValid | ( | ) | const |
Definition at line 2210 of file TClingCallFunc.cxx.
|
private |
Definition at line 1107 of file TClingCallFunc.cxx.
|
private |
Definition at line 1273 of file TClingCallFunc.cxx.
|
private |
Definition at line 391 of file TClingCallFunc.cxx.
|
private |
Definition at line 965 of file TClingCallFunc.cxx.
|
private |
Definition at line 346 of file TClingCallFunc.cxx.
|
private |
Definition at line 507 of file TClingCallFunc.cxx.
|
private |
Definition at line 1082 of file TClingCallFunc.cxx.
|
delete |
void TClingCallFunc::ResetArg | ( | ) |
Definition at line 2242 of file TClingCallFunc.cxx.
void TClingCallFunc::SetArg | ( | double | arg | ) |
Definition at line 2268 of file TClingCallFunc.cxx.
void TClingCallFunc::SetArg | ( | float | arg | ) |
Definition at line 2261 of file TClingCallFunc.cxx.
void TClingCallFunc::SetArg | ( | long | arg | ) |
Definition at line 2254 of file TClingCallFunc.cxx.
void TClingCallFunc::SetArg | ( | long long | arg | ) |
Definition at line 2275 of file TClingCallFunc.cxx.
void TClingCallFunc::SetArg | ( | unsigned long | arg | ) |
Definition at line 2247 of file TClingCallFunc.cxx.
void TClingCallFunc::SetArg | ( | unsigned long long | arg | ) |
Definition at line 2282 of file TClingCallFunc.cxx.
void TClingCallFunc::SetArgArray | ( | long * | argArr, |
int | narg | ||
) |
Definition at line 2289 of file TClingCallFunc.cxx.
void TClingCallFunc::SetArgs | ( | const char * | args | ) |
Definition at line 2297 of file TClingCallFunc.cxx.
void TClingCallFunc::SetFunc | ( | const TClingClassInfo * | info, |
const char * | method, | ||
const char * | arglist, | ||
bool | objectIsConst, | ||
long * | poffset | ||
) |
Definition at line 2309 of file TClingCallFunc.cxx.
void TClingCallFunc::SetFunc | ( | const TClingClassInfo * | info, |
const char * | method, | ||
const char * | arglist, | ||
long * | poffset | ||
) |
Definition at line 2303 of file TClingCallFunc.cxx.
void TClingCallFunc::SetFunc | ( | const TClingMethodInfo * | info | ) |
Definition at line 2337 of file TClingCallFunc.cxx.
void TClingCallFunc::SetFuncProto | ( | const TClingClassInfo * | info, |
const char * | method, | ||
const char * | proto, | ||
bool | objectIsConst, | ||
long * | poffset, | ||
ROOT::EFunctionMatchMode | mode = ROOT::kConversionMatch |
||
) |
Definition at line 2353 of file TClingCallFunc.cxx.
void TClingCallFunc::SetFuncProto | ( | const TClingClassInfo * | info, |
const char * | method, | ||
const char * | proto, | ||
long * | poffset, | ||
ROOT::EFunctionMatchMode | mode = ROOT::kConversionMatch |
||
) |
Definition at line 2346 of file TClingCallFunc.cxx.
void TClingCallFunc::SetFuncProto | ( | const TClingClassInfo * | info, |
const char * | method, | ||
const llvm::SmallVectorImpl< clang::QualType > & | proto, | ||
bool | objectIsConst, | ||
long * | poffset, | ||
ROOT::EFunctionMatchMode | mode = ROOT::kConversionMatch |
||
) |
Definition at line 2381 of file TClingCallFunc.cxx.
void TClingCallFunc::SetFuncProto | ( | const TClingClassInfo * | info, |
const char * | method, | ||
const llvm::SmallVectorImpl< clang::QualType > & | proto, | ||
long * | poffset, | ||
ROOT::EFunctionMatchMode | mode = ROOT::kConversionMatch |
||
) |
Definition at line 2374 of file TClingCallFunc.cxx.
|
mutableprivate |
Stored function arguments, we own.
Definition at line 74 of file TClingCallFunc.h.
|
private |
Decl for the method.
Definition at line 68 of file TClingCallFunc.h.
|
private |
If true, do not limit number of function arguments to declared number.
Definition at line 76 of file TClingCallFunc.h.
|
private |
Cling interpreter, we do not own.
Definition at line 62 of file TClingCallFunc.h.
|
private |
Current method, we own.
Definition at line 66 of file TClingCallFunc.h.
|
private |
Number of required arguments.
Definition at line 70 of file TClingCallFunc.h.
|
private |
ROOT normalized context for that interpreter.
Definition at line 64 of file TClingCallFunc.h.
|
private |
Definition at line 77 of file TClingCallFunc.h.
|
private |
Pointer to compiled wrapper, we do not own.
Definition at line 72 of file TClingCallFunc.h.