Logo ROOT   6.14/05
Reference Guide
TVirtualCanvasPainter.cxx
Go to the documentation of this file.
1 /// \file TVirtualCanvasPainter.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/TLogger.hxx>
19 #include <TSystem.h> // TSystem::Load
20 
21 #include <exception>
22 
23 namespace {
24 static void LoadCanvasPainterLibrary() {
25  if (gSystem->Load("libROOTCanvasPainter") != 0)
26  R__ERROR_HERE("Gpad") << "Loading of libROOTCanvasPainter failed!";
27 }
28 } // unnamed namespace
29 
30 
31 /// The implementation is here to pin the vtable.
33 
34 std::unique_ptr<ROOT::Experimental::Internal::TVirtualCanvasPainter::Generator>
36 {
37  /// The generator for implementations.
38  static std::unique_ptr<Generator> generator;
39  return generator;
40 }
41 
42 std::unique_ptr<ROOT::Experimental::Internal::TVirtualCanvasPainter> ROOT::Experimental::Internal::
44 {
45  if (!GetGenerator()) {
46  LoadCanvasPainterLibrary();
47  if (!GetGenerator()) {
48  R__ERROR_HERE("Gpad") << "TVirtualCanvasPainter::Generator failed to register!";
49  throw std::runtime_error("TVirtualCanvasPainter::Generator failed to initialize");
50  }
51  }
52  return GetGenerator()->Create(canv);
53 }
54 
55 /// The implementation is here to pin the vtable.
57 
A window&#39;s topmost TPad.
Definition: TCanvas.hxx:33
virtual int Load(const char *module, const char *entry="", Bool_t system=kFALSE)
Load a shared library.
Definition: TSystem.cxx:1829
virtual ~TVirtualCanvasPainter()
Default destructor.
static std::unique_ptr< TVirtualCanvasPainter > Create(const TCanvas &canv)
Loads the plugin that implements this class.
static std::unique_ptr< Generator > & GetGenerator()
generator getter
R__EXTERN TSystem * gSystem
Definition: TSystem.h:540
#define R__ERROR_HERE(GROUP)
Definition: TLogger.hxx:182