34 TFunction::TFunction(MethodInfo_t *info) : TDictionary()
39 SetName(gCling->MethodInfo_Name(fInfo));
40 SetTitle(gCling->MethodInfo_Title(fInfo));
41 fMangledName = gCling->MethodInfo_GetMangledName(fInfo);
48 TFunction::TFunction(
const TFunction &orig) : TDictionary(orig)
51 R__LOCKGUARD(gInterpreterMutex);
52 fInfo = gCling->MethodInfo_FactoryCopy(orig.fInfo);
53 fMangledName = orig.fMangledName;
62 TFunction& TFunction::operator=(
const TFunction &rhs)
65 R__LOCKGUARD(gInterpreterMutex);
66 gCling->MethodInfo_Delete(fInfo);
67 if (fMethodArgs) fMethodArgs->Delete();
70 fInfo = gCling->MethodInfo_FactoryCopy(rhs.fInfo);
71 SetName(gCling->MethodInfo_Name(fInfo));
72 SetTitle(gCling->MethodInfo_Title(fInfo));
73 fMangledName = gCling->MethodInfo_GetMangledName(fInfo);
84 TFunction::~TFunction()
86 R__LOCKGUARD(gInterpreterMutex);
87 gCling->MethodInfo_Delete(fInfo);
89 if (fMethodArgs) fMethodArgs->Delete();
96 TObject *TFunction::Clone(
const char *newname)
const
98 TNamed *newobj =
new TFunction(*
this);
99 if (newname && strlen(newname)) newobj->SetName(newname);
106 void TFunction::CreateSignature()
108 R__LOCKGUARD(gInterpreterMutex);
109 gCling->MethodInfo_CreateSignature(fInfo, fSignature);
115 const char *TFunction::GetSignature()
117 if (fInfo && fSignature.IsNull())
120 return fSignature.Data();
126 TList *TFunction::GetListOfMethodArgs()
128 if (!fMethodArgs && fInfo) {
130 Fatal(
"GetListOfMethodArgs",
"gInterpreter not initialized");
132 gInterpreter->CreateListOfMethodArgs(
this);
140 const char *TFunction::GetReturnTypeName()
const
142 R__LOCKGUARD(gInterpreterMutex);
143 if (fInfo == 0 || gCling->MethodInfo_Type(fInfo) == 0)
return "Unknown";
144 return gCling->MethodInfo_TypeName(fInfo);
154 std::string TFunction::GetReturnTypeNormalizedName()
const
156 R__LOCKGUARD(gInterpreterMutex);
157 if (fInfo == 0 || gCling->MethodInfo_Type(fInfo) == 0)
return "Unknown";
158 return gCling->MethodInfo_TypeNormalizedName(fInfo);
164 Int_t TFunction::GetNargs()
const
166 if (fInfo)
return gCling->MethodInfo_NArg(fInfo);
167 else if (fMethodArgs)
return fMethodArgs->GetEntries();
174 Int_t TFunction::GetNargsOpt()
const
177 return fInfo ? gCling->MethodInfo_NDefaultArg(fInfo) : GetNargs();
183 Long_t TFunction::Property()
const
185 return fInfo ? gCling->MethodInfo_Property(fInfo) : 0;
191 Long_t TFunction::ExtraProperty()
const
193 return fInfo ? gCling->MethodInfo_ExtraProperty(fInfo) : 0;
198 TDictionary::DeclId_t TFunction::GetDeclId()
const
200 return gInterpreter->GetDeclId(fInfo);
208 void *TFunction::InterfaceMethod()
const
210 return fInfo ? gCling->MethodInfo_InterfaceMethod(fInfo) : 0;
218 Bool_t TFunction::IsValid()
221 if (!fInfo && UpdateInterpreterStateMarker()) {
223 DeclId_t newId = gInterpreter->GetFunction(0, fName);
225 MethodInfo_t *info = gInterpreter->MethodInfo_Factory(newId);
236 const char *TFunction::GetMangledName()
const
245 const char *TFunction::GetPrototype()
const
248 R__LOCKGUARD(gInterpreterMutex);
249 return gCling->MethodInfo_GetPrototype(fInfo);
257 void TFunction::ls(Option_t *options )
const
259 TDictionary::ls(options);
260 TROOT::IndentLevel();
261 std::cout <<
" " << GetPrototype() <<
'\n';
267 void TFunction::Print(Option_t *options )
const
269 TDictionary::Print(options);
278 Bool_t TFunction::Update(MethodInfo_t *info)
283 R__LOCKGUARD(gInterpreterMutex);
284 gCling->MethodInfo_Delete(fInfo);
288 for (Int_t i = 0; i < fMethodArgs->LastIndex() + 1; i ++) {
289 TMethodArg *arg = (TMethodArg *) fMethodArgs->At( i );
296 R__LOCKGUARD(gInterpreterMutex);
297 gCling->MethodInfo_Delete(fInfo);
300 TString newMangledName = gCling->MethodInfo_GetMangledName(fInfo);
301 if (newMangledName != fMangledName) {
302 Error(
"Update",
"TFunction object updated with the 'wrong' MethodInfo (%s vs %s).",
303 fMangledName.Data(),newMangledName.Data());
307 SetTitle(gCling->MethodInfo_Title(fInfo));
309 MethodArgInfo_t *arg = gCling->MethodArgInfo_Factory(fInfo);
311 R__LOCKGUARD(gInterpreterMutex);
312 while (gCling->MethodArgInfo_Next(arg)) {
313 if (gCling->MethodArgInfo_IsValid(arg)) {
314 MethodArgInfo_t *new_arg = gCling->MethodArgInfo_FactoryCopy(arg);
315 ((TMethodArg *) fMethodArgs->At( i ))->Update(new_arg);