Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
7A Branch handling STL collection of pointers (vectors, lists, queues,
8sets 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( nullptr ),
30 fParent( nullptr ),
31 fIndArrayCl( nullptr ),
32 fClassVersion( 0 ),
33 fClCheckSum( 0 ),
34 fInfo( nullptr ),
35 fObject( nullptr ),
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
48TBranchSTL::TBranchSTL( TTree *tree, const char *name,
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 = nullptr;
61 fMother = this;
62 fParent = nullptr;
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
90TBranchSTL::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();
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=nullptr;
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 == nullptr ) {
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 ) {
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 //---------------------------------------------------------------------------
216
217 //---------------------------------------------------------------------------
218 // Set up the container of indices
219 //---------------------------------------------------------------------------
220 if( fInd.GetCapacity() < size )
222
224
225 //---------------------------------------------------------------------------
226 // Loop over the elements and create branches as needed
227 //---------------------------------------------------------------------------
229 TClass* actClass = nullptr;
230 TClass* vectClass = nullptr;
231 char* element = nullptr;
232 std::vector<void*>* elPointers = nullptr;
233 TBranchElement* elBranch = nullptr;
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 ) {
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
394
395 //---------------------------------------------------------------------------
396 // Set up vector pointers
397 //---------------------------------------------------------------------------
398 UInt_t nBranches = fBranches.GetEntriesFast();
399 TClass* elClass = fCollProxy->GetValueClass();
400 TClass* tmpClass = nullptr;
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, true );
414
415 //---------------------------------------------------------------------------
416 // Process entries
417 //---------------------------------------------------------------------------
418 UChar_t index = 0;
419 void** element = nullptr;
420 std::vector<void*>* elemVect = nullptr;
421 TBranchElement* elemBranch = nullptr;
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 = nullptr;
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 = nullptr;
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 = nullptr;
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 = nullptr;
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 = nullptr;
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
519Int_t TBranchSTL::GetExpectedType(TClass *&expectedClass,EDataType &expectedType)
520{
521 expectedClass = nullptr;
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 omitted. 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 retrieve 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 true;
597 return false;
598}
599
600////////////////////////////////////////////////////////////////////////////////
601/// Print the branch parameters.
602
603void 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;
612 Int_t *branchOffset = parent ? parent->GetBranchOffset() : nullptr;
613
614 Printf("%-16s %2d SplitCollPtr %-16s %-16s %8x %-16s n/a\n",
615 info ? info->GetName() : "StreamerInfo unavailable", 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 ) {
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 {
635 for( Int_t i = 0; i < fBranches.GetEntriesFast(); ++i ) {
637 br->Print(option);
638 }
639 }
640}
641
642////////////////////////////////////////////////////////////////////////////////
643/// Read leaves.
644
646{
647 b.ReadClassBuffer( fIndArrayCl, &fInd );
648}
649
650////////////////////////////////////////////////////////////////////////////////
651/// Fill leaves.
652
654{
655 b.WriteClassBuffer( fIndArrayCl, &fInd );
656}
657
658////////////////////////////////////////////////////////////////////////////////
659/// Set Address.
660
661void 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}
#define b(i)
Definition RSha256.hxx:100
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
unsigned char UChar_t
Definition RtypesCore.h:38
long long Long64_t
Definition RtypesCore.h:80
#define ClassImp(name)
Definition Rtypes.h:377
EDataType
Definition TDataType.h:28
@ kOther_t
Definition TDataType.h:32
Option_t Option_t option
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize id
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t bytes
char name[80]
Definition TGX11.cxx:110
void Printf(const char *fmt,...)
Formats a string in a circular formatting buffer and prints the string.
Definition TString.cxx:2503
A helper class for managing IMT work during TTree:Fill operations.
A Branch for the case of an object.
void Print(Option_t *option="") const override
Print TBranch parameters.
Int_t * GetBranchOffset() const
const char * GetClassName() const override
Return the name of the user class whose content is stored in this branch, if any.
TVirtualCollectionProxy * GetCollectionProxy()
Return the collection proxy describing the branch content, if any.
Int_t GetEntry(Long64_t entry=0, Int_t getall=0) override
Read all branches of a BranchElement and return total number of bytes.
void SetAddress(void *addobj) override
Point this branch at an object.
A Branch handling STL collection of pointers (vectors, lists, queues, sets and multisets) while stori...
Definition TBranchSTL.h:22
Int_t GetExpectedType(TClass *&clptr, EDataType &type) override
Fill expectedClass and expectedType with information on the data type of the object/values contained ...
void Browse(TBrowser *b) override
Browse an STL branch.
~TBranchSTL() override
Destructor.
Int_t FillImpl(ROOT::Internal::TBranchIMTHelper *) override
Fill an STL branch.
void ReadLeavesImpl(TBuffer &b)
Read leaves.
TClass * fIndArrayCl
! Class of the ind array
Definition TBranchSTL.h:69
TBranchSTL()
Default constructor.
void FillLeavesImpl(TBuffer &b)
Fill leaves.
void Print(Option_t *="") const override
Print the branch parameters.
bool IsFolder() const override
Branch declared folder if at least one entry.
Int_t fClassVersion
Version number of the class.
Definition TBranchSTL.h:73
TString fClassName
Name of the parent class, if we're the data member.
Definition TBranchSTL.h:72
char * fObject
! Pointer to object at address or the
Definition TBranchSTL.h:76
TBranch * fParent
! Parent of this branch
Definition TBranchSTL.h:68
TString fContName
Class name of referenced object.
Definition TBranchSTL.h:71
virtual TStreamerInfo * GetInfo() const
Get streamer info.
TStreamerInfo * fInfo
! The streamer info
Definition TBranchSTL.h:75
TIndArray fInd
! Indices
Definition TBranchSTL.h:70
Int_t fID
Element serial number in the streamer info.
Definition TBranchSTL.h:77
UInt_t fClCheckSum
Class checksum.
Definition TBranchSTL.h:74
TVirtualCollectionProxy * fCollProxy
! Collection proxy
Definition TBranchSTL.h:67
Int_t GetEntry(Long64_t entry=0, Int_t getall=0) override
Get entry.
void SetAddress(void *addr) override
Set Address.
BranchMap_t fBranchMap
! Branch map
Definition TBranchSTL.h:64
std::vector< ElementBranchHelper_t > fBranchVector
! Branch vector
Definition TBranchSTL.h:65
const char * GetClassName() const override
Return the name of the user class whose content is stored in this branch, if any.
Definition TBranchSTL.h:35
A TTree is a list of TBranches.
Definition TBranch.h:93
TString fFileName
Name of file where buffers are stored ("" if in same file as Tree header)
Definition TBranch.h:149
Int_t fMaxBaskets
Maximum number of Baskets so far.
Definition TBranch.h:125
TTree * GetTree() const
Definition TBranch.h:252
FillLeaves_t fFillLeaves
! Pointer to the FillLeaves implementation to use.
Definition TBranch.h:163
void(TBranch::* ReadLeaves_t)(TBuffer &b)
Definition TBranch.h:160
@ kDoNotProcess
Active bit for branches.
Definition TBranch.h:105
char * fAddress
! Address of 1st leaf (variable or object)
Definition TBranch.h:147
TObjArray * GetListOfBranches()
Definition TBranch.h:246
Long64_t * fBasketEntry
[fMaxBaskets] Table of first entry in each basket
Definition TBranch.h:142
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:1706
void Print(Option_t *option="") const override
Print TBranch parameters.
Definition TBranch.cxx:2341
TBranch * GetSubBranch(const TBranch *br) const
Find the parent branch of child.
Definition TBranch.cxx:2164
ReadLeaves_t fReadLeaves
! Pointer to the ReadLeaves implementation to use.
Definition TBranch.h:161
void(TBranch::* FillLeaves_t)(TBuffer &b)
Definition TBranch.h:162
Int_t fNleaves
! Number of leaves
Definition TBranch.h:128
Int_t fSplitLevel
Branch split level.
Definition TBranch.h:127
Int_t * fBasketBytes
[fMaxBaskets] Length of baskets on file
Definition TBranch.h:141
friend class TBranchElement
Definition TBranch.h:100
TObjArray fBranches
-> List of Branches of this branch
Definition TBranch.h:138
TDirectory * fDirectory
! Pointer to directory where this branch buffers are stored
Definition TBranch.h:148
TBranch * fMother
! Pointer to top-level parent branch in the tree.
Definition TBranch.h:145
virtual void SetFirstEntry(Long64_t entry)
set the first entry number (case of TBranchSTL)
Definition TBranch.cxx:3279
Long64_t * fBasketSeek
[fMaxBaskets] Addresses of baskets on file
Definition TBranch.h:143
Long64_t fFirstEntry
Number of the first entry in this branch.
Definition TBranch.h:135
Int_t fBasketSize
Initial Size of Basket Buffer.
Definition TBranch.h:118
Int_t Fill()
Definition TBranch.h:205
Long64_t fEntryNumber
Current entry number (last one filled in this branch)
Definition TBranch.h:121
TBranch * GetMother() const
Get our top-level parent branch in the tree.
Definition TBranch.cxx:2127
virtual Int_t FillImpl(ROOT::Internal::TBranchIMTHelper *)
Loop on all leaves of this branch to fill Basket buffer.
Definition TBranch.cxx:856
TTree * fTree
! Pointer to Tree header
Definition TBranch.h:144
Using a TBrowser one can browse all ROOT objects.
Definition TBrowser.h:37
Buffer base class used for serializing objects.
Definition TBuffer.h:43
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:81
UInt_t GetCheckSum(ECheckSum code=kCurrentCheckSum) const
Call GetCheckSum with validity check.
Definition TClass.cxx:6505
const TObjArray * GetStreamerInfos() const
Definition TClass.h:492
TVirtualStreamerInfo * GetStreamerInfo(Int_t version=0, Bool_t isTransient=kFALSE) const
returns a pointer to the TVirtualStreamerInfo object for version If the object does not exist,...
Definition TClass.cxx:4599
Int_t GetBaseClassOffset(const TClass *toBase, void *address=nullptr, bool isDerivedObject=true)
Definition TClass.cxx:2791
TVirtualCollectionProxy * GetCollectionProxy() const
Return the proxy describing the collection (if any).
Definition TClass.cxx:2897
Bool_t IsVersioned() const
Definition TClass.h:522
TClass * GetActualClass(const void *object) const
Return a pointer to the real class of the object.
Definition TClass.cxx:2607
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:2968
void Browse(TBrowser *b) override
Browse this collection (called by TBrowser).
UInt_t GetNumItems()
Definition TIndArray.h:34
void SetNumItems(UInt_t items)
Definition TIndArray.h:35
UInt_t GetCapacity()
Definition TIndArray.h:33
void ClearAndResize(UInt_t size)
Definition TIndArray.h:25
UChar_t & At(Int_t ind)
Definition TIndArray.h:36
A doubly linked list.
Definition TList.h:38
void Add(TObject *obj) override
Definition TList.h:83
const char * GetName() const override
Returns name of object.
Definition TNamed.h:47
TString fName
Definition TNamed.h:32
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition TNamed.cxx:140
Int_t GetEntriesFast() const
Definition TObjArray.h:58
Int_t IndexOf(const TObject *obj) const override
TObject * At(Int_t idx) const override
Definition TObjArray.h:164
TObject * UncheckedAt(Int_t i) const
Definition TObjArray.h:84
void Add(TObject *obj) override
Definition TObjArray.h:68
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition TObject.h:199
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition TObject.cxx:973
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition TObject.cxx:987
virtual TClass * GetClassPointer() const
Returns a pointer to the TClass of this element.
void ls(Option_t *option="") const override
Print the content of the element.
virtual Bool_t IsaPointer() const
Int_t GetOffset() const
const char * GetTypeNameBasic() const
Return type name of this element in case the type name is not a standard basic type,...
Describes a persistent version of a class.
Int_t GetClassVersion() const override
TStreamerElement * GetElement(Int_t id) const override
TClass * GetClass() const override
TObjArray * GetElements() const override
Basic string class.
Definition TString.h:139
Ssiz_t Length() const
Definition TString.h:417
const char * Data() const
Definition TString.h:376
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Definition TString.cxx:2356
A TTree represents a columnar dataset.
Definition TTree.h:79
TDirectory * GetDirectory() const
Definition TTree.h:462
RAII helper class that ensures that PushProxy() / PopProxy() are called when entering / leaving a C++...
Defines a common interface to inspect/change the contents of an object that represents a collection.
virtual void * New() const
Construct a new container object and return its address.
virtual TClass * GetValueClass() const =0
If the value type is a user-defined class, return a pointer to the TClass representing the value type...
virtual void Commit(void *)=0
Commits pending elements in a staging area (see Allocate() for more information).
virtual void * At(UInt_t idx)=0
Return the address of the value at index idx
virtual UInt_t Size() const =0
Return the current number of elements in the container.
virtual void * Allocate(UInt_t n, Bool_t forceDelete)=0
Allocates space for storing at least n elements.
virtual TClass * GetCollectionClass() const
Return a pointer to the TClass representing the proxied container class.
Abstract Interface class describing Streamer information for one class.
virtual UInt_t GetCheckSum() const =0
std::vector< void * > * fPointers
Definition TBranchSTL.h:57