23 ClassImp(ROOT::Internal::TFriendProxyDescriptor);
28 TFriendProxyDescriptor::TFriendProxyDescriptor(
const char *treename,
29 const char *aliasname,
31 TNamed(treename,aliasname),
38 Bool_t TFriendProxyDescriptor::IsEquivalent(
const TFriendProxyDescriptor *other)
43 if ( !other )
return kFALSE;
44 if ( strcmp(GetName(),other->GetName()) )
return kFALSE;
46 TBranchProxyDescriptor *desc;
47 TBranchProxyDescriptor *othdesc;
49 if ( fListOfTopProxies.GetSize() != other->fListOfTopProxies.GetSize() )
return kFALSE;
50 TIter next(&fListOfTopProxies);
51 TIter othnext(&other->fListOfTopProxies);
52 while ( (desc=(TBranchProxyDescriptor*)next()) ) {
53 othdesc=(TBranchProxyDescriptor*)othnext();
54 if (!desc->IsEquivalent(othdesc) )
return kFALSE;
59 void TFriendProxyDescriptor::OutputClassDecl(FILE *hf,
int offset, UInt_t maxVarname)
63 fprintf(hf,
"%-*sstruct TFriendPx_%s : public TFriendProxy {\n", offset,
" ", GetName() );
64 fprintf(hf,
"%-*s TFriendPx_%s(TBranchProxyDirector *director,TTree *tree,Int_t index) :\n",
65 offset,
" ", GetName() );
66 fprintf(hf,
"%-*s %-*s(director,tree,index)",offset,
" ",maxVarname,
"TFriendProxy");
67 TBranchProxyDescriptor *data;
68 TIter next = &fListOfTopProxies;
69 while ( (data = (TBranchProxyDescriptor*)next()) ) {
70 fprintf(hf,
",\n%-*s %-*s(&fDirector,\"%s\")",
71 offset,
" ",maxVarname, data->GetDataName(), data->GetBranchName());
73 fprintf(hf,
"\n%-*s { }\n",offset,
" ");
75 fprintf(hf,
"\n%-*s // Proxy for each of the branches and leaves of the tree\n",offset,
" ");
77 while ( (data = (TBranchProxyDescriptor*)next()) ) {
78 data->OutputDecl(hf, offset+3, maxVarname);
80 fprintf(hf,
"%-*s};\n",offset,
" ");
83 void TFriendProxyDescriptor::OutputDecl(FILE *hf,
int offset, UInt_t maxVarname)
87 TString typeName =
"TFriendPx_";
88 typeName += GetName();
89 fprintf(hf,
"%-*s%-*s %s;\n",
90 offset,
" ",maxVarname,typeName.Data(),GetTitle());