#include "TFriendProxy.h"
#include "TTree.h"
#include "TList.h"
#include "TFriendElement.h"
ClassImp(ROOT::TFriendProxy);
namespace ROOT {
   
   TFriendProxy::TFriendProxy() : fDirector(0,-1), fIndex(-1)
   {
   }
   
   TFriendProxy::TFriendProxy(TBranchProxyDirector *director, TTree *main, Int_t index) :
      fDirector(0,-1), fIndex(index)
   {
      
      if (main) {
         TObject *obj = main->GetListOfFriends()->At(fIndex);
         TFriendElement *element = dynamic_cast<TFriendElement*>( obj );
         if (element) fDirector.SetTree(element->GetTree());
      }
      director->Attach(this);
   }
   
   Long64_t TFriendProxy::GetReadEntry() const
   {
      
      return fDirector.GetReadEntry();
   }
   
   void TFriendProxy::ResetReadEntry()
   {
      
      if (fDirector.GetTree()) fDirector.SetReadEntry(fDirector.GetTree()->GetReadEntry());
   }
  
   void TFriendProxy::Update(TTree *newmain)
   {
      
      if (newmain) {
         TObject *obj = newmain->GetListOfFriends()->At(fIndex);
         TFriendElement *element = dynamic_cast<TFriendElement*>( obj );
         if (element) fDirector.SetTree(element->GetTree());
         else fDirector.SetTree(0);
      } else {
         fDirector.SetTree(0);
      }
   }
}
Last update: Thu Jan 17 08:43:14 2008
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.