Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
TBranchSTL.h
Go to the documentation of this file.
1 // @(#)root/tree:$Id$
2 // author: Lukasz Janyst <ljanyst@cern.ch>
3 
4 //------------------------------------------------------------------------------
5 // file: TBranchSTL.h
6 //------------------------------------------------------------------------------
7 
8 #ifndef ROOT_TBranchSTL
9 #define ROOT_TBranchSTL
10 
11 #include "TBranch.h"
12 #include "TTree.h"
14 #include "TBrowser.h"
15 #include "TBranchObject.h"
16 #include "TBranchElement.h"
17 #include "TIndArray.h"
18 #include <map>
19 #include <vector>
20 #include <utility>
21 
22 class TBranchSTL: public TBranch {
23  public:
24  TBranchSTL();
25  TBranchSTL( TTree* tree, const char* name,
26  TVirtualCollectionProxy* collProxy,
27  Int_t buffsize, Int_t splitlevel );
28  TBranchSTL( TBranch* parent, const char* name,
29  TVirtualCollectionProxy* collProxy,
30  Int_t buffsize, Int_t splitlevel,
31  TStreamerInfo* info, Int_t id );
32  virtual ~TBranchSTL();
33  virtual void Browse( TBrowser *b );
34  virtual Bool_t IsFolder() const;
35  virtual const char *GetClassName() const { return fClassName.Data(); }
36  virtual Int_t GetExpectedType(TClass *&clptr,EDataType &type);
37  virtual Int_t GetEntry( Long64_t entry = 0, Int_t getall = 0 );
38  virtual TStreamerInfo *GetInfo() const;
39  virtual void Print(Option_t*) const;
40  virtual void SetAddress( void* addr );
41 
42  ClassDef( TBranchSTL, 1 ) //Branch handling STL collection of pointers
43 
44  private:
45 
46  void ReadLeavesImpl( TBuffer& b );
47  void FillLeavesImpl( TBuffer& b );
48  virtual Int_t FillImpl(ROOT::Internal::TBranchIMTHelper *);
49 
50  struct ElementBranchHelper_t
51  {
52  ElementBranchHelper_t():
53  fBranch( 0 ), fPointers( 0 ), fId( 0 ),
54  fBaseOffset( 0 ), fPosition( 0 ) {}
55 
56  TBranchElement* fBranch;
57  std::vector<void*>* fPointers;
58  UChar_t fId;
59  UInt_t fBaseOffset;
60  Int_t fPosition;
61  };
62 
63  typedef std::map<TClass*, ElementBranchHelper_t> BranchMap_t;
64  BranchMap_t fBranchMap; ///<! Branch map
65  std::vector<ElementBranchHelper_t> fBranchVector; ///<! Branch vector
66 
67  TVirtualCollectionProxy* fCollProxy; ///<! Collection proxy
68  TBranch* fParent; ///<! Parent of this branch
69  TClass* fIndArrayCl; ///<! Class of the ind array
70  TIndArray fInd; ///<! Indices
71  TString fContName; ///< Class name of referenced object
72  TString fClassName; ///< Name of the parent class, if we're the data member
73  mutable Int_t fClassVersion; ///< Version number of the class
74  UInt_t fClCheckSum; ///< Class checksum
75  mutable TStreamerInfo *fInfo; ///<! The streamer info
76  char* fObject; ///<! Pointer to object at address or the
77  Int_t fID; ///< Element serial number in the streamer info
78 };
79 
80 #endif // ROOT_TBranchSTL