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