Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
clingwrapper.cxx File Reference
#include "precommondefs.h"
#include "cpp_cppyy.h"
#include "callcontext.h"
#include "TBaseClass.h"
#include "TClass.h"
#include "TClassRef.h"
#include "TClassTable.h"
#include "TClassEdit.h"
#include "TCollection.h"
#include "TDataMember.h"
#include "TDataType.h"
#include "TEnum.h"
#include "TEnumConstant.h"
#include "TEnv.h"
#include "TError.h"
#include "TException.h"
#include "TFunction.h"
#include "TFunctionTemplate.h"
#include "TGlobal.h"
#include "THashList.h"
#include "TInterpreter.h"
#include "TList.h"
#include "TListOfDataMembers.h"
#include "TListOfEnums.h"
#include "TMethod.h"
#include "TMethodArg.h"
#include "TROOT.h"
#include "TSystem.h"
#include "TThread.h"
#include <cassert>
#include <algorithm>
#include <climits>
#include <stdexcept>
#include <map>
#include <new>
#include <set>
#include <sstream>
#include <csignal>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <iostream>

Macros

#define _CLING_CATCH_UNCAUGHT
#define _CRT_SECURE_NO_WARNINGS
#define CLING_CATCH_UNCAUGHT_
#define CPPYY_IMP_CALL(typecode, rtype)
#define DIRECT_CALL   ((size_t)1 << (8 * sizeof(size_t) - 1))
#define FILL_COLL(type, filter)

Typedefs

typedef std::vector< TClassRefClassRefs_t
typedef std::vector< TGlobal * > GlobalVars_t
typedef std::map< TGlobal *, GlobalVars_t::size_type > GlobalVarsIndices_t
typedef std::map< std::string, ClassRefs_t::size_type > Name2ClassRefIndex_t
typedef CPyCppyy::Parameter Parameter

Functions

static size_t CALL_NARGS (size_t nargs)
template<typename T>
static T CallT (Cppyy::TCppMethod_t method, Cppyy::TCppObject_t self, size_t nargs, void *args)
static void cond_add (Cppyy::TCppScope_t scope, const std::string &ns_scope, std::set< std::string > &cppnames, const char *name, bool nofilter=false)
static bool copy_args (Parameter *args, size_t nargs, void **vargs)
static int count_scopes (const std::string &tpname)
static char * cppstring_to_cstring (const std::string &cppstr)
static ClassRefs_t g_classrefs (1)
static Cppyy::TCppIndex_t gb2idx (TGlobal *gb)
static TInterpreter::CallFuncIFacePtr_t GetCallFunc (Cppyy::TCppMethod_t method)
Cppyy::TCppIndex_t GetLongestInheritancePath (TClass *klass)
 Retrieve number of base classes in the longest branch of the inheritance tree of the input class.
static bool is_missclassified_stl (const std::string &name)
static TFunctionm2f (Cppyy::TCppMethod_t method)
static bool match_name (const std::string &tname, const std::string fname)
static CallWrapper * new_CallWrapper (CallWrapper::DeclId_t fid, const std::string &n)
static CallWrapper * new_CallWrapper (TFunction *f)
static std::string outer_no_template (const std::string &name)
static std::string outer_with_template (const std::string &name)
static void release_args (Parameter *args, size_t nargs)
static void remove_space (std::string &n)
static bool template_compare (std::string n1, std::string n2)
static bool testMethodExtraProperty (Cppyy::TCppMethod_t method, EFunctionProperty prop)
static bool testMethodProperty (Cppyy::TCppMethod_t method, EProperty prop)
static TClassReftype_from_handle (Cppyy::TCppScope_t scope)
static std::string type_remap (const std::string &n1, const std::string &n2)
static bool WrapperCall (Cppyy::TCppMethod_t method, size_t nargs, void *args_, void *self, void *result)

Variables

static std::set< std::string > g_builtins
static GlobalVarsIndices_t g_globalidx
static GlobalVars_t g_globalvars
static Name2ClassRefIndex_t g_name2classrefidx
static bool gEnableFastPath = true
static std::set< std::string > gInitialNames
static const ClassRefs_t::size_type GLOBAL_HANDLE = 1
static std::map< TDictionary::DeclId_t, CallWrapper * > gMethodTemplates
static std::set< std::string > gRootSOs
static std::set< std::string > gSmartPtrTypes
static std::set< std::string > gSTLNames
static std::vector< CallWrapper * > gWrapperHolder
static std::map< std::string, std::string > resolved_enum_types
static std::map< Cppyy::TCppType_t, boolsHasOperatorDelete
const int SMALL_ARGS_N = 8
static const ClassRefs_t::size_type STD_HANDLE = GLOBAL_HANDLE + 1

Macro Definition Documentation

◆ _CLING_CATCH_UNCAUGHT

#define _CLING_CATCH_UNCAUGHT

Definition at line 70 of file clingwrapper.cxx.

◆ _CRT_SECURE_NO_WARNINGS

#define _CRT_SECURE_NO_WARNINGS

Definition at line 4 of file clingwrapper.cxx.

