Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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 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
29class TFile;
30class TTree;
31class TClass;
32
33class TFriendElement : public TNamed {
34
35protected:
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 fOwnFile; ///< true if file is managed by this class
41
44
45 friend void TFriendElement__SetTree(TTree *tree, TList *frlist);
46
47public:
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 ~TFriendElement() override;
57 virtual TTree *Connect();
58 virtual TTree *DisConnect();
59 virtual TFile *GetFile();
60 virtual TTree *GetParentTree() const {return fParentTree;}
61 virtual TTree *GetTree();
62 /// Get the actual TTree name of the friend.
63 /// If an alias is present, it can be retrieved with GetName().
64 virtual const char *GetTreeName() const {return fTreeName.Data();}
65 void ls(Option_t *option="") const override;
66 void Reset() { fTree = nullptr; fFile = nullptr; }
67 bool IsUpdated() const { return TestBit(kUpdated); }
70 void RecursiveRemove(TObject *obj) override;
71
72
73 ClassDefOverride(TFriendElement,2) //A friend element of another TTree
74};
75
76#endif
77
const char Option_t
Definition RtypesCore.h:66
#define BIT(n)
Definition Rtypes.h:85
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
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 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 filename
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:81
A ROOT file is composed of a header, followed by consecutive data records (TKey instances) with a wel...
Definition TFile.h:53
A TFriendElement TF describes a TTree object TF in a file.
TFriendElement()
Default constructor for a friend element.
void ls(Option_t *option="") const override
List this friend element.
TFile * fFile
! pointer to the file containing the friend TTree
virtual const char * GetTreeName() const
Get the actual TTree name of the friend.
TTree * fTree
! pointer to the TTree described by this element
virtual TTree * GetTree()
Return pointer to friend TTree.
friend void TFriendElement__SetTree(TTree *tree, TList *frlist)
Set the fTree member for all friend elements.
Definition TTree.cxx:9520
virtual TTree * GetParentTree() const
bool IsUpdated() const
void RecursiveRemove(TObject *obj) override
Forget deleted elements.
virtual TFile * GetFile()
Return pointer to TFile containing this friend TTree.
virtual TTree * Connect()
Connect file and return TTree.
~TFriendElement() override
Destructor. Disconnect from the owning tree if needed.
virtual TTree * DisConnect()
DisConnect file and TTree.
TTree * fParentTree
! pointer to the parent TTree
bool fOwnFile
true if file is managed by this class
TFriendElement(const TFriendElement &)=delete
TFriendElement & operator=(const TFriendElement &)=delete
TString fTreeName
name of the friend TTree
A doubly linked list.
Definition TList.h:38
The TNamed class is the base class for all named ROOT classes.
Definition TNamed.h:29
Mother of all ROOT objects.
Definition TObject.h:41
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition TObject.h:201
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition TObject.cxx:780
void ResetBit(UInt_t f)
Definition TObject.h:200
Basic string class.
Definition TString.h:139
const char * Data() const
Definition TString.h:376
A TTree represents a columnar dataset.
Definition TTree.h:79