ROOT  6.06/09
Reference Guide
TBranchSTL.cxx
Go to the documentation of this file.
1 // @(#)root/tree:$Id$
2 // Author Lukasz Janyst <ljanyst@cern.ch> 23/01/2008
3 
4 /** \class TBranchSTL
5 A Branch handling STL collection of pointers (vectors, lists, queues,
6 sets and multisets) while storing them in split mode.
7 */
8 
9 #include "TBranchSTL.h"
10 #include "TList.h"
11 #include "TBranchElement.h"
12 #include "TBasket.h"
13 #include "TStreamerInfo.h"
14 #include "TStreamerElement.h"
15 #include <string>
16 #include <utility>
17 
18 #include "TError.h"
19 
21 
22 ////////////////////////////////////////////////////////////////////////////////
23 /// Default constructor.
24 
26  fCollProxy( 0 ),
27  fParent( 0 ),
28  fIndArrayCl( 0 ),
29  fClassVersion( 0 ),
30  fClCheckSum( 0 ),
31  fInfo( 0 ),
32  fObject( 0 ),
33  fID( -2 )
34 {
35  fIndArrayCl = TClass::GetClass( "TIndArray" );
36  fBranchVector.reserve( 25 );
37  fNleaves = 0;
38  fReadLeaves = (ReadLeaves_t)&TBranchSTL::ReadLeavesImpl;
39  fFillLeaves = (FillLeaves_t)&TBranchSTL::FillLeavesImpl;
40 }
41 
42 ////////////////////////////////////////////////////////////////////////////////
43 /// Normal constructor, called from TTree.
44 
45 TBranchSTL::TBranchSTL( TTree *tree, const char *name,
46  TVirtualCollectionProxy *collProxy,
47  Int_t buffsize, Int_t splitlevel )
48 {
49  fTree = tree;
50  fCollProxy = collProxy;
51  fBasketSize = buffsize;
52  fSplitLevel = splitlevel;
53  fContName = collProxy->GetCollectionClass()->GetName();
54  fClCheckSum = 0;
55  fClassVersion = 1;
56  fID = -2;
57  fInfo = 0;
58  fMother = this;
59  fParent = 0;
61  fFileName = "";
62  SetName( name );
63  fIndArrayCl = TClass::GetClass( "TIndArray" );
64  fBranchVector.reserve( 25 );
65  fNleaves = 0;
68 
69  //---------------------------------------------------------------------------
70  // Allocate and initialize the basket control arrays
71  /////////////////////////////////////////////////////////////////////////////
72 
76 
77  for (Int_t i = 0; i < fMaxBaskets; ++i) {
78  fBasketBytes[i] = 0;
79  fBasketEntry[i] = 0;
80  fBasketSeek[i] = 0;
81  }
82 
83 }
84 
85 ////////////////////////////////////////////////////////////////////////////////
86 /// Normal constructor, called from another branch.
87 
88 TBranchSTL::TBranchSTL( TBranch* parent, const char* name,
89  TVirtualCollectionProxy* collProxy,
90  Int_t buffsize, Int_t splitlevel,
91  TStreamerInfo* info, Int_t id )
92 {
93  fTree = parent->GetTree();
94  fCollProxy = collProxy;
95  fBasketSize = buffsize;
96  fSplitLevel = splitlevel;
97  fContName = collProxy->GetCollectionClass()->GetName();
98  fClassName = info->GetClass()->GetName();
100  fClCheckSum = info->GetClass()->GetCheckSum();
101  fInfo = info;
102  fID = id;
103  fMother = parent->GetMother();
104  fParent = parent;
106  fFileName = "";
107  fNleaves = 0;
110 
111  SetName( name );
112  fIndArrayCl = TClass::GetClass( "TIndArray" );
113  fBranchVector.reserve( 25 );
114 
115  //---------------------------------------------------------------------------
116  // Allocate and initialize the basket control arrays
117  /////////////////////////////////////////////////////////////////////////////
118 
122 
123  for (Int_t i = 0; i < fMaxBaskets; ++i) {
124  fBasketBytes[i] = 0;
125  fBasketEntry[i] = 0;
126  fBasketSeek[i] = 0;
127  }
128 
129 }
130 
131 ////////////////////////////////////////////////////////////////////////////////
132 /// Destructor.
133 
135 {
136  BranchMap_t::iterator brIter;
137  for( brIter = fBranchMap.begin(); brIter != fBranchMap.end(); ++brIter ) {
138  (*brIter).second.fPointers->clear();
139  delete (*brIter).second.fPointers;
140  }
141 }
142 
143 ////////////////////////////////////////////////////////////////////////////////
144 /// Browse a STL branch.
145 
147 {
148  Int_t nbranches = fBranches.GetEntriesFast();
149  if (nbranches > 0) {
150  TList persistentBranches;
151  TBranch* branch=0;
152  TIter iB(&fBranches);
153  while( (branch = (TBranch*)iB()) )
154  persistentBranches.Add(branch);
155  persistentBranches.Browse( b );
156  }
157 }
158 
159 ////////////////////////////////////////////////////////////////////////////////
160 /// Cleanup after revious fill.
161 
163 {
164  BranchMap_t::iterator brIter;
165  for( brIter = fBranchMap.begin(); brIter != fBranchMap.end(); ++brIter )
166  (*brIter).second.fPointers->clear();
167 
168  //---------------------------------------------------------------------------
169  // Check if we're dealing with the null pointer here
170  /////////////////////////////////////////////////////////////////////////////
171  ///------------------------------------------------------------------------
172  /// We have received a zero pointer - treat it as an empty collection
173  ///------------------------------------------------------------------------
174 
175  if( fAddress != fObject ) {
176  if( fObject == 0 ) {
177  Int_t bytes = 0;
178  Int_t totalBytes = 0;
179 
180  //---------------------------------------------------------------------
181  // Store the indices
182  ///////////////////////////////////////////////////////////////////////
183 
184  fInd.SetNumItems( 0 );
185  bytes = TBranch::Fill();
186 
187  if( bytes < 0 ) {
188  Error( "Fill", "The IO error while writing the indices!");
189  return -1;
190  }
191  totalBytes += bytes;
192 
193  //---------------------------------------------------------------------
194  // Store the branches
195  ///////////////////////////////////////////////////////////////////////
196 
197  for( Int_t i = 0; i < fBranches.GetEntriesFast(); ++i ) {
198  TBranch *br = (TBranch *)fBranches.UncheckedAt(i);
199  bytes = br->Fill();
200  if( bytes < 0 ) {
201  Error( "Fill", "The IO error while writing the branch %s!", br->GetName() );
202  return -1;
203  }
204  totalBytes += bytes;
205  }
206  return totalBytes;
207  }
208  }
209 
210  //---------------------------------------------------------------------------
211  // Set upt the collection proxy
212  /////////////////////////////////////////////////////////////////////////////
213 
215  UInt_t size = fCollProxy->Size();
216 
217  //---------------------------------------------------------------------------
218  // Set up the container of indices
219  /////////////////////////////////////////////////////////////////////////////
220 
221  if( fInd.GetCapacity() < size )
222  fInd.ClearAndResize( size );
223 
224  fInd.SetNumItems( size );
225 
226  //---------------------------------------------------------------------------
227  // Loop over the elements and create branches as needed
228  /////////////////////////////////////////////////////////////////////////////
229 
231  TClass* actClass = 0;
232  TClass* vectClass = 0;
233  char* element = 0;
234  std::vector<void*>* elPointers = 0;
235  TBranchElement* elBranch = 0;
236  UInt_t elOffset = 0;
237  UChar_t maxID = fBranches.GetEntriesFast()+1;
238  UChar_t elID;
239  ElementBranchHelper_t bHelper;
240  Int_t totalBytes = 0;
241  Int_t bytes = 0;
242  TString brName;
243 
244  for( UInt_t i = 0; i < size; ++i ) {
245  //------------------------------------------------------------------------
246  // Determine the actual class of current element
247  //////////////////////////////////////////////////////////////////////////
248 
249  element = *(char**)fCollProxy->At( i );
250  if( !element ) {
251  fInd.At(i) = 0;
252  continue;
253  }
254 
255  // coverity[dereference] since this is a TBranchSTL by definition the collection contains pointers to objects.
256  actClass = cl->GetActualClass( element );
257  brIter = fBranchMap.find( actClass );
258 
259  //------------------------------------------------------------------------
260  // The branch was not found - create a new one
261  //////////////////////////////////////////////////////////////////////////
262  ///---------------------------------------------------------------------
263  /// Find the dictionary for vector of pointers to this class
264  ///---------------------------------------------------------------------
265 
266  if( brIter == fBranchMap.end() ) {
267  std::string vectClName("vector<");
268  vectClName += actClass->GetName() + std::string("*>");
269  vectClass = TClass::GetClass( vectClName.c_str() );
270  if( !vectClass ) {
271  Warning( "Fill", "Unable to find dictionary for class %s", vectClName.c_str() );
272  continue;
273  }
274 
275  //---------------------------------------------------------------------
276  // Create the vector of pointers to objects of this type and new branch
277  // for it
278  ///////////////////////////////////////////////////////////////////////
279  /// The top level branch already has a trailing dot.
280 
281  elPointers = new std::vector<void*>();//vectClass->GetCollectionProxy()->New();
282  if (fName.Length() && fName[fName.Length()-1]=='.') {
283  brName.Form( "%s%s", GetName(), actClass->GetName() );
284  } else {
285  brName.Form( "%s.%s", GetName(), actClass->GetName() );
286  }
287  elBranch = new TBranchElement( this, brName,
288  vectClass->GetCollectionProxy(),
290  elID = maxID++;
291  elBranch->SetFirstEntry( fEntryNumber );
292 
293  fBranches.Add( elBranch );
294 
295  bHelper.fId = elID;
296  bHelper.fBranch = elBranch;
297  bHelper.fPointers = elPointers;
298  bHelper.fBaseOffset = actClass->GetBaseClassOffset( cl );
299 
300  // This copies the value of fPointes into the vector and transfers
301  // its ownership to the vector. It will be deleted in ~TBranch.
302  brIter = fBranchMap.insert(std::make_pair(actClass, bHelper ) ).first;
303  elBranch->SetAddress( &((*brIter).second.fPointers) );
304  }
305  //------------------------------------------------------------------------
306  // The branch for this type already exists - set up the pointers
307  //////////////////////////////////////////////////////////////////////////
308 
309  else {
310  elPointers = (*brIter).second.fPointers;
311  elBranch = (*brIter).second.fBranch;
312  elID = (*brIter).second.fId;
313  elOffset = (*brIter).second.fBaseOffset;
314  }
315 
316  //-------------------------------------------------------------------------
317  // Add the element to the appropriate vector
318  //////////////////////////////////////////////////////////////////////////
319 
320  elPointers->push_back( element + elOffset );
321  fInd.At(i) = elID;
322  }
323 
324  //----------------------------------------------------------------------------
325  // Store the indices
326  /////////////////////////////////////////////////////////////////////////////
327 
328  bytes = TBranch::Fill();
329  if( bytes < 0 ) {
330  Error( "Fill", "The IO error while writing the indices!");
331  return -1;
332  }
333  totalBytes += bytes;
334 
335  //----------------------------------------------------------------------------
336  // Fill the branches
337  /////////////////////////////////////////////////////////////////////////////
338 
339  for( Int_t i = 0; i < fBranches.GetEntriesFast(); ++i ) {
340  TBranch *br = (TBranch *)fBranches.UncheckedAt(i);
341  bytes = br->Fill();
342  if( bytes < 0 ) {
343  Error( "Fill", "The IO error while writing the branch %s!", br->GetName() );
344  return -1;
345  }
346  totalBytes += bytes;
347  }
348 
349  return totalBytes;
350 }
351 
352 ////////////////////////////////////////////////////////////////////////////////
353 /// Check if we should be doing this at all.
354 
356 {
357  if( TestBit( kDoNotProcess ) && !getall )
358  return 0;
359 
360  if ( (entry < fFirstEntry) || (entry >= fEntryNumber) )
361  return 0;
362 
363  if( !fAddress )
364  return 0;
365 
366  //---------------------------------------------------------------------------
367  // Set up the collection proxy
368  /////////////////////////////////////////////////////////////////////////////
369 
370  if( !fCollProxy ) {
372 
373  if( !cl ) {
374  Error( "GetEntry", "Dictionary class not found for: %s", fContName.Data() );
375  return -1;
376  }
377 
379  if( !fCollProxy ) {
380  Error( "GetEntry", "No collection proxy!" );
381  return -1;
382  }
383  }
384 
385  //---------------------------------------------------------------------------
386  // Get the indices
387  /////////////////////////////////////////////////////////////////////////////
388 
389  Int_t totalBytes = 0;
390  Int_t bytes = TBranch::GetEntry( entry, getall );
391  totalBytes += bytes;
392 
393  if( bytes == 0 )
394  return 0;
395 
396  if( bytes < 0 ) {
397  Error( "GetEntry", "IO error! Unable to get the indices!" );
398  return -1;
399  }
400 
401  Int_t size = fInd.GetNumItems();
402 
403  //---------------------------------------------------------------------------
404  // Set up vector pointers
405  /////////////////////////////////////////////////////////////////////////////
406 
407  UInt_t nBranches = fBranches.GetEntriesFast();
408  TClass* elClass = fCollProxy->GetValueClass();
409  TClass* tmpClass = 0;
410 
411  if( fBranchVector.size() < nBranches )
412  fBranchVector.resize( nBranches );
413 
414  //---------------------------------------------------------------------------
415  // Create the object
416  /////////////////////////////////////////////////////////////////////////////
417 
418  if( fAddress != fObject ) {
419  *((void **)fAddress) = fCollProxy->New();
420  fObject = *(char**)fAddress;
421  }
423  void* env = fCollProxy->Allocate( size, kTRUE );
424 
425  //---------------------------------------------------------------------------
426  // Process entries
427  /////////////////////////////////////////////////////////////////////////////
428 
429  UChar_t index = 0;
430  void** element = 0;
431  std::vector<void*>* elemVect = 0;
432  TBranchElement* elemBranch = 0;
433 
434  for( Int_t i = 0; i < size; ++i ) {
435  element = (void**)fCollProxy->At(i);
436  index = fInd.At(i);
437 
438  //------------------------------------------------------------------------
439  // The case of zero pointers
440  //////////////////////////////////////////////////////////////////////////
441 
442  if( index == 0 ) {
443  *element = 0;
444  continue;
445  }
446 
447  //-------------------------------------------------------------------------
448  // Index out of range!
449  //////////////////////////////////////////////////////////////////////////
450 
451  if( index > nBranches ) {
452  Error( "GetEntry", "Index %d out of range, unable to find the branch, setting pointer to 0",
453  index );
454  *element = 0;
455  continue;
456  }
457 
458  //------------------------------------------------------------------------
459  // Load unloaded branch
460  //////////////////////////////////////////////////////////////////////////
461 
462  index--;
463  elemVect = fBranchVector[index].fPointers;
464  if( !elemVect ) {
465  elemBranch = (TBranchElement *)fBranches.UncheckedAt(index);
466  elemBranch->SetAddress( &(fBranchVector[index].fPointers) );
467 
468  bytes = elemBranch->GetEntry( entry, getall );
469 
470  if( bytes == 0 ) {
471  Error( "GetEntry", "No entry for index %d, setting pointer to 0", index );
472  *element = 0;
473  fBranchVector[index].fPosition++;
474  continue;
475  }
476 
477  if( bytes <= 0 ) {
478  Error( "GetEntry", "I/O error while getting entry for index %d, setting pointer to 0", index );
479  *element = 0;
480  fBranchVector[index].fPosition++;
481  continue;
482  }
483  totalBytes += bytes;
484  elemVect = fBranchVector[index].fPointers;
485 
486  //---------------------------------------------------------------------
487  // Calculate the base class offset
488  ///////////////////////////////////////////////////////////////////////
489 
490  TVirtualCollectionProxy *proxy = elemBranch->GetCollectionProxy();
491  if (!proxy) {
492  proxy = TClass::GetClass(elemBranch->GetClassName())->GetCollectionProxy();
493  }
494  if (proxy) {
495  tmpClass = proxy->GetValueClass();
496  if (tmpClass && elClass) {
497  fBranchVector[index].fBaseOffset = tmpClass->GetBaseClassOffset( elClass );
498  fBranchVector[index].fPosition = 0;
499  } else {
500  Error("GetEntry","Missing TClass for %s (%s)",elemBranch->GetName(),elemBranch->GetClassName());
501  }
502  } else {
503  Error("GetEntry","Missing CollectionProxy for %s (%s)",elemBranch->GetName(),elemBranch->GetClassName());
504  }
505  }
506 
507  //------------------------------------------------------------------------
508  // Set up the element
509  //////////////////////////////////////////////////////////////////////////
510 
511  *element = ((char*)(*elemVect)[fBranchVector[index].fPosition++])
512  - fBranchVector[index].fBaseOffset;
513 
514  }
515 
516  fCollProxy->Commit(env);
517 
518  //---------------------------------------------------------------------------
519  // Cleanup
520  /////////////////////////////////////////////////////////////////////////////
521 
522  for( UInt_t i = 0; i < fBranchVector.size(); ++i ) {
523  delete fBranchVector[i].fPointers;
524  fBranchVector[i].fPointers = 0;
525  }
526 
527  return totalBytes;
528 }
529 
530 ////////////////////////////////////////////////////////////////////////////////
531 /// Fill expectedClass and expectedType with information on the data type of the
532 /// object/values contained in this branch (and thus the type of pointers
533 /// expected to be passed to Set[Branch]Address
534 /// return 0 in case of success and > 0 in case of failure.
535 
536 Int_t TBranchSTL::GetExpectedType(TClass *&expectedClass,EDataType &expectedType)
537 {
538  expectedClass = 0;
539  expectedType = kOther_t;
540 
541  if (fID < 0) {
542  expectedClass = TClass::GetClass( fContName );
543  } else {
544  // Case of an object data member. Here we allow for the
545  // variable name to be ommitted. Eg, for Event.root with split
546  // level 1 or above Draw("GetXaxis") is the same as Draw("fH.GetXaxis()")
547  TStreamerElement* element = GetInfo()->GetElement(fID);
548  if (element) {
549  expectedClass = element->GetClassPointer();
550  if (!expectedClass) {
551  Error("GetExpectedType", "TBranchSTL did not find the TClass for %s", element->GetTypeNameBasic());
552  return 1;
553  }
554  } else {
555  Error("GetExpectedType", "Did not find the type for %s",GetName());
556  return 2;
557  }
558  }
559  return 0;
560 }
561 
562 ////////////////////////////////////////////////////////////////////////////////
563 /// Check if we don't have the streamer info.
564 
566 {
567  if( !fInfo ) {
568  //------------------------------------------------------------------------
569  // Get the class info
570  //////////////////////////////////////////////////////////////////////////
571 
573 
574  //------------------------------------------------------------------------
575  // Get unoptimized streamer info
576  //////////////////////////////////////////////////////////////////////////
577 
579 
580  //------------------------------------------------------------------------
581  // If the checksum is there and we're dealing with the foreign class
582  //////////////////////////////////////////////////////////////////////////
583  ///---------------------------------------------------------------------
584  /// Loop over the infos
585  ///---------------------------------------------------------------------
586 
587  if( fClCheckSum && !cl->IsVersioned() ) {
588  Int_t ninfos = cl->GetStreamerInfos()->GetEntriesFast() - 1;
589  for( Int_t i = -1; i < ninfos; ++i ) {
591  if( !info )
592  continue;
593 
594  //------------------------------------------------------------------
595  // If the checksum matches then retriev the info
596  ////////////////////////////////////////////////////////////////////
597 
598  if( info->GetCheckSum() == fClCheckSum ) {
599  fClassVersion = i;
601  }
602  }
603  }
604  }
605  return fInfo;
606 }
607 
608 ////////////////////////////////////////////////////////////////////////////////
609 /// Branch declared folder if at least one entry.
610 
612 {
613  if( fBranches.GetEntriesFast() >= 1 )
614  return kTRUE;
615  return kFALSE;
616 }
617 
618 ////////////////////////////////////////////////////////////////////////////////
619 /// Print the branch parameters.
620 
621 void TBranchSTL::Print(const char *option) const
622 {
623  if (strncmp(option,"debugAddress",strlen("debugAddress"))==0) {
624  if (strlen(GetName())>24) Printf("%-24s\n%-24s ", GetName(),"");
625  else Printf("%-24s ", GetName());
626 
627  TBranchElement *parent = dynamic_cast<TBranchElement*>(GetMother()->GetSubBranch(this));
628  Int_t ind = parent ? parent->GetListOfBranches()->IndexOf(this) : -1;
629  TVirtualStreamerInfo *info = GetInfo();
630  Int_t *branchOffset = parent ? parent->GetBranchOffset() : 0;
631 
632  Printf("%-16s %2d SplitCollPtr %-16s %-16s %8x %-16s n/a\n",
633  info ? info->GetName() : "StreamerInfo unvailable", fID,
634  GetClassName(), fParent ? fParent->GetName() : "n/a",
635  (branchOffset && parent && ind>=0) ? branchOffset[ind] : 0,
636  fObject);
637  for( Int_t i = 0; i < fBranches.GetEntriesFast(); ++i ) {
638  TBranch *br = (TBranch *)fBranches.UncheckedAt(i);
639  br->Print("debugAddressSub");
640  }
641  } else if (strncmp(option,"debugInfo",strlen("debugInfo"))==0) {
642  Printf("Branch %s uses:\n",GetName());
643  if (fID>=0) {
644  GetInfo()->GetElement(fID)->ls();
645  }
646  for (Int_t i = 0; i < fBranches.GetEntriesFast(); ++i) {
647  TBranchElement* subbranch = (TBranchElement*)fBranches.At(i);
648  subbranch->Print("debugInfoSub");
649  }
650  return;
651  } else {
652  TBranch::Print(option);
653  for( Int_t i = 0; i < fBranches.GetEntriesFast(); ++i ) {
654  TBranch *br = (TBranch *)fBranches.UncheckedAt(i);
655  br->Print(option);
656  }
657  }
658 }
659 
660 ////////////////////////////////////////////////////////////////////////////////
661 /// Read leaves.
662 
664 {
666 }
667 
668 ////////////////////////////////////////////////////////////////////////////////
669 /// Fill leaves.
670 
672 {
674 }
675 
676 ////////////////////////////////////////////////////////////////////////////////
677 /// We are the top level branch.
678 
679 void TBranchSTL::SetAddress( void* addr )
680 {
681  if( fID < 0 ) {
682  fAddress = (char*)addr;
683  fObject = *(char**)addr;
684  }
685  //---------------------------------------------------------------------------
686  // We are a data member of some other class
687  /////////////////////////////////////////////////////////////////////////////
688  ///------------------------------------------------------------------------
689  /// Get the appropriate streamer element
690  ///------------------------------------------------------------------------
691 
692  else {
693  GetInfo();
695 
696  //------------------------------------------------------------------------
697  // Set up the addresses
698  //////////////////////////////////////////////////////////////////////////
699 
700  if( el->IsaPointer() ) {
701  fAddress = (char*)addr+el->GetOffset();
702  fObject = *(char**)fAddress;
703  } else {
704  fAddress = (char*)addr+el->GetOffset();
705  fObject = (char*)addr+el->GetOffset();
706  }
707  }
708 }
Describe Streamer information for one class version.
Definition: TStreamerInfo.h:47
virtual Int_t GetEntry(Long64_t entry=0, Int_t getall=0)
Check if we should be doing this at all.
Definition: TBranchSTL.cxx:355
virtual void Print(Option_t *option="") const
Print branch parameters.
TVirtualCollectionProxy * GetCollectionProxy()
Return the collection proxy describing the branch content, if any.
virtual void * Allocate(UInt_t n, Bool_t forceDelete)=0
TString fContName
Indices.
Definition: TBranchSTL.h:73
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
Int_t GetOffset() const
long long Long64_t
Definition: RtypesCore.h:69
Ssiz_t Length() const
Definition: TString.h:390
UChar_t & At(Int_t ind)
Definition: TIndArray.h:38
virtual TClass * GetValueClass() const =0
ReadLeaves_t fReadLeaves
Definition: TBranch.h:106
virtual void SetName(const char *name)
Change (i.e.
Definition: TNamed.cxx:128
virtual void SetFirstEntry(Long64_t entry)
set the first entry number (case of TBranchSTL)
Definition: TBranch.cxx:2618
virtual void Commit(void *)=0
virtual void Print(Option_t *option="") const
Print TBranch parameters.
Definition: TBranch.cxx:1726
Buffer base class used for serializing objects.
Definition: TBuffer.h:40
Basic string class.
Definition: TString.h:137
virtual void SetAddress(void *addobj)
Point this branch at an object.
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
Int_t fNleaves
Definition: TBranch.h:78
TStreamerInfo * fInfo
Definition: TBranchSTL.h:77
Int_t GetEntriesFast() const
Definition: TObjArray.h:66
Long64_t * fBasketSeek
Definition: TBranch.h:93
virtual Int_t GetExpectedType(TClass *&clptr, EDataType &type)
Fill expectedClass and expectedType with information on the data type of the object/values contained ...
Definition: TBranchSTL.cxx:536
virtual const char * GetClassName() const
Return the name of the user class whose content is stored in this branch, if any. ...
Definition: TBranchSTL.h:36
TIndArray fInd
Class of the ind array.
Definition: TBranchSTL.h:72
Bool_t IsVersioned() const
Definition: TClass.h:463
virtual TClass * GetCollectionClass() const
Int_t * fBasketBytes
Definition: TBranch.h:91
Int_t fClassVersion
Definition: TBranchSTL.h:75
Long64_t fEntryNumber
Definition: TBranch.h:73
Int_t fID
Pointer to object at address or the.
Definition: TBranchSTL.h:79
UInt_t GetCapacity()
Definition: TIndArray.h:35
const char * Data() const
Definition: TString.h:349
Int_t GetBaseClassOffset(const TClass *toBase, void *address=0, bool isDerivedObject=true)
Definition: TClass.cxx:2705
virtual Bool_t IsFolder() const
Branch declared folder if at least one entry.
Definition: TBranchSTL.cxx:611
virtual void SetAddress(void *addr)
We are the top level branch.
Definition: TBranchSTL.cxx:679
void ReadLeavesImpl(TBuffer &b)
Pointer to the FillLeaves implementation to use.
Definition: TBranch.cxx:1827
void ClearAndResize(UInt_t size)
Definition: TIndArray.h:27
TClass * GetActualClass(const void *object) const
Return a pointer the the real class of the object.
Definition: TClass.cxx:2524
TClass * fIndArrayCl
Parent of this branch.
Definition: TBranchSTL.h:71
UInt_t fClCheckSum
Definition: TBranchSTL.h:76
UInt_t GetNumItems()
Definition: TIndArray.h:36
virtual Bool_t IsaPointer() const
const Int_t kDoNotProcess
Definition: TBranch.h:52
TObjArray * GetListOfBranches()
Definition: TBranch.h:177
TClass * GetClass() const
Int_t fMaxBaskets
Definition: TBranch.h:75
XFontStruct * id
Definition: TGX11.cxx:108
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:918
virtual Int_t GetEntry(Long64_t entry=0, Int_t getall=0)
Read all branches of a BranchElement and return total number of bytes.
virtual ~TBranchSTL()
Destructor.
Definition: TBranchSTL.cxx:134
Int_t GetClassVersion() const
UInt_t GetCheckSum(ECheckSum code=kCurrentCheckSum) const
Call GetCheckSum with validity check.
Definition: TClass.cxx:6042
TString fClassName
Definition: TBranchSTL.h:74
Int_t fSplitLevel
Number of baskets in memory.
Definition: TBranch.h:77
A doubly linked list.
Definition: TList.h:47
virtual Int_t Fill()
Loop on all leaves of this branch to fill Basket buffer.
Definition: TBranch.cxx:723
TObject * UncheckedAt(Int_t i) const
Definition: TObjArray.h:91
Using a TBrowser one can browse all ROOT objects.
Definition: TBrowser.h:41
void(TBranch::* ReadLeaves_t)(TBuffer &b)
After being read, the buffer will not be unziped.
Definition: TBranch.h:105
virtual void ls(Option_t *option="") const
Print the content of the element.
void FillLeavesImpl(TBuffer &b)
Loop on all leaves of this branch to fill Basket buffer.
Definition: TBranch.cxx:1862
Int_t IndexOf(const TObject *obj) const
Definition: TObjArray.cxx:551
Int_t fBasketSize
Definition: TBranch.h:70
TObjArray * GetElements() const
TVirtualCollectionProxy * fCollProxy
Branch vector.
Definition: TBranchSTL.h:69
TVirtualStreamerInfo * GetStreamerInfo(Int_t version=0) const
returns a pointer to the TVirtualStreamerInfo object for version If the object does not exist...
Definition: TClass.cxx:4337
const char * GetTypeNameBasic() const
Return type name of this element in case the type name is not a standard basic type, return the basic type name known to CINT.
TDirectory * GetDirectory() const
Definition: TTree.h:381
TBranch * GetMother() const
Get our top-level parent branch in the tree.
Definition: TBranch.cxx:1532
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Definition: TString.cxx:2321
FillLeaves_t fFillLeaves
Definition: TBranch.h:108
unsigned int UInt_t
Definition: RtypesCore.h:42
Bool_t TestBit(UInt_t f) const
Definition: TObject.h:173
virtual void * New() const
virtual Int_t GetEntry(Long64_t entry=0, Int_t getall=0)
Read all leaves of entry and return total number of bytes read.
Definition: TBranch.cxx:1198
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:51
The ROOT global object gROOT contains a list of all defined classes.
Definition: TClass.h:81
BranchMap_t fBranchMap
Definition: TBranchSTL.h:65
TBranch * GetSubBranch(const TBranch *br) const
Find the parent branch of child.
Definition: TBranch.cxx:1553
Long64_t entry
Int_t * GetBranchOffset() const
TString fName
Definition: TNamed.h:36
TTree * GetTree() const
Definition: TBranch.h:183
A Branch for the case of an object.
#define Printf
Definition: TGeoToOCC.h:18
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=0)=0
void SetNumItems(UInt_t items)
Definition: TIndArray.h:37
std::vector< void * > * fPointers
Definition: TBranchSTL.h:58
virtual TClass * GetClassPointer() const
Returns a pointer to the TClass of this element.
EDataType
Definition: TDataType.h:30
virtual void * At(UInt_t idx)=0
char * fObject
The streamer info.
Definition: TBranchSTL.h:78
TTree * fTree
Definition: TBranch.h:94
void Browse(TBrowser *b)
Browse this collection (called by TBrowser).
virtual const char * GetClassName() const
Return the name of the user class whose content is stored in this branch, if any. ...
TDirectory * fDirectory
Address of 1st leaf (variable or object)
Definition: TBranch.h:98
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
Definition: TClass.cxx:2881
TVirtualCollectionProxy * GetCollectionProxy() const
Return the proxy describing the collection (if any).
Definition: TClass.cxx:2810
#define name(a, b)
Definition: linkTestLib0.cpp:5
A Branch handling STL collection of pointers (vectors, lists, queues, sets and multisets) while stori...
Definition: TBranchSTL.h:22
virtual UInt_t Size() const =0
TBranch * fParent
Collection proxy.
Definition: TBranchSTL.h:70
virtual TStreamerInfo * GetInfo() const
Check if we don't have the streamer info.
Definition: TBranchSTL.cxx:565
Long64_t * fBasketEntry
Definition: TBranch.h:92
virtual void Add(TObject *obj)
Definition: TList.h:81
void(TBranch::* FillLeaves_t)(TBuffer &b)
Pointer to the ReadLeaves implementation to use.
Definition: TBranch.h:107
TBranch * fMother
Pointer to Tree header.
Definition: TBranch.h:95
TStreamerElement * GetElement(Int_t id) const
std::vector< ElementBranchHelper_t > fBranchVector
Branch map.
Definition: TBranchSTL.h:66
const TObjArray * GetStreamerInfos() const
Definition: TClass.h:447
void Add(TObject *obj)
Definition: TObjArray.h:75
A TTree object has a header with a name and a title.
Definition: TTree.h:94
virtual void Browse(TBrowser *b)
Browse a STL branch.
Definition: TBranchSTL.cxx:146
unsigned char UChar_t
Definition: RtypesCore.h:34
virtual Int_t Fill()
Cleanup after revious fill.
Definition: TBranchSTL.cxx:162
TObjArray fBranches
Definition: TBranch.h:88
TObject * At(Int_t idx) const
Definition: TObjArray.h:167
A TTree is a list of TBranches.
Definition: TBranch.h:58
Abstract Interface class describing Streamer information for one class.
const Bool_t kTRUE
Definition: Rtypes.h:91
TString fFileName
Pointer to directory where this branch buffers are stored.
Definition: TBranch.h:99
Long64_t fFirstEntry
Definition: TBranch.h:85
virtual void Print(Option_t *) const
Print the branch parameters.
Definition: TBranchSTL.cxx:621
ClassImp(TBranchSTL) TBranchSTL
Default constructor.
Definition: TBranchSTL.cxx:20
virtual UInt_t GetCheckSum() const =0
char * fAddress
Pointer to parent branch.
Definition: TBranch.h:97
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition: TObject.cxx:904