Logo ROOT   6.12/07
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 
44 
45  friend void TFriendElement__SetTree(TTree *tree, TList *frlist);
46 
47 public:
48  enum EStatusBits { kFromChain = BIT(11) };
50  TFriendElement(TTree *tree, const char *treename, const char *filename);
51  TFriendElement(TTree *tree, const char *treename, TFile *file);
52  TFriendElement(TTree *tree, TTree* friendtree, const char *alias);
53  virtual ~TFriendElement();
54  virtual TTree *Connect();
55  virtual TTree *DisConnect();
56  virtual TFile *GetFile();
57  virtual TTree *GetParentTree() const {return fParentTree;}
58  virtual TTree *GetTree();
59  virtual const char *GetTreeName() const {return fTreeName.Data();}
60  virtual void ls(Option_t *option="") const;
61 
62  ClassDef(TFriendElement,2) //A friend element of another TTree
63 };
64 
65 #endif
66 
TTree * fParentTree
! pointer to the parent TTree
TTree * fTree
! pointer to the TTree described by this element
virtual TTree * GetTree()
Return pointer to friend TTree.
const char Option_t
Definition: RtypesCore.h:62
friend void TFriendElement__SetTree(TTree *tree, TList *frlist)
Set the fTree member for all friend elements.
Definition: TTree.cxx:8970
#define BIT(n)
Definition: Rtypes.h:78
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
Definition: TFile.h:46
Basic string class.
Definition: TString.h:125
bool Bool_t
Definition: RtypesCore.h:59
virtual TTree * GetParentTree() const
#define ClassDef(name, id)
Definition: Rtypes.h:320
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
TFriendElement()
Default constructor for a friend element.
TString fTreeName
name of the friend TTree
virtual TTree * Connect()
Connect file and return TTree.
A doubly linked list.
Definition: TList.h:44
TFriendElement & operator=(const TFriendElement &)
Equal operator.
The ROOT global object gROOT contains a list of all defined classes.
Definition: TClass.h:75
virtual const char * GetTreeName() const
virtual void ls(Option_t *option="") const
List this friend element.
EStatusBits
Definition: TObject.h:57
virtual ~TFriendElement()
Destructor. Disconnect from the owning tree if needed.
TFile * fFile
! pointer to the file containing the friend TTree
virtual TTree * DisConnect()
DisConnect file and TTree.
virtual TFile * GetFile()
Return pointer to TFile containing this friend TTree.
Bool_t fOwnFile
true if file is managed by this class
Definition: file.py:1
A TFriendElement TF describes a TTree object TF in a file.
Definition: tree.py:1
A TTree object has a header with a name and a title.
Definition: TTree.h:70
const char * Data() const
Definition: TString.h:345