Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TClingCallFunc Class Reference

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 60 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)
 
voidExecDefaultConstructor (const TClingClassInfo *info, ROOT::TMetaUtils::EIOCtorCategory kind, const std::string &type_name, void *address=nullptr, unsigned long nary=0UL)
 
void ExecDestructor (const TClingClassInfo *info, void *address=nullptr, unsigned long nary=0UL, bool withFree=true)
 
double ExecDouble (void *address)
 
Longptr_t 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=nullptr)
 
TClingMethodInfoFactoryMethod () const
 
int get_wrapper_code (std::string &wrapper_name, std::string &wrapper)
 
const clang::FunctionDecl * GetDecl ()
 
const clang::FunctionDecl * GetDecl () const
 
const clang::DeclContext * GetDeclContext () const
 
const clang::Decl * GetFunctionOrShadowDecl () 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)
 
voidInterfaceMethod ()
 
void Invoke (cling::Value *result=0) const
 
bool IsValid () const
 
TClingCallFuncoperator= (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 (Longptr_t *argArr, int narg)
 
void SetArgs (const char *args)
 
void SetFunc (const TClingClassInfo *info, const char *method, const char *arglist, bool objectIsConst, Longptr_t *poffset)
 
void SetFunc (const TClingClassInfo *info, const char *method, const char *arglist, Longptr_t *poffset)
 
void SetFunc (const TClingMethodInfo *info)
 
void SetFuncProto (const TClingClassInfo *info, const char *method, const char *proto, bool objectIsConst, Longptr_t *poffset, ROOT::EFunctionMatchMode mode=ROOT::kConversionMatch)
 
void SetFuncProto (const TClingClassInfo *info, const char *method, const char *proto, Longptr_t *poffset, ROOT::EFunctionMatchMode mode=ROOT::kConversionMatch)
 
void SetFuncProto (const TClingClassInfo *info, const char *method, const llvm::SmallVectorImpl< clang::QualType > &proto, bool objectIsConst, Longptr_t *poffset, ROOT::EFunctionMatchMode mode=ROOT::kConversionMatch)
 
void SetFuncProto (const TClingClassInfo *info, const char *method, const llvm::SmallVectorImpl< clang::QualType > &proto, Longptr_t *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)
 
voidcompile_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 >
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 *, ROOT::TMetaUtils::EIOCtorCategory, const std::string &)
 
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.
 
const clang::FunctionDecl * fDecl = nullptr
 Decl for the method.
 
bool fIgnoreExtraArgs: 1
 If true, do not limit number of function arguments to declared number.
 
cling::Interpreter * fInterp
 Cling interpreter, we do not own.
 
std::unique_ptr< TClingMethodInfofMethod
 Current method, we own.
 
size_t fMinRequiredArguments = -1
 Number of required arguments.
 
const ROOT::TMetaUtils::TNormalizedCtxtfNormCtxt
 ROOT normalized context for that interpreter.
 
bool fReturnIsRecordType: 1
 
tcling_callfunc_Wrapper_t fWrapper
 Pointer to compiled wrapper, we do not own.
 

#include </home/sftnight/build/workspace/root-makedoc-v626/rootspi/rdoc/src/v6-26-00-patches/core/metacling/src/TClingCallFunc.h>

Member Typedef Documentation

◆ ExecWithRetFunc_t

using TClingCallFunc::ExecWithRetFunc_t = std::function<void(void* address, cling::Value &ret)>
private

Definition at line 89 of file TClingCallFunc.h.

Member Enumeration Documentation

◆ EReferenceType

Enumerator
kNotReference 
kLValueReference 
kRValueReference 

Definition at line 83 of file TClingCallFunc.h.

Constructor & Destructor Documentation

◆ ~TClingCallFunc()

TClingCallFunc::~TClingCallFunc ( )
default

◆ TClingCallFunc() [1/3]

TClingCallFunc::TClingCallFunc ( cling::Interpreter *  interp,
const ROOT::TMetaUtils::TNormalizedCtxt normCtxt 
)
inlineexplicit

Definition at line 158 of file TClingCallFunc.h.

◆ TClingCallFunc() [2/3]

TClingCallFunc::TClingCallFunc ( const TClingMethodInfo minfo,
const ROOT::TMetaUtils::TNormalizedCtxt normCtxt 
)
inlineexplicit

Definition at line 164 of file TClingCallFunc.h.

◆ TClingCallFunc() [3/3]

TClingCallFunc::TClingCallFunc ( const TClingCallFunc rhs)
inline

Definition at line 172 of file TClingCallFunc.h.

Member Function Documentation

◆ CalculateMinRequiredArguments()

size_t TClingCallFunc::CalculateMinRequiredArguments ( )
private

Definition at line 259 of file TClingCallFunc.cxx.

◆ collect_type_info()