◆ CLING_CATCH_UNCAUGHT_

#define CLING_CATCH_UNCAUGHT_

Definition at line 69 of file clingwrapper.cxx.

◆ CPPYY_IMP_CALL

#define CPPYY_IMP_CALL ( typecode,
rtype )
Value:
rtype Cppyy::Call##typecode(TCppMethod_t method, TCppObject_t self, size_t nargs, void* args)\
{ \
return CallT<rtype>(method, self, nargs, args); \
}
static T CallT(Cppyy::TCppMethod_t method, Cppyy::TCppObject_t self, size_t nargs, void *args)

Definition at line 1051 of file clingwrapper.cxx.

◆ DIRECT_CALL

#define DIRECT_CALL   ((size_t)1 << (8 * sizeof(size_t) - 1))

Definition at line 118 of file clingwrapper.cxx.

◆ FILL_COLL

#define FILL_COLL ( type,
filter )
Value:
{ \
TIter itr{coll}; \
type* obj = nullptr; \
while ((obj = (type*)itr.Next())) { \
const char* nm = obj->GetName(); \
if (nm && nm[0] != '_' && !(obj->Property() & (filter))) { \
if (gInitialNames.find(nm) == gInitialNames.end()) \
cppnames.insert(nm); \
}}}
TObject * Next()
static std::set< std::string > gInitialNames

Definition at line 1311 of file clingwrapper.cxx.

Typedef Documentation

◆ ClassRefs_t

typedef std::vector<TClassRef> ClassRefs_t

Definition at line 124 of file clingwrapper.cxx.

◆ GlobalVars_t

typedef std::vector<TGlobal*> GlobalVars_t

Definition at line 199 of file clingwrapper.cxx.

◆ GlobalVarsIndices_t

typedef std::map<TGlobal*, GlobalVars_t::size_type> GlobalVarsIndices_t

Definition at line 200 of file clingwrapper.cxx.

◆ Name2ClassRefIndex_t

typedef std::map<std::string, ClassRefs_t::size_type> Name2ClassRefIndex_t

Definition at line 129 of file clingwrapper.cxx.

◆ Parameter

Definition at line 89 of file clingwrapper.cxx.

Function Documentation

◆ CALL_NARGS()

size_t CALL_NARGS ( size_t nargs)
inlinestatic

Definition at line 119 of file clingwrapper.cxx.

◆ CallT()

template<typename T>
T CallT ( Cppyy::TCppMethod_t method,
Cppyy::TCppObject_t self,
size_t nargs,
void * args )
inlinestatic

Definition at line 1043 of file clingwrapper.cxx.

◆ cond_add()

void cond_add ( Cppyy::TCppScope_t scope,
const std::string & ns_scope,
std::set< std::string > & cppnames,
const char * name,
bool nofilter = false )
inlinestatic

Definition at line 1322 of file clingwrapper.cxx.

◆ copy_args()

bool copy_args ( Parameter * args,
size_t nargs,
void ** vargs )
inlinestatic

Definition at line 962 of file clingwrapper.cxx.

◆ count_scopes()

int count_scopes ( const std::string & tpname)
inlinestatic

Definition at line 2333 of file clingwrapper.cxx.

◆ cppstring_to_cstring()

char * cppstring_to_cstring ( const std::string & cppstr)
inlinestatic

Definition at line 454 of file clingwrapper.cxx.

◆ g_classrefs()

ClassRefs_t g_classrefs ( 1 )
static

◆ gb2idx()

Cppyy::TCppIndex_t gb2idx ( TGlobal * gb)
inlinestatic

Definition at line 2455 of file clingwrapper.cxx.

◆ GetCallFunc()

Definition at line 928 of file clingwrapper.cxx.

◆ GetLongestInheritancePath()

Cppyy::TCppIndex_t GetLongestInheritancePath ( TClass * klass)

Retrieve number of base classes in the longest branch of the inheritance tree of the input class.

Parameters
[in]klassThe class to start the retrieval process from.

This is a helper function for Cppyy::GetNumBasesLongestBranch. Given an inheritance tree, the function assigns weight 1 to each class that has at least one base. Starting from the input class, the function is called recursively on all the bases. For each base the return value is one (the weight of the base itself) plus the maximum value retrieved for their bases in turn. For example, given the following inheritance tree:

class A {}; class B: public A {};
class X {}; class Y: public X {}; class Z: public Y {};
class C: public B, Z {};
#define X(type, name)
constexpr Double_t C()
Velocity of light in .
Definition TMath.h:117

calling this function on an instance of C will return 3, the steps required to go from C to X.

Definition at line 1575 of file clingwrapper.cxx.

◆ is_missclassified_stl()

bool is_missclassified_stl ( const std::string & name)
inlinestatic

Definition at line 474 of file clingwrapper.cxx.

◆ m2f()

TFunction * m2f ( Cppyy::TCppMethod_t method)
inlinestatic

Definition at line 432 of file clingwrapper.cxx.

◆ match_name()

bool match_name ( const std::string & tname,
const std::string fname )
inlinestatic

