library: libTree #include "TFriendElement.h"

# TFriendElement

class description - source file - inheritance tree (.pdf)

## class TFriendElement : public TNamed

| Inheritance Chart:

`TObject`

<-

`TNamed`

<-

`TFriendElement`

        public:

                              TFriendElement()
                              TFriendElement(TTree* tree, const char* treename, const char* filename)
                              TFriendElement(TTree* tree, const char* treename, TFile* file)
                              TFriendElement(TTree* tree, TTree* friendtree, const char* alias)
                              TFriendElement(const TFriendElement&)
                      virtual ~TFriendElement()
               static TClass* Class()
               virtual TTree* Connect()
               virtual TTree* DisConnect()
               virtual TFile* GetFile()
               virtual TTree* GetParentTree() const
               virtual TTree* GetTree()
          virtual const char* GetTreeName() const
              virtual TClass* IsA() const
                 virtual void ls(Option_t* option = "") const
              TFriendElement& operator=(const TFriendElement&)
                 virtual void ShowMembers(TMemberInspector& insp, char* parent)
                 virtual void Streamer(TBuffer& b)
                         void StreamerNVirtual(TBuffer& b)

### Data Members

        protected:

           TTree* fParentTree  !pointer to the parent TTree
           TTree* fTree        !pointer to the TTree described by this element
           TFile* fFile        !pointer to the file containing the friend TTree
          TString fTreeName    name of the friend TTree
           Bool_t fOwnFile     true if file is managed by this class

        public:

          static const enum TFriendElement:: kFromChain

## Class Description

     TFriendElement

     A TFriendElement TF describes a TTree object TF in a file.
     When a TFriendElement TF is added to the the list of friends of an
     existing TTree T, any variable from TF can be referenced in a query
     to T.

     To add a TFriendElement to an existing TTree T, do:
           T.AddFriend("friendTreename","friendTreeFile");

      See TTree::AddFriend for more information.

TFriendElement() : TNamed()

    *-*-*-*-*-*Default constructor for a friend element*-*-*-*-*-*-*-*-*-*-*-*-*
    *-*        =======================================

TFriendElement(TTree *tree, const char *treename, const char *filename) :TNamed(treename,filename)

    *-*-*-*-*-*-*-*-*-*-*-*-*Create a friend element*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
    *-*                      ======================

     If treename is of the form "a=b", an alias called "a" is created for
     treename = "b" by default the alias name is the name of the tree.

TFriendElement(TTree *tree, const char *treename, TFile *file) :TNamed(treename,file?file->GetName():"")

    *-*-*-*-*-*-*-*-*-*-*-*-*Create a friend element*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
    *-*                      ======================

     If treename is of the form "a=b", an alias called "a" is created for
     treename = "b" by default the alias name is the name of the tree.
     The passed TFile is managed by the user (i.e. user must delete the TFile).

TFriendElement(TTree *tree, TTree* friendtree, const char *alias) :TNamed(friendtree?friendtree->GetName():"", friendtree ? ( friendtree->GetDirectory() ? ( friendtree->GetDirectory()->GetFile() ? friendtree->GetDirectory()->GetFile()->GetName() : "" ) : "" ) : "")

    *-*-*-*-*-*-*-*-*-*-*-*-*Create a friend element*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
    *-*                      ======================

~TFriendElement()

TTree* Connect()

     Connect file and return TTree.

TTree* DisConnect()

     DisConnect file and TTree.

TFile* GetFile()

     Return pointer to TFile containing this friend TTree.

TTree* GetTree()

     Return pointer to friend TTree.

void ls(Option_t *) const

     List this friend element.

### Inline Functions

                     TTree* GetParentTree() const
                const char* GetTreeName() const
                    TClass* Class()
                    TClass* IsA() const
                       void ShowMembers(TMemberInspector& insp, char* parent)
                       void Streamer(TBuffer& b)
                       void StreamerNVirtual(TBuffer& b)
             TFriendElement TFriendElement(const TFriendElement&)
            TFriendElement& operator=(const TFriendElement&)

Author: Rene Brun 07/04/2001
Last update: root/tree:$Name: $:$Id: TFriendElement.cxx,v 1.11 2004/09/24 18:22:46 brun Exp $
Copyright (C) 1995-2001, Rene Brun and Fons Rademakers. *