void TClingCallFunc::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 
)
private

Definition at line 272 of file TClingCallFunc.cxx.

◆ compile_wrapper()

void * TClingCallFunc::compile_wrapper ( const std::string &  wrapper_name,
const std::string &  wrapper,
bool  withAccessControl = true 
)
private

Definition at line 265 of file TClingCallFunc.cxx.

◆ EvaluateArgList()

void TClingCallFunc::EvaluateArgList ( const std::string &  ArgList)
private

Definition at line 2071 of file TClingCallFunc.cxx.

◆ Exec()

void TClingCallFunc::Exec ( void address,
TInterpreterValue interpVal = 0 
)

Definition at line 2095 of file TClingCallFunc.cxx.

◆ exec()

void TClingCallFunc::exec ( void address,
void ret 
)
private

Definition at line 1534 of file TClingCallFunc.cxx.

◆ exec_with_valref_return()

void TClingCallFunc::exec_with_valref_return ( void address,
cling::Value *  ret 
)
private

Definition at line 2052 of file TClingCallFunc.cxx.

◆ ExecDefaultConstructor()

void * TClingCallFunc::ExecDefaultConstructor ( const TClingClassInfo info,
ROOT::TMetaUtils::EIOCtorCategory  kind,
const std::string &  type_name,
void address = nullptr,
unsigned long  nary = 0UL 
)

Definition at line 2170 of file TClingCallFunc.cxx.

◆ ExecDestructor()

void TClingCallFunc::ExecDestructor ( const TClingClassInfo info,
void address = nullptr,
unsigned long  nary = 0UL,
bool  withFree = true 
)

Definition at line 2208 of file TClingCallFunc.cxx.

◆ ExecDouble()

double TClingCallFunc::ExecDouble ( void address)

Definition at line 2142 of file TClingCallFunc.cxx.

◆ ExecInt()

Longptr_t TClingCallFunc::ExecInt ( void address)

Definition at line 2132 of file TClingCallFunc.cxx.

◆ ExecInt64()

long long TClingCallFunc::ExecInt64 ( void address)

Definition at line 2137 of file TClingCallFunc.cxx.

◆ ExecT()

template<typename T >
T TClingCallFunc::ExecT ( void address)
private

Definition at line 2112 of file TClingCallFunc.cxx.

◆ ExecWithArgsAndReturn()

void TClingCallFunc::ExecWithArgsAndReturn ( void address,
const void args[] = 0,
int  nargs = 0,
void ret = 0 
)

Definition at line 2147 of file TClingCallFunc.cxx.

◆ execWithLL()

template<typename T >
void TClingCallFunc::execWithLL ( void address,
cling::Value *  val 
)
private

Definition at line 1849 of file TClingCallFunc.cxx.

◆ ExecWithReturn()

void TClingCallFunc::ExecWithReturn ( void address,
void ret = nullptr 
)

Definition at line 2159 of file TClingCallFunc.cxx.

◆ execWithULL()

template<typename T >
void TClingCallFunc::execWithULL ( void address,
cling::Value *  val 
)
private

Definition at line 1857 of file TClingCallFunc.cxx.

◆ FactoryMethod()

TClingMethodInfo * TClingCallFunc::FactoryMethod ( ) const

Definition at line 2236 of file TClingCallFunc.cxx.

◆ get_wrapper_code()

int TClingCallFunc::get_wrapper_code ( std::string &  wrapper_name,
std::string &  wrapper 
)

Definition at line 592 of file TClingCallFunc.cxx.

◆ GetDecl() [1/2]

const clang::FunctionDecl * TClingCallFunc::GetDecl ( )
inline

Definition at line 209 of file TClingCallFunc.h.

◆ GetDecl() [2/2]

const clang::FunctionDecl * TClingCallFunc::GetDecl ( ) const
inline

Definition at line 214 of file TClingCallFunc.h.

◆ GetDeclContext()

const clang::DeclContext * TClingCallFunc::GetDeclContext ( ) const

Definition at line 588 of file TClingCallFunc.cxx.

◆ GetFunctionOrShadowDecl()

const clang::Decl * TClingCallFunc::GetFunctionOrShadowDecl ( ) const
inline

Definition at line 219 of file TClingCallFunc.h.

◆ GetMinRequiredArguments()

size_t TClingCallFunc::GetMinRequiredArguments ( )
inlineprivate

Definition at line 143 of file TClingCallFunc.h.

◆ IFacePtr()

TInterpreter::CallFuncIFacePtr_t TClingCallFunc::IFacePtr ( )

Definition at line 2289 of file TClingCallFunc.cxx.

◆ IgnoreExtraArgs()

void TClingCallFunc::IgnoreExtraArgs ( bool  ignore)
inline

Definition at line 197 of file TClingCallFunc.h.

◆ Init() [1/3]

