Logo ROOT  
Reference Guide
TFriendProxyDescriptor.cxx
Go to the documentation of this file.
1// @(#)root/base:$Id$
2// Author: Philippe Canal 13/05/2003
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, Rene Brun, Fons Rademakers and al. *
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 TFriendProxyDescriptor
13Hold the processed information about a Friend TTree while
14TTreeProxyGenerator is parsing the TTree information.
15Also contains the routine use to generate the appropriate code
16fragment in the result of MakeProxy.
17*/
18
21#include "TList.h"
22
24
25namespace ROOT {
26namespace Internal {
27
28 //////////////////////////////////////////////////////////////////////////
29 /// Constructor
30
32 const char *aliasname,
33 Int_t index) :
34 TNamed(treename,aliasname),
35 fDuplicate(kFALSE),
36 fIndex(index)
37 {
38 }
39
40 //////////////////////////////////////////////////////////////////////////
41 /// Return true if this descriptor and the other are equivalent (describe the
42 /// same entity).
43
45 {
46 if ( !other ) return kFALSE;
47 if ( strcmp(GetName(),other->GetName()) ) return kFALSE;
48
51
52 if ( fListOfTopProxies.GetSize() != other->fListOfTopProxies.GetSize() ) return kFALSE;
54 TIter othnext(&other->fListOfTopProxies);
55 while ( (desc=(TBranchProxyDescriptor*)next()) ) {
56 othdesc=(TBranchProxyDescriptor*)othnext();
57 if (!desc->IsEquivalent(othdesc) ) return kFALSE;
58 }
59 return kTRUE;
60 }
61
62 //////////////////////////////////////////////////////////////////////////
63 /// Print the declaration needed for this descriptor.
64
65 void TFriendProxyDescriptor::OutputClassDecl(FILE *hf, int offset, UInt_t maxVarname)
66 {
67 fprintf(hf,"%-*sstruct TFriendPx_%s : public TFriendProxy {\n", offset," ", GetName() );
68 fprintf(hf,"%-*s TFriendPx_%s(TBranchProxyDirector *director,TTree *tree,Int_t index) :\n",
69 offset," ", GetName() );
70 fprintf(hf,"%-*s %-*s(director,tree,index)",offset," ",maxVarname,"TFriendProxy");
73 while ( (data = (TBranchProxyDescriptor*)next()) ) {
74 fprintf(hf,",\n%-*s %-*s(&fDirector,\"%s\")",
75 offset," ",maxVarname, data->GetDataName(), data->GetBranchName());
76 }
77 fprintf(hf,"\n%-*s { }\n",offset," ");
78
79 fprintf(hf, "\n%-*s // Proxy for each of the branches and leaves of the tree\n",offset," ");
80 next.Reset();
81 while ( (data = (TBranchProxyDescriptor*)next()) ) {
82 data->OutputDecl(hf, offset+3, maxVarname);
83 }
84 fprintf(hf,"%-*s};\n",offset," ");
85 }
86
87 //////////////////////////////////////////////////////////////////////////
88 /// Print the declaration needed for this descriptor.
89
90 void TFriendProxyDescriptor::OutputDecl(FILE *hf, int offset, UInt_t maxVarname)
91 {
92 TString typeName = "TFriendPx_";
93 typeName += GetName();
94 fprintf(hf,"%-*s%-*s %s;\n",
95 offset," ",maxVarname,typeName.Data(),GetTitle());
96 }
97
98} // namespace Internal
99} // namespace ROOT
int Int_t
Definition: RtypesCore.h:45
unsigned int UInt_t
Definition: RtypesCore.h:46
const Bool_t kFALSE
Definition: RtypesCore.h:101
bool Bool_t
Definition: RtypesCore.h:63
const Bool_t kTRUE
Definition: RtypesCore.h:100
#define ClassImp(name)
Definition: Rtypes.h:364
void OutputDecl(FILE *hf, int offset, UInt_t maxVarname)
Output the declaration corresponding to this proxy.
const char * GetBranchName()
Get the branch name.
const char * GetDataName()
Get the name of the data member.
Bool_t IsEquivalent(const TBranchProxyDescriptor *other, Bool_t inClass=kFALSE)
Return true if this description is the 'same' as the other description.
void OutputDecl(FILE *hf, int offset, UInt_t maxVarname)
Print the declaration needed for this descriptor.
Bool_t IsEquivalent(const TFriendProxyDescriptor *other)
Return true if this descriptor and the other are equivalent (describe the same entity).
void OutputClassDecl(FILE *hf, int offset, UInt_t maxVarname)
Print the declaration needed for this descriptor.
TFriendProxyDescriptor(const TFriendProxyDescriptor &b)
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
Definition: TCollection.h:184
void Reset()
Definition: TCollection.h:254
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:48
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
Basic string class.
Definition: TString.h:136
const char * Data() const
Definition: TString.h:369
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...