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