Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TFunctionTemplate.cxx
Go to the documentation of this file.
1// @(#)root/meta:$Id$
2// Author: Philippe Canal November 2013.
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12/** \class TFunctionTemplate
13Dictionary for function template
14This class describes one single function template.
15*/
16
17#include "TFunctionTemplate.h"
18#include "TInterpreter.h"
19#include "TClass.h"
20
22
23////////////////////////////////////////////////////////////////////////////////
24/// Default TFunctionTemplate ctor.
25
27 fInfo(info), fClass(cl)
28{
29 if (fInfo) {
32 }
33}
34
35////////////////////////////////////////////////////////////////////////////////
36/// Copy operator.
37
39{
40 if (orig.fInfo) {
42 } else
43 fInfo = nullptr;
44 fClass = orig.fClass;
45}
46
47////////////////////////////////////////////////////////////////////////////////
48/// Assignment operator.
49
51{
52 if (this != &rhs) {
54 if (rhs.fInfo) {
58 } else
59 fInfo = nullptr;
60
61 fClass = rhs.fClass;
62 }
63 return *this;
64}
65
66////////////////////////////////////////////////////////////////////////////////
67/// TFunctionTemplate dtor deletes adopted CINT FuncTempInfo.
68
70{
72}
73
74////////////////////////////////////////////////////////////////////////////////
75/// Clone method.
76
77TObject *TFunctionTemplate::Clone(const char *newname) const
78{
79 TNamed *newobj = new TFunctionTemplate(*this);
80 if (newname && strlen(newname)) newobj->SetName(newname);
81 return newobj;
82}
83
84////////////////////////////////////////////////////////////////////////////////
85/// Return true if this function template object is pointing to a currently
86/// loaded function. If a function is unloaded after the TFunction
87/// is created, the TFunction will be set to be invalid.
88
90{
91 // Register the transaction when checking the validity of the object.
93 // Only for global functions. For data member functions TMethod does it.
94 DeclId_t newId = gInterpreter->GetFunction(nullptr, fName);
95 if (newId) {
96 FuncTempInfo_t *info = gInterpreter->FuncTempInfo_Factory(newId);
97 Update(info);
98 }
99 return newId != nullptr;
100 }
101 return fInfo != nullptr;
102}
103
104////////////////////////////////////////////////////////////////////////////////
105/// Number of function arguments.
106
108{
110}
111
112////////////////////////////////////////////////////////////////////////////////
113/// Number of function optional (default) arguments.
114
116{
117 // FIXME: when unload this is an over-estimate.
119}
120
121////////////////////////////////////////////////////////////////////////////////
122/// Get property description word. For meaning of bits see EProperty.
123
125{
127}
128
129////////////////////////////////////////////////////////////////////////////////
130/// Get the properties not already defined in Property.See TDictionary's EFunctionProperty.
131
133{
135}
136
137////////////////////////////////////////////////////////////////////////////////
138
140{
141 return gInterpreter->GetDeclId(fInfo);
142}
143
144////////////////////////////////////////////////////////////////////////////////
145/// Update the TFunctionTemplate to reflect the new info.
146///
147/// This can be used to implement unloading (info == 0) and then reloading
148/// (info being the 'new' decl address).
149
151{
152 if (info == nullptr) {
154 fInfo = nullptr;
155 return kTRUE;
156 } else {
158 fInfo = info;
160 return kTRUE;
161 }
162}
163
Cppyy::TCppType_t fClass
long Long_t
Definition RtypesCore.h:54
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
#define ClassImp(name)
Definition Rtypes.h:377
R__EXTERN TInterpreter * gCling
#define gInterpreter
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:81
This class defines an abstract interface that must be implemented by all classes that contain diction...
Bool_t UpdateInterpreterStateMarker()
the Cling ID of the transaction that last updated the object
const void * DeclId_t
Dictionary for function template This class describes one single function template.
Long_t Property() const override
Get property description word. For meaning of bits see EProperty.
virtual ~TFunctionTemplate()
TFunctionTemplate dtor deletes adopted CINT FuncTempInfo.
virtual bool Update(FuncTempInfo_t *info)
Update the TFunctionTemplate to reflect the new info.
DeclId_t GetDeclId() const
FuncTempInfo_t * fInfo
UInt_t GetTemplateMinReqArgs() const
Number of function optional (default) arguments.
virtual Bool_t IsValid()
Return true if this function template object is pointing to a currently loaded function.
TFunctionTemplate & operator=(const TFunctionTemplate &rhs)
Assignment operator.
UInt_t GetTemplateNargs() const
Number of function arguments.
TObject * Clone(const char *newname="") const override
Clone method.
TFunctionTemplate(FuncTempInfo_t *info, TClass *cl)
Default TFunctionTemplate ctor.
Long_t ExtraProperty() const
Get the properties not already defined in Property.See TDictionary's EFunctionProperty.
virtual Long_t FuncTempInfo_Property(FuncTempInfo_t *) const =0
virtual Long_t FuncTempInfo_ExtraProperty(FuncTempInfo_t *) const =0
virtual UInt_t FuncTempInfo_TemplateMinReqArgs(FuncTempInfo_t *) const =0
virtual UInt_t FuncTempInfo_TemplateNargs(FuncTempInfo_t *) const =0
virtual FuncTempInfo_t * FuncTempInfo_FactoryCopy(FuncTempInfo_t *) const =0
virtual void FuncTempInfo_Name(FuncTempInfo_t *, TString &name) const =0
virtual void FuncTempInfo_Delete(FuncTempInfo_t *) const =0
virtual void FuncTempInfo_Title(FuncTempInfo_t *, TString &title) const =0
The TNamed class is the base class for all named ROOT classes.
Definition TNamed.h:29
TString fTitle
Definition TNamed.h:33
TString fName
Definition TNamed.h:32
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition TNamed.cxx:140
Mother of all ROOT objects.
Definition TObject.h:41