Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TBranchProxyDescriptor.cxx
Go to the documentation of this file.
1// @(#)root/treeplayer:$Id$
2// Author: Philippe Canal 06/06/2004
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, Rene Brun and 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 TBranchProxyDescriptor
13/Hold the processed information about a TBranch while
14/TTreeProxyGenerator is parsing the TTree information.
15/Also contains the routine use to generate the appropriate code
16/fragment in the result of MakeProxy.
17*/
18
20
21#include "TClonesArray.h"
22#include "TError.h"
23#include "TROOT.h"
24
25#include "TTreeFormula.h"
26#include "TFormLeafInfo.h"
27#include <cctype>
28
30
31namespace ROOT {
32namespace Internal {
33
34 ////////////////////////////////////////////////////////////////////////////////
35 /// Constructor.
36
38 const char *type,
39 const char *branchname,
40 bool split,
41 bool skipped,
42 bool isleaflist) :
43 TNamed(dataname,type),fBranchName(branchname),fIsSplit(split),fBranchIsSkipped(skipped),fIsLeafList(isleaflist)
44 {
47
48 fDataName.ReplaceAll(".","_");
49 fDataName.ReplaceAll(":","_");
50 fDataName.ReplaceAll("<","_");
51 fDataName.ReplaceAll(">","_");
52 if (!isalpha(fDataName[0])) fDataName.Insert(0,"_");
53 fDataName.ReplaceAll(" ","");
54 fDataName.ReplaceAll("*","st");
55 fDataName.ReplaceAll("&","rf");
56
57 }
58
59 ////////////////////////////////////////////////////////////////////////////////
60 /// Get the name of the data member.
61
63 {
64 return fDataName;
65 }
66
67 ////////////////////////////////////////////////////////////////////////////////
68 /// Get the name of the type of the data member
69
71 {
72 return GetTitle();
73 }
74
75 ////////////////////////////////////////////////////////////////////////////////
76 /// Get the branch name.
77
79 {
80 return fBranchName.Data();
81 }
82
83 ////////////////////////////////////////////////////////////////////////////////
84 /// Return true if this description is the 'same' as the other description.
85
87 {
88 if ( !other ) return false;
89 if ( other == this ) return true;
90
91 if ( inClass ) {
92 // If this description belong to a class, the branchname will be
93 // stripped.
94 } else {
95 if ( fBranchName != other->fBranchName ) return false;
96 }
97 if ( fIsSplit != other->fIsSplit ) return false;
98 if ( fBranchIsSkipped != other->fBranchIsSkipped) return false;
99 if ( strcmp(GetName(),other->GetName()) ) return false;
100 if ( strcmp(GetTitle(),other->GetTitle()) ) return false;
101 return true;
102 }
103
104 ////////////////////////////////////////////////////////////////////////////////
105 /// Return true if the branch is split
106
108 {
109 return fIsSplit;
110 }
111
112 ////////////////////////////////////////////////////////////////////////////////
113 /// Output the declaration corresponding to this proxy
114
115 void TBranchProxyDescriptor::OutputDecl(FILE *hf, int offset, UInt_t maxVarname)
116 {
117 fprintf(hf,"%-*s%-*s %s;\n", offset," ", maxVarname, GetTypeName(), GetDataName()); // might want to add a comment
118 }
119
120 ////////////////////////////////////////////////////////////////////////////////
121 /// Output the initialization corresponding to this proxy
122
124 UInt_t maxVarname,
125 const char *prefix)
126 {
127 if (fIsSplit) {
128 const char *subbranchname = GetBranchName();
129 const char *above = "";
130 if (strncmp(prefix,subbranchname,strlen(prefix))==0
131 && strcmp(prefix,subbranchname)!=0) {
132 subbranchname += strlen(prefix)+1; // +1 for the dot "."
133 above = "ffPrefix, ";
134 }
135
136 if (fBranchIsSkipped) {
137 fprintf(hf,"\n%-*s %-*s(director, obj.GetProxy(), \"%s\", %s\"%s\")",
138 offset," ", maxVarname, GetDataName(), GetDataName(), above, subbranchname);
139 } else {
140 if (fIsLeafList) {
141 if (above[0]=='\0') {
142 fprintf(hf,"\n%-*s %-*s(director, \"%s\", \"\", \"%s\")",
143 offset," ", maxVarname, GetDataName(), subbranchname, GetDataName());
144 } else {
145 fprintf(hf,"\n%-*s %-*s(director, %s\"%s\", \"%s\")",
146 offset," ", maxVarname, GetDataName(), above, subbranchname, GetDataName());
147 }
148 } else {
149 fprintf(hf,"\n%-*s %-*s(director, %s\"%s\")",
150 offset," ", maxVarname, GetDataName(), above, subbranchname);
151 }
152 }
153 } else {
154
155 fprintf(hf,"\n%-*s %-*s(director, obj.GetProxy(), \"%s\")",
156 offset," ", maxVarname, GetDataName(), GetBranchName() );
157
158 //fprintf(hf,"\n%-*s %-*s(director, ffPrefix, \"\", \"%s\")",
159 // offset," ", maxVarname, GetName(), GetBranchName() );
160
161 }
162 }
163
164} // namespace Internal
165} // namespace ROOT
#define ClassImp(name)
Definition Rtypes.h:382
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h offset
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
bool IsSplit() const
Return true if the branch is split.
TBranchProxyDescriptor(const char *dataname, const char *type, const char *branchname, bool split=true, bool skipped=false, bool isleaflist=false)
Constructor.
void OutputDecl(FILE *hf, int offset, UInt_t maxVarname)
Output the declaration corresponding to this proxy.
const char * GetBranchName()
Get the branch name.
bool IsEquivalent(const TBranchProxyDescriptor *other, bool inClass=false)
Return true if this description is the 'same' as the other description.
const char * GetTypeName()
Get the name of the type of the data member.
const char * GetDataName()
Get the name of the data member.
void OutputInit(FILE *hf, int offset, UInt_t maxVarname, const char *prefix)
Output the initialization corresponding to this proxy.
The TNamed class is the base class for all named ROOT classes.
Definition TNamed.h:29
const char * GetName() const override
Returns name of object.
Definition TNamed.h:47
const char * GetTitle() const override
Returns title of object.
Definition TNamed.h:48
Ssiz_t Length() const
Definition TString.h:417
TString & Insert(Ssiz_t pos, const char *s)
Definition TString.h:661
const char * Data() const
Definition TString.h:376
TString & ReplaceAll(const TString &s1, const TString &s2)
Definition TString.h:704
TString & Remove(Ssiz_t pos)
Definition TString.h:685
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...