Definition at line 462 of file clingwrapper.cxx.

◆ new_CallWrapper() [1/2]

CallWrapper * new_CallWrapper ( CallWrapper::DeclId_t fid,
const std::string & n )
inlinestatic

Definition at line 192 of file clingwrapper.cxx.

◆ new_CallWrapper() [2/2]

CallWrapper * new_CallWrapper ( TFunction * f)
inlinestatic

Definition at line 184 of file clingwrapper.cxx.

◆ outer_no_template()

std::string outer_no_template ( const std::string & name)
static

Definition at line 1299 of file clingwrapper.cxx.

◆ outer_with_template()

std::string outer_with_template ( const std::string & name)
static

Definition at line 1273 of file clingwrapper.cxx.

◆ release_args()

void release_args ( Parameter * args,
size_t nargs )
inlinestatic

Definition at line 984 of file clingwrapper.cxx.

◆ remove_space()

void remove_space ( std::string & n)
inlinestatic

Definition at line 2113 of file clingwrapper.cxx.

◆ template_compare()

bool template_compare ( std::string n1,
std::string n2 )
inlinestatic

Definition at line 2119 of file clingwrapper.cxx.

◆ testMethodExtraProperty()

bool testMethodExtraProperty ( Cppyy::TCppMethod_t method,
EFunctionProperty prop )
inlinestatic

Definition at line 2266 of file clingwrapper.cxx.

◆ testMethodProperty()

bool testMethodProperty ( Cppyy::TCppMethod_t method,
EProperty prop )
inlinestatic

Definition at line 2258 of file clingwrapper.cxx.

◆ type_from_handle()

TClassRef & type_from_handle ( Cppyy::TCppScope_t scope)
inlinestatic

Definition at line 425 of file clingwrapper.cxx.

◆ type_remap()

std::string type_remap ( const std::string & n1,
const std::string & n2 )
inlinestatic

Definition at line 2207 of file clingwrapper.cxx.

◆ WrapperCall()

bool WrapperCall ( Cppyy::TCppMethod_t method,
size_t nargs,
void * args_,
void * self,
void * result )
inlinestatic

Definition at line 992 of file clingwrapper.cxx.

Variable Documentation

◆ g_builtins

std::set<std::string> g_builtins
static
Initial value:
=
{"bool", "char", "signed char", "unsigned char", "wchar_t", "short", "unsigned short",
"int", "unsigned int", "long", "unsigned long", "long long", "unsigned long long",
"float", "double", "long double", "void",
"allocator", "array", "basic_string", "complex", "initializer_list", "less", "list",
"map", "pair", "set", "vector"}

Definition at line 213 of file clingwrapper.cxx.

◆ g_globalidx

GlobalVarsIndices_t g_globalidx
static

Definition at line 203 of file clingwrapper.cxx.

◆ g_globalvars

GlobalVars_t g_globalvars
static

Definition at line 202 of file clingwrapper.cxx.

◆ g_name2classrefidx

Name2ClassRefIndex_t g_name2classrefidx
static

Definition at line 130 of file clingwrapper.cxx.

◆ gEnableFastPath

bool gEnableFastPath = true
static

Definition at line 230 of file clingwrapper.cxx.

◆ gInitialNames

std::set<std::string> gInitialNames
static

Definition at line 226 of file clingwrapper.cxx.

◆ GLOBAL_HANDLE

const ClassRefs_t::size_type GLOBAL_HANDLE = 1
static

Definition at line 126 of file clingwrapper.cxx.

◆ gMethodTemplates

std::map<TDictionary::DeclId_t, CallWrapper*> gMethodTemplates
static

Definition at line 2110 of file clingwrapper.cxx.

◆ gRootSOs

std::set<std::string> gRootSOs
static

Definition at line 227 of file clingwrapper.cxx.

◆ gSmartPtrTypes

std::set<std::string> gSmartPtrTypes
static
Initial value:
=
{"auto_ptr", "std::auto_ptr", "shared_ptr", "std::shared_ptr",
"unique_ptr", "std::unique_ptr", "weak_ptr", "std::weak_ptr"}

Definition at line 221 of file clingwrapper.cxx.

◆ gSTLNames

std::set<std::string> gSTLNames
static

Definition at line 205 of file clingwrapper.cxx.

◆ gWrapperHolder

std::vector<CallWrapper*> gWrapperHolder
static

Definition at line 181 of file clingwrapper.cxx.

◆ resolved_enum_types

std::map<std::string, std::string> resolved_enum_types
static

Definition at line 132 of file clingwrapper.cxx.

◆ sHasOperatorDelete

std::map<Cppyy::TCppType_t, bool> sHasOperatorDelete
static

Definition at line 905 of file clingwrapper.cxx.

◆ SMALL_ARGS_N

const int SMALL_ARGS_N = 8

Definition at line 115 of file clingwrapper.cxx.

◆ STD_HANDLE

const ClassRefs_t::size_type STD_HANDLE = GLOBAL_HANDLE + 1
static

Definition at line 127 of file clingwrapper.cxx.