Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/TFriendElement.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // @(#)root/tree:$Id$
0002 // Author: Rene Brun   07/04/2001
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 #ifndef ROOT_TFriendElement
0012 #define ROOT_TFriendElement
0013 
0014 
0015 //////////////////////////////////////////////////////////////////////////
0016 //                                                                      //
0017 // TFriendElement                                                       //
0018 //                                                                      //
0019 // A TFriendElement TF describes a TTree object TF in a file.           //
0020 // When a TFriendElement TF is added to the list of friends of an   //
0021 // existing TTree T, any variable from TF can be referenced in a query  //
0022 // to T.                                                                //
0023 //                                                                      //
0024 //////////////////////////////////////////////////////////////////////////
0025 
0026 
0027 #include "TNamed.h"
0028 
0029 class TFile;
0030 class TTree;
0031 class TClass;
0032 
0033 class TFriendElement : public TNamed {
0034 
0035 protected:
0036    TTree        *fParentTree;  ///<! pointer to the parent TTree
0037    TTree        *fTree;        ///<! pointer to the TTree described by this element
0038    TFile        *fFile;        ///<! pointer to the file containing the friend TTree
0039    TString       fTreeName;    ///<  name of the friend TTree
0040    bool          fOwnFile;     ///<  true if file is managed by this class
0041 
0042    TFriendElement(const TFriendElement&) = delete;
0043    TFriendElement& operator=(const TFriendElement&) = delete;
0044 
0045    friend void TFriendElement__SetTree(TTree *tree, TList *frlist);
0046 
0047 public:
0048    enum EStatusBits {
0049       kFromChain = BIT(9),  // Indicates a TChain inserted this element in one of its content TTree
0050       kUpdated   = BIT(10),  // Indicates that the chain 'fTree' went through a LoadTree
0051       kUpdatedForChain = BIT(11), // Same as kUpdated, but detected only by the chain itself and not the current tree
0052    };
0053    TFriendElement();
0054    TFriendElement(TTree *tree, const char *treename, const char *filename);
0055    TFriendElement(TTree *tree, const char *treename, TFile *file);
0056    TFriendElement(TTree *tree, TTree* friendtree, const char *alias);
0057    ~TFriendElement() override;
0058    virtual TTree      *Connect();
0059    virtual TTree      *DisConnect();
0060    virtual TFile      *GetFile();
0061    virtual TTree      *GetParentTree() const {return fParentTree;}
0062    virtual TTree      *GetTree();
0063    /// Get the actual TTree name of the friend.
0064    /// If an alias is present, it can be retrieved with GetName().
0065    virtual const char *GetTreeName() const {return fTreeName.Data();}
0066    void        ls(Option_t *option="") const override;
0067            void        Reset() { fTree = nullptr; fFile = nullptr; }
0068            bool        IsUpdated() const { return TestBit(kUpdated); }
0069            bool        IsUpdatedForChain() const { return TestBit(kUpdatedForChain); }
0070            void        ResetUpdated() { ResetBit(kUpdated); }
0071            void        ResetUpdatedForChain() { ResetBit(kUpdatedForChain); }
0072            void        MarkUpdated() { SetBit(kUpdated); SetBit(kUpdatedForChain); }
0073    void        RecursiveRemove(TObject *obj) override;
0074 
0075 
0076    ClassDefOverride(TFriendElement,2)  //A friend element of another TTree
0077 };
0078 
0079 #endif
0080