Logo ROOT   6.18/05
Reference Guide
RVirtualCanvasPainter.cxx
Go to the documentation of this file.
1/// \file RVirtualCanvasPainter.cxx
2/// \ingroup Gpad ROOT7
3/// \author Axel Naumann <axel@cern.ch>
4/// \date 2017-05-31
5/// \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!
6
7
8/*************************************************************************
9 * Copyright (C) 1995-2017, 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
17
18#include <ROOT/RLogger.hxx>
19#include <TSystem.h> // TSystem::Load
20
21#include <exception>
22
23namespace {
24static int LoadCanvasPainterLibraryOnce() {
25 static int loadResult = gSystem->Load("libROOTCanvasPainter");
26 if (loadResult != 0)
27 R__ERROR_HERE("Gpad") << "Loading of libROOTCanvasPainter failed!";
28 return loadResult;
29}
30static void LoadCanvasPainterLibrary() {
31 static int loadResult = LoadCanvasPainterLibraryOnce();
32 (void) loadResult;
33}
34} // unnamed namespace
35
36
37/// The implementation is here to pin the vtable.
39
40std::unique_ptr<ROOT::Experimental::Internal::RVirtualCanvasPainter::Generator>
42{
43 /// The generator for implementations.
44 static std::unique_ptr<Generator> generator;
45 return generator;
46}
47
48std::unique_ptr<ROOT::Experimental::Internal::RVirtualCanvasPainter> ROOT::Experimental::Internal::
50{
51 if (!GetGenerator()) {
52 LoadCanvasPainterLibrary();
53 if (!GetGenerator()) {
54 R__ERROR_HERE("Gpad") << "RVirtualCanvasPainter::Generator failed to register!";
55 throw std::runtime_error("RVirtualCanvasPainter::Generator failed to initialize");
56 }
57 }
58 return GetGenerator()->Create(canv);
59}
60
61/// The implementation is here to pin the vtable.
63
#define R__ERROR_HERE(GROUP)
Definition: RLogger.hxx:183
typedef void((*Func_t)())
R__EXTERN TSystem * gSystem
Definition: TSystem.h:560
static std::unique_ptr< RVirtualCanvasPainter > Create(const RCanvas &canv)
Loads the plugin that implements this class.
virtual ~RVirtualCanvasPainter()
Default destructor.
static std::unique_ptr< Generator > & GetGenerator()
generator getter
A window's topmost RPad.
Definition: RCanvas.hxx:33
virtual int Load(const char *module, const char *entry="", Bool_t system=kFALSE)
Load a shared library.
Definition: TSystem.cxx:1843