Logo ROOT  
Reference Guide
TFriendElement.h
Go to the documentation of this file.
1 // @(#)root/tree:$Id$
2 // Author: Rene Brun 07/04/2001
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 #ifndef ROOT_TFriendElement
12 #define ROOT_TFriendElement
13 
14 
15 //////////////////////////////////////////////////////////////////////////
16 // //
17 // TFriendElement //
18 // //
19 // A TFriendElement TF describes a TTree object TF in a file. //
20 // When a TFriendElement TF is added to the the list of friends of an //
21 // existing TTree T, any variable from TF can be referenced in a query //
22 // to T. //
23 // //
24 //////////////////////////////////////////////////////////////////////////
25 
26 
27 #include "TNamed.h"
28 
29 class TFile;
30 class TTree;
31 class TClass;
32 
33 class TFriendElement : public TNamed {
34 
35 protected:
36  TTree *fParentTree; ///<! pointer to the parent TTree
37  TTree *fTree; ///<! pointer to the TTree described by this element
38  TFile *fFile; ///<! pointer to the file containing the friend TTree
39  TString fTreeName; ///< name of the friend TTree
40  Bool_t fOwnFile; ///< true if file is managed by this class
41 
42  TFriendElement(const TFriendElement&) = delete;
43  TFriendElement& operator=(const TFriendElement&) = delete;
44 
45  friend void TFriendElement__SetTree(TTree *tree, TList *frlist);
46 
47 public:
48  enum EStatusBits {
49  kFromChain = BIT(9), // Indicates a TChain inserted this element in one of its content TTree
50  kUpdated = BIT(10) // Indicates that the chain 'fTree' went through a LoadTree
51  };
53  TFriendElement(TTree *tree, const char *treename, const char *filename);
54  TFriendElement(TTree *tree, const char *treename, TFile *file);
55  TFriendElement(TTree *tree, TTree* friendtree, const char *alias);
56  virtual ~TFriendElement();
57  virtual TTree *Connect();
58  virtual TTree *DisConnect();
59  virtual TFile *GetFile();
60  virtual TTree *GetParentTree() const {return fParentTree;}
61  virtual TTree *GetTree();
62  virtual const char *GetTreeName() const {return fTreeName.Data();}
63  virtual void ls(Option_t *option="") const;
64  void Reset() { fTree = nullptr; fFile = nullptr; }
65  Bool_t IsUpdated() const { return TestBit(kUpdated); }
68 
69  ClassDef(TFriendElement,2) //A friend element of another TTree
70 };
71 
72 #endif
73 
TFriendElement::DisConnect
virtual TTree * DisConnect()
DisConnect file and TTree.
Definition: TFriendElement.cxx:168
TObject::TestBit
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition: TObject.h:172
TString::Data
const char * Data() const
Definition: TString.h:369
tree
Definition: tree.py:1
TFriendElement::TFriendElement
TFriendElement()
Default constructor for a friend element.
Definition: TFriendElement.cxx:38
TNamed.h
TTree
Definition: TTree.h:79
TFriendElement
Definition: TFriendElement.h:33
TString
Definition: TString.h:136
bool
TFriendElement::fOwnFile
Bool_t fOwnFile
true if file is managed by this class
Definition: TFriendElement.h:40
Option_t
const typedef char Option_t
Definition: RtypesCore.h:66
TFriendElement::Connect
virtual TTree * Connect()
Connect file and return TTree.
Definition: TFriendElement.cxx:157
TObject::ResetBit
void ResetBit(UInt_t f)
Definition: TObject.h:171
TObject::SetBit
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition: TObject.cxx:696
TFriendElement::GetTree
virtual TTree * GetTree()
Return pointer to friend TTree.
Definition: TFriendElement.cxx:209
TFriendElement::ls
virtual void ls(Option_t *option="") const
List this friend element.
Definition: TFriendElement.cxx:238
TFriendElement::~TFriendElement
virtual ~TFriendElement()
Destructor. Disconnect from the owning tree if needed.
Definition: TFriendElement.cxx:149
TNamed
Definition: TNamed.h:29
TFriendElement::kFromChain
@ kFromChain
Definition: TFriendElement.h:49
BIT
#define BIT(n)
Definition: Rtypes.h:85
TFriendElement::fFile
TFile * fFile
! pointer to the file containing the friend TTree
Definition: TFriendElement.h:38
TFriendElement::fTreeName
TString fTreeName
name of the friend TTree
Definition: TFriendElement.h:39
TFile
Definition: TFile.h:54
TFriendElement::IsUpdated
Bool_t IsUpdated() const
Definition: TFriendElement.h:65
TFriendElement::GetFile
virtual TFile * GetFile()
Return pointer to TFile containing this friend TTree.
Definition: TFriendElement.cxx:183
TFriendElement::ResetUpdated
void ResetUpdated()
Definition: TFriendElement.h:66
TFriendElement::TFriendElement__SetTree
friend void TFriendElement__SetTree(TTree *tree, TList *frlist)
Set the fTree member for all friend elements.
Definition: TTree.cxx:9321
TFriendElement::GetParentTree
virtual TTree * GetParentTree() const
Definition: TFriendElement.h:60
TFriendElement::operator=
TFriendElement & operator=(const TFriendElement &)=delete
TClass
Definition: TClass.h:80
file
Definition: file.py:1
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TFriendElement::kUpdated
@ kUpdated
Definition: TFriendElement.h:50
TFriendElement::fParentTree
TTree * fParentTree
! pointer to the parent TTree
Definition: TFriendElement.h:36
TFriendElement::fTree
TTree * fTree
! pointer to the TTree described by this element
Definition: TFriendElement.h:37
TFriendElement::GetTreeName
virtual const char * GetTreeName() const
Definition: TFriendElement.h:62
TFriendElement::MarkUpdated
void MarkUpdated()
Definition: TFriendElement.h:67
TFriendElement::Reset
void Reset()
Definition: TFriendElement.h:64
TObject::EStatusBits
EStatusBits
Definition: TObject.h:57
TList
Definition: TList.h:44