Logo ROOT  
Reference Guide
RVirtualCanvasPainter.cxx
Go to the documentation of this file.
1/*************************************************************************
2 * Copyright (C) 1995-2017, Rene Brun and Fons Rademakers. *
3 * All rights reserved. *
4 * *
5 * For the licensing terms see $ROOTSYS/LICENSE. *
6 * For the list of contributors see $ROOTSYS/README/CREDITS. *
7 *************************************************************************/
8
10
11#include <ROOT/RLogger.hxx>
12#include <TSystem.h> // TSystem::Load
13
14#include <exception>
15
16namespace {
17static int LoadCanvasPainterLibraryOnce() {
18 static int loadResult = gSystem->Load("libROOTCanvasPainter");
19 if (loadResult != 0)
20 R__ERROR_HERE("Gpad") << "Loading of libROOTCanvasPainter failed!";
21 return loadResult;
22}
23static void LoadCanvasPainterLibrary() {
24 static int loadResult = LoadCanvasPainterLibraryOnce();
25 (void) loadResult;
26}
27} // unnamed namespace
28
29
30/// The implementation is here to pin the vtable.
32
33std::unique_ptr<ROOT::Experimental::Internal::RVirtualCanvasPainter::Generator>
35{
36 /// The generator for implementations.
37 static std::unique_ptr<Generator> generator;
38 return generator;
39}
40
41std::unique_ptr<ROOT::Experimental::Internal::RVirtualCanvasPainter> ROOT::Experimental::Internal::
43{
44 if (!GetGenerator()) {
45 LoadCanvasPainterLibrary();
46 if (!GetGenerator()) {
47 R__ERROR_HERE("Gpad") << "RVirtualCanvasPainter::Generator failed to register!";
48 throw std::runtime_error("RVirtualCanvasPainter::Generator failed to initialize");
49 }
50 }
51 return GetGenerator()->Create(canv);
52}
53
54/// The implementation is here to pin the vtable.
56
#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:30
virtual int Load(const char *module, const char *entry="", Bool_t system=kFALSE)
Load a shared library.
Definition: TSystem.cxx:1845