void TClingCallFunc::Init ( )

Definition at line 2241 of file TClingCallFunc.cxx.

◆ Init() [2/3]

void TClingCallFunc::Init ( const TClingMethodInfo minfo)

Definition at line 2250 of file TClingCallFunc.cxx.

◆ Init() [3/3]

void TClingCallFunc::Init ( std::unique_ptr< TClingMethodInfo minfo)

Definition at line 2256 of file TClingCallFunc.cxx.

◆ InitRetAndExec()

TClingCallFunc::ExecWithRetFunc_t TClingCallFunc::InitRetAndExec ( const clang::FunctionDecl *  FD,
cling::Value &  ret 
)
private

Definition at line 2037 of file TClingCallFunc.cxx.

◆ InitRetAndExecBuiltin()

TClingCallFunc::ExecWithRetFunc_t TClingCallFunc::InitRetAndExecBuiltin ( clang::QualType  QT,
const clang::BuiltinType *  BT,
cling::Value &  ret 
)
private

Definition at line 1878 of file TClingCallFunc.cxx.

◆ InitRetAndExecIntegral() [1/2]

template<class T >
ExecWithRetFunc_t TClingCallFunc::InitRetAndExecIntegral ( clang::QualType  QT,
cling::Value &  ret 
)
private

◆ InitRetAndExecIntegral() [2/2]

template<class T >
TClingCallFunc::ExecWithRetFunc_t TClingCallFunc::InitRetAndExecIntegral ( QualType  QT,
cling::Value &  ret 
)

Definition at line 1866 of file TClingCallFunc.cxx.

◆ InitRetAndExecNoCtor()

TClingCallFunc::ExecWithRetFunc_t TClingCallFunc::InitRetAndExecNoCtor ( clang::QualType  QT,
cling::Value &  ret 
)
private

Definition at line 1996 of file TClingCallFunc.cxx.

◆ InterfaceMethod()

void * TClingCallFunc::InterfaceMethod ( )

Definition at line 2262 of file TClingCallFunc.cxx.

◆ Invoke()

void TClingCallFunc::Invoke ( cling::Value *  result = 0) const

◆ IsValid()

bool TClingCallFunc::IsValid ( ) const

Definition at line 2281 of file TClingCallFunc.cxx.

◆ make_ctor_wrapper()

tcling_callfunc_ctor_Wrapper_t TClingCallFunc::make_ctor_wrapper ( const TClingClassInfo info,
ROOT::TMetaUtils::EIOCtorCategory  kind,
const std::string &  type_name 
)
private

Definition at line 1131 of file TClingCallFunc.cxx.

◆ make_dtor_wrapper()

tcling_callfunc_dtor_Wrapper_t TClingCallFunc::make_dtor_wrapper ( const TClingClassInfo info)
private

Definition at line 1342 of file TClingCallFunc.cxx.

◆ make_narg_call()

void TClingCallFunc::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 
)
private

Definition at line 390 of file TClingCallFunc.cxx.

◆ make_narg_call_with_return()

void TClingCallFunc::make_narg_call_with_return ( const unsigned  N,
const std::string &  class_name,
std::ostringstream &  buf,
int  indent_level 
)
private

Definition at line 977 of file TClingCallFunc.cxx.

◆ make_narg_ctor()

void TClingCallFunc::make_narg_ctor ( const unsigned  N,
std::ostringstream &  typedefbuf,
std::ostringstream &  callbuf,
const std::string &  class_name,
int  indent_level 
)
private

Definition at line 345 of file TClingCallFunc.cxx.

◆ make_narg_ctor_with_return()

void TClingCallFunc::make_narg_ctor_with_return ( const unsigned  N,
const std::string &  class_name,
std::ostringstream &  buf,
int  indent_level 
)
private

Definition at line 506 of file TClingCallFunc.cxx.

◆ make_wrapper()

tcling_callfunc_Wrapper_t TClingCallFunc::make_wrapper ( )
private

Definition at line 1106 of file TClingCallFunc.cxx.

◆ operator=()

TClingCallFunc & TClingCallFunc::operator= ( const TClingCallFunc rhs)
delete

◆ ResetArg()

void TClingCallFunc::ResetArg ( )

Definition at line 2313 of file TClingCallFunc.cxx.

◆ SetArg() [1/6]

void TClingCallFunc::SetArg ( double  arg)

Definition at line 2339 of file TClingCallFunc.cxx.

◆ SetArg() [2/6]

void TClingCallFunc::SetArg ( float  arg)

Definition at line 2332 of file TClingCallFunc.cxx.

◆ SetArg() [3/6]

void TClingCallFunc::SetArg ( long  arg)

Definition at line 2325 of file TClingCallFunc.cxx.

◆ SetArg() [4/6]

void TClingCallFunc::SetArg ( long long  arg)

Definition at line 2346 of file TClingCallFunc.cxx.

◆ SetArg() [5/6]

void TClingCallFunc::SetArg ( unsigned long  arg)

Definition at line 2318 of file TClingCallFunc.cxx.

◆ SetArg() [6/6]

void TClingCallFunc::SetArg ( unsigned long long  arg)

Definition at line 2353 of file TClingCallFunc.cxx.

◆ SetArgArray()

void TClingCallFunc::SetArgArray ( Longptr_t argArr,
int  narg 
)

Definition at line 2360 of file TClingCallFunc.cxx.

◆ SetArgs()

void TClingCallFunc::SetArgs ( const char *  args)

Definition at line 2368 of file TClingCallFunc.cxx.

◆ SetFunc() [1/3]

void TClingCallFunc::SetFunc ( const TClingClassInfo info,
const char *  method,
const char *  arglist,
bool  objectIsConst,
Longptr_t poffset 
)

Definition at line 2380 of file TClingCallFunc.cxx.

◆ SetFunc() [2/3]

void TClingCallFunc::SetFunc ( const TClingClassInfo info,
const char *  method,
const char *  arglist,
Longptr_t poffset 
)

Definition at line 2374 of file TClingCallFunc.cxx.

◆ SetFunc() [3/3]

void TClingCallFunc::SetFunc ( const TClingMethodInfo info)

Definition at line 2408 of file TClingCallFunc.cxx.

◆ SetFuncProto() [1/4]

void TClingCallFunc::SetFuncProto ( const TClingClassInfo info,
const char *  method,
const char *  proto,
bool  objectIsConst,
Longptr_t poffset,
ROOT::EFunctionMatchMode  mode = ROOT::kConversionMatch 
)

Definition at line 2424 of file TClingCallFunc.cxx.

◆ SetFuncProto() [2/4]

void TClingCallFunc::SetFuncProto ( const TClingClassInfo info,
const char *  method,
const char *  proto,
Longptr_t poffset,
ROOT::EFunctionMatchMode  mode = ROOT::kConversionMatch 
)

Definition at line 2417 of file TClingCallFunc.cxx.

◆ SetFuncProto() [3/4]

void TClingCallFunc::SetFuncProto ( const TClingClassInfo info,
const char *  method,
const llvm::SmallVectorImpl< clang::QualType > &  proto,
bool  objectIsConst,
Longptr_t poffset,
ROOT::EFunctionMatchMode  mode = ROOT::kConversionMatch 
)

Definition at line 2452 of file TClingCallFunc.cxx.

◆ SetFuncProto() [4/4]

void TClingCallFunc::SetFuncProto ( const TClingClassInfo info,
const char *  method,
const llvm::SmallVectorImpl< clang::QualType > &  proto,
Longptr_t poffset,
ROOT::EFunctionMatchMode  mode = ROOT::kConversionMatch 
)

Definition at line 2445 of file TClingCallFunc.cxx.

Member Data Documentation

◆ fArgVals

llvm::SmallVector<cling::Value, 8> TClingCallFunc::fArgVals
mutableprivate

Stored function arguments, we own.

Definition at line 77 of file TClingCallFunc.h.

◆ fDecl

const clang::FunctionDecl* TClingCallFunc::fDecl = nullptr
private

Decl for the method.

Definition at line 71 of file TClingCallFunc.h.

◆ fIgnoreExtraArgs

bool TClingCallFunc::fIgnoreExtraArgs
private

If true, do not limit number of function arguments to declared number.

Definition at line 79 of file TClingCallFunc.h.

◆ fInterp

cling::Interpreter* TClingCallFunc::fInterp
private

Cling interpreter, we do not own.

Definition at line 65 of file TClingCallFunc.h.

◆ fMethod

std::unique_ptr<TClingMethodInfo> TClingCallFunc::fMethod
private

Current method, we own.

Definition at line 69 of file TClingCallFunc.h.

◆ fMinRequiredArguments

size_t TClingCallFunc::fMinRequiredArguments = -1
private

Number of required arguments.

Definition at line 73 of file TClingCallFunc.h.

◆ fNormCtxt

const ROOT::TMetaUtils::TNormalizedCtxt& TClingCallFunc::fNormCtxt
private

ROOT normalized context for that interpreter.

Definition at line 67 of file TClingCallFunc.h.

◆ fReturnIsRecordType

bool TClingCallFunc::fReturnIsRecordType
private

Definition at line 80 of file TClingCallFunc.h.

◆ fWrapper

tcling_callfunc_Wrapper_t TClingCallFunc::fWrapper
private

Pointer to compiled wrapper, we do not own.

Definition at line 75 of file TClingCallFunc.h.

  • core/metacling/src/TClingCallFunc.h
  • core/metacling/src/TClingCallFunc.cxx