Logo ROOT   6.18/05
Reference Guide
RDisplayItem.hxx
Go to the documentation of this file.
1/// \file ROOT/RDisplayItem.h
2/// \ingroup Base ROOT7
3/// \author Sergey Linev
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
6/// is welcome!
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
16#ifndef ROOT7_RDisplayItem
17#define ROOT7_RDisplayItem
18
19#include <string>
20#include <memory>
21#include <vector>
22
23namespace ROOT {
24namespace Experimental {
25class RCanvas;
26class RFrame;
27
28/** \class RDisplayItem
29 Base class for painting data for JS.
30 */
31
33protected:
34 std::string fObjectID; ///< unique object identifier
35
36public:
37 RDisplayItem() = default;
38 virtual ~RDisplayItem() {}
39
40 void SetObjectID(const std::string &id) { fObjectID = id; }
41 std::string GetObjectID() const { return fObjectID; }
42};
43
44// direct pointer to some object without ownership
45
46template <class T>
48protected:
49 const T *fObject{nullptr}; ///< direct pointer without ownership
50
51public:
52 ROrdinaryDisplayItem(const T *addr) : RDisplayItem(), fObject(addr) {}
53
54 const T *GetObject() const { return fObject; }
55};
56
57// unique pointer of specified class with ownership
58
59template <class T>
61protected:
62 std::unique_ptr<T> fObject;
63
64public:
66
67 T *GetObject() const { return fObject.get(); }
68};
69
70} // namespace Experimental
71} // namespace ROOT
72
73#endif
XFontStruct * id
Definition: TGX11.cxx:108
Base class for painting data for JS.
std::string fObjectID
unique object identifier
void SetObjectID(const std::string &id)
std::string GetObjectID() const
const T * fObject
direct pointer without ownership
double T(double x)
Definition: ChebyshevPol.h:34
Namespace for new ROOT classes and functions.
Definition: StringConv.hxx:21