Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TVirtualTreePlayer.cxx
Go to the documentation of this file.
1// @(#)root/tree:$Id$
2// Author: Rene Brun 30/08/99
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
12/** \class TVirtualTreePlayer
13\ingroup tree
14
15Abstract base class defining the interface for the plugins that
16implement Draw, Scan, Process, MakeProxy, etc. for a TTree object.
17See the individual documentations in TTree.
18*/
19
20#include "TROOT.h"
21#include "TVirtualTreePlayer.h"
22#include "TPluginManager.h"
23#include "TClass.h"
24
27
29
30////////////////////////////////////////////////////////////////////////////////
31/// Static function returning a pointer to a Tree player.
32/// The player will process the specified obj. If the Tree player
33/// does not exist a default player is created.
34
36{
37 // if no player set yet, create a default painter via the PluginManager
38 if (!fgPlayer) {
40 if ((h = gROOT->GetPluginManager()->FindHandler("TVirtualTreePlayer"))) {
41 if (h->LoadPlugin() == -1)
42 return 0;
44 }
45 if (!fgPlayer) return 0;
46 }
47
48 //create an instance of the Tree player
50 if (p) p->SetTree(obj);
51 fgCurrent = p;
52 return p;
53}
54
55////////////////////////////////////////////////////////////////////////////////
56/// Common destructor.
57
59{
60 if (fgCurrent==this) {
61 // Make sure fgCurrent does not point to a deleted player.
62 fgCurrent=0;
63 }
64}
65
66////////////////////////////////////////////////////////////////////////////////
67/// Static function: return the current player (if any)
68
70{
71 return fgCurrent;
72}
73
74////////////////////////////////////////////////////////////////////////////////
75/// Static function to set an alternative Tree player.
76
77void TVirtualTreePlayer::SetPlayer(const char *player)
78{
79 fgPlayer = TClass::GetClass(player);
80}
81
#define h(i)
Definition RSha256.hxx:106
#define ClassImp(name)
Definition Rtypes.h:377
winID h TVirtualViewer3D TVirtualGLPainter p
#define gROOT
Definition TROOT.h:405
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:81
void * New(ENewType defConstructor=kClassNew, Bool_t quiet=kFALSE) const
Return a pointer to a newly allocated object of this class.
Definition TClass.cxx:4978
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
Definition TClass.cxx:2968
A TTree represents a columnar dataset.
Definition TTree.h:79
Abstract base class defining the interface for the plugins that implement Draw, Scan,...
static TVirtualTreePlayer * GetCurrentPlayer()
Static function: return the current player (if any)
static void SetPlayer(const char *player)
Static function to set an alternative Tree player.
static TClass * fgPlayer
Pointer to class of Tree player.
static TVirtualTreePlayer * fgCurrent
Pointer to current Tree player.
static TVirtualTreePlayer * TreePlayer(TTree *obj)
Static function returning a pointer to a Tree player.
virtual ~TVirtualTreePlayer()
Common destructor.