Logo ROOT   6.14/05
Reference Guide
THistDrawable.cxx
Go to the documentation of this file.
1 /// \file THistDrawable.cxx
2 /// \ingroup Hist ROOT7
3 /// \author Axel Naumann <axel@cern.ch>
4 /// \date 2015-09-11
5 /// \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback
6 /// is welcome!
7 
8 /*************************************************************************
9  * Copyright (C) 1995-2015, Rene Brun and Fons Rademakers. *
10  * All rights reserved. *
11  * *
12  * For the licensing terms see $ROOTSYS/LICENSE. *
13  * For the list of contributors see $ROOTSYS/README/CREDITS. *
14  *************************************************************************/
15 
16 #include "ROOT/THistDrawable.hxx"
17 
18 #include "ROOT/THistImpl.hxx"
19 
20 #include "TSystem.h" // TSystem::Load
21 
22 #include <cassert>
23 
24 using namespace ROOT::Experimental;
25 using namespace ROOT::Experimental::Internal;
26 
28 {
29  gSystem->Load("libHistPainter");
30 }
31 
32 template <int DIMENSION>
34 {
35  GetPainterPtr() = this;
36 }
37 
38 template <int DIMENSION>
40 {
41  GetPainterPtr() = nullptr;
42 }
43 
44 template <int DIMENSION>
46 {
47  static THistPainterBase<DIMENSION> *painter = nullptr;
48 
49  return painter;
50 }
51 
52 template <int DIMENSION>
54 {
55  // Trigger loading of the painter library within the init guard of the static:
56  static int triggerLibLoad = (LoadHistPainterLibrary(), 0);
57 
58  (void)triggerLibLoad; // unused.
59 
60  return GetPainterPtr();
61 }
62 
63 template <class DERIVED>
65 {
66  // here should be filling of context menu for the given object
67 }
68 
69 // GCC 5 needs to have that outlined - is that a compiler bug?
70 template <int DIMENSIONS>
72 
73 /// Paint the histogram
74 template <int DIMENSIONS>
76 {
77  Internal::THistPainterBase<DIMENSIONS>::GetPainter()->Paint(*this, fOpts, pad);
78 }
79 
80 namespace ROOT {
81 namespace Experimental {
82 
83 namespace Internal {
84 template class THistPainterBase<1>;
85 template class THistPainterBase<2>;
86 template class THistPainterBase<3>;
87 } // namespace Internal
88 
92 
93 template class THistDrawable<1>;
94 template class THistDrawable<2>;
95 template class THistDrawable<3>;
96 } // namespace Experimental
97 } // namespace ROOT
Namespace for new ROOT classes and functions.
Definition: StringConv.hxx:21
virtual int Load(const char *module, const char *entry="", Bool_t system=kFALSE)
Load a shared library.
Definition: TSystem.cxx:1829
static THistPainterBase< DIMENSION > * GetPainter()
R__EXTERN TSystem * gSystem
Definition: TSystem.h:540
void PopulateMenu(TMenuItems &) final
Method can be used to provide menu items for the drawn object.
Abstract interface for object painting on the pad/canvas.
Definition: TPadPainter.hxx:37
typedef void((*Func_t)())
void Paint(Internal::TPadPainter &pad) final
Paint the histogram.
static THistPainterBase< DIMENSION > *& GetPainterPtr()