Logo ROOT   6.16/01
Reference Guide
RHistDrawable.hxx
Go to the documentation of this file.
1/// \file ROOT/RHistDrawable.h
2/// \ingroup HistDraw ROOT7
3/// \author Axel Naumann <axel@cern.ch>
4/// \date 2015-07-09
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#ifndef ROOT7_RHistDrawable
17#define ROOT7_RHistDrawable
18
19#include "ROOT/RDrawable.hxx"
21#include "ROOT/RHistImpl.hxx"
22#include "ROOT/RMenuItem.hxx"
23
24#include <memory>
25
26namespace ROOT {
27namespace Experimental {
28
29template <int DIMENSIONS, class PRECISION, template <int D_, class P_> class... STAT>
30class RHist;
31
32namespace Detail {
33template <int DIMENSIONS>
34class RHistImplPrecisionAgnosticBase;
35}
36
37namespace Internal {
38
40
41template <int DIMENSION>
44
45protected:
47 virtual ~RHistPainterBase();
48
49public:
51
52 /// Paint a RHist. All we need is access to its GetBinContent()
53 virtual void Paint(RDrawable &obj, const RHistDrawingOpts<DIMENSION> &opts, RPadPainter &pad) = 0;
54};
55
56extern template class RHistPainterBase<1>;
57extern template class RHistPainterBase<2>;
58extern template class RHistPainterBase<3>;
59
60} // namespace Internal
61
62template <class DERIVED>
64public:
66
67 void PopulateMenu(RMenuItems &) final;
68
69 void Execute(const std::string &) final
70 {
71 // should execute menu item
72 }
73};
74
75template <int DIMENSIONS>
77public:
79
80private:
83
84public:
86
87 template <class HIST>
88 RHistDrawable(const std::shared_ptr<HIST> &hist, const RHistDrawingOpts<DIMENSIONS> &opts = {})
89 : fHistImpl(std::shared_ptr<HistImpl_t>(hist, hist->GetImpl())), fOpts(opts)
90 {}
91
92 template <class HIST>
93 RHistDrawable(std::unique_ptr<HIST> &&hist, const RHistDrawingOpts<DIMENSIONS> &opts = {})
94 : fHistImpl(std::unique_ptr<HistImpl_t>(std::move(hist->TakeImpl()))), fOpts(opts)
95 {}
96
97 /// Paint the histogram
98 void Paint(Internal::RPadPainter &pad) final;
99
101 const RHistDrawingOpts<DIMENSIONS> &GetOptions() const { return fOpts; }
102};
103
104extern template class RHistDrawableBase<RHistDrawable<1>>;
105extern template class RHistDrawableBase<RHistDrawable<2>>;
106extern template class RHistDrawableBase<RHistDrawable<3>>;
107
108extern template class RHistDrawable<1>;
109extern template class RHistDrawable<2>;
110extern template class RHistDrawable<3>;
111
112} // namespace Experimental
113} // namespace ROOT
114
115#endif
Base class for RHistImplBase that abstracts out the histogram's PRECISION.
Definition: RHistImpl.hxx:70
static RHistPainterBase< DIMENSION > *& GetPainterPtr()
virtual void Paint(RDrawable &obj, const RHistDrawingOpts< DIMENSION > &opts, RPadPainter &pad)=0
Paint a RHist. All we need is access to its GetBinContent()
static RHistPainterBase< DIMENSION > * GetPainter()
Abstract interface for object painting on the pad/canvas.
Definition: RPadPainter.hxx:37
Base class for drawable entities: objects that can be painted on a RPad.
Definition: RDrawable.hxx:37
void Execute(const std::string &) final
RHistDrawable(const std::shared_ptr< HIST > &hist, const RHistDrawingOpts< DIMENSIONS > &opts={})
RHistDrawable(std::unique_ptr< HIST > &&hist, const RHistDrawingOpts< DIMENSIONS > &opts={})
const RHistDrawingOpts< DIMENSIONS > & GetOptions() const
RHistDrawingOpts< DIMENSIONS > & GetOptions()
RHistDrawingOpts< DIMENSIONS > fOpts
Internal::TUniWeakPtr< HistImpl_t > fHistImpl
Namespace for new ROOT classes and functions.
Definition: StringConv.hxx:21