ROOT logo
// @(#)root/tree:$Id$
// Author: Rene Brun   30/08/99

/*************************************************************************
 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TVirtualTreePlayer
// 
// Abstract base class defining the interface for the plugins that
// implement Draw, Scan, Process, MakeProxy, etc. for a TTree object.
// See the individual documentations in TTree. 
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#include "TROOT.h"
#include "TVirtualTreePlayer.h"
#include "TPluginManager.h"
#include "TClass.h"

TClass              *TVirtualTreePlayer::fgPlayer  = 0;
TVirtualTreePlayer  *TVirtualTreePlayer::fgCurrent = 0;

ClassImp(TVirtualTreePlayer)

//______________________________________________________________________________
TVirtualTreePlayer *TVirtualTreePlayer::TreePlayer(TTree *obj)
{
   // Static function returning a pointer to a Tree player.
   // The player will process the specified obj. If the Tree player
   // does not exist a default player is created.

   // if no player set yet,  create a default painter via the PluginManager
   if (!fgPlayer) {
      TPluginHandler *h;
      if ((h = gROOT->GetPluginManager()->FindHandler("TVirtualTreePlayer"))) {
         if (h->LoadPlugin() == -1)
            return 0;
         TVirtualTreePlayer::SetPlayer(h->GetClass());
      }
      if (!fgPlayer) return 0;
   }

   //create an instance of the Tree player
   TVirtualTreePlayer *p = (TVirtualTreePlayer*)fgPlayer->New();
   if (p) p->SetTree(obj);
   fgCurrent = p;
   return p;
}

//______________________________________________________________________________
TVirtualTreePlayer::~TVirtualTreePlayer()
{
   // Common destructor.

   if (fgCurrent==this) {
      // Make sure fgCurrent does not point to a deleted player.
      fgCurrent=0;
   }
}

//______________________________________________________________________________
TVirtualTreePlayer *TVirtualTreePlayer::GetCurrentPlayer()
{
   // Static function: return the current player (if any)

   return fgCurrent;
}

//______________________________________________________________________________
void TVirtualTreePlayer::SetPlayer(const char *player)
{
   // Static function to set an alternative Tree player.

   fgPlayer = TClass::GetClass(player);
}

 TVirtualTreePlayer.cxx:1
 TVirtualTreePlayer.cxx:2
 TVirtualTreePlayer.cxx:3
 TVirtualTreePlayer.cxx:4
 TVirtualTreePlayer.cxx:5
 TVirtualTreePlayer.cxx:6
 TVirtualTreePlayer.cxx:7
 TVirtualTreePlayer.cxx:8
 TVirtualTreePlayer.cxx:9
 TVirtualTreePlayer.cxx:10
 TVirtualTreePlayer.cxx:11
 TVirtualTreePlayer.cxx:12
 TVirtualTreePlayer.cxx:13
 TVirtualTreePlayer.cxx:14
 TVirtualTreePlayer.cxx:15
 TVirtualTreePlayer.cxx:16
 TVirtualTreePlayer.cxx:17
 TVirtualTreePlayer.cxx:18
 TVirtualTreePlayer.cxx:19
 TVirtualTreePlayer.cxx:20
 TVirtualTreePlayer.cxx:21
 TVirtualTreePlayer.cxx:22
 TVirtualTreePlayer.cxx:23
 TVirtualTreePlayer.cxx:24
 TVirtualTreePlayer.cxx:25
 TVirtualTreePlayer.cxx:26
 TVirtualTreePlayer.cxx:27
 TVirtualTreePlayer.cxx:28
 TVirtualTreePlayer.cxx:29
 TVirtualTreePlayer.cxx:30
 TVirtualTreePlayer.cxx:31
 TVirtualTreePlayer.cxx:32
 TVirtualTreePlayer.cxx:33
 TVirtualTreePlayer.cxx:34
 TVirtualTreePlayer.cxx:35
 TVirtualTreePlayer.cxx:36
 TVirtualTreePlayer.cxx:37
 TVirtualTreePlayer.cxx:38
 TVirtualTreePlayer.cxx:39
 TVirtualTreePlayer.cxx:40
 TVirtualTreePlayer.cxx:41
 TVirtualTreePlayer.cxx:42
 TVirtualTreePlayer.cxx:43
 TVirtualTreePlayer.cxx:44
 TVirtualTreePlayer.cxx:45
 TVirtualTreePlayer.cxx:46
 TVirtualTreePlayer.cxx:47
 TVirtualTreePlayer.cxx:48
 TVirtualTreePlayer.cxx:49
 TVirtualTreePlayer.cxx:50
 TVirtualTreePlayer.cxx:51
 TVirtualTreePlayer.cxx:52
 TVirtualTreePlayer.cxx:53
 TVirtualTreePlayer.cxx:54
 TVirtualTreePlayer.cxx:55
 TVirtualTreePlayer.cxx:56
 TVirtualTreePlayer.cxx:57
 TVirtualTreePlayer.cxx:58
 TVirtualTreePlayer.cxx:59
 TVirtualTreePlayer.cxx:60
 TVirtualTreePlayer.cxx:61
 TVirtualTreePlayer.cxx:62
 TVirtualTreePlayer.cxx:63
 TVirtualTreePlayer.cxx:64
 TVirtualTreePlayer.cxx:65
 TVirtualTreePlayer.cxx:66
 TVirtualTreePlayer.cxx:67
 TVirtualTreePlayer.cxx:68
 TVirtualTreePlayer.cxx:69
 TVirtualTreePlayer.cxx:70
 TVirtualTreePlayer.cxx:71
 TVirtualTreePlayer.cxx:72
 TVirtualTreePlayer.cxx:73
 TVirtualTreePlayer.cxx:74
 TVirtualTreePlayer.cxx:75
 TVirtualTreePlayer.cxx:76
 TVirtualTreePlayer.cxx:77
 TVirtualTreePlayer.cxx:78
 TVirtualTreePlayer.cxx:79
 TVirtualTreePlayer.cxx:80
 TVirtualTreePlayer.cxx:81
 TVirtualTreePlayer.cxx:82
 TVirtualTreePlayer.cxx:83