Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RDisplayItem.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/RDrawable.hxx"
12
13#include "TString.h"
14#include "TObject.h"
15
16using namespace ROOT::Experimental;
17
18////////////////////////////////////////////////////////////////////////////
19/// Assign id using arbitrary pointer value
20/// Typically drawable pointer should be used here
21
22void RDisplayItem::SetObjectIDAsPtr(const void *ptr)
23{
25}
26
27////////////////////////////////////////////////////////////////////////////
28/// Build full id, including prefix and object index
29
30void RDisplayItem::BuildFullId(const std::string &prefix)
31{
32 SetObjectID(prefix + std::to_string(GetIndex()) + "_" + GetObjectID());
33}
34
35////////////////////////////////////////////////////////////////////////////
36/// Construct fillid using pointer value
37
38std::string RDisplayItem::ObjectIDFromPtr(const void *ptr)
39{
40 auto hash = TString::Hash(&ptr, sizeof(ptr));
41 return std::to_string(hash);
42}
43
44///////////////////////////////////////////////////////////
45/// destructor
46
48{
49 if (fDrawable)
51}
52
53
54///////////////////////////////////////////////////////////
55/// Constructor
56
58{
59 fAttr = &dr.fAttr;
60 fCssClass = &dr.fCssClass;
61 fId = &dr.fId;
62}
63
64
65///////////////////////////////////////////////////////////
66/// destructor
68{
69 if (fOwner) delete fObject;
70}
71
72
virtual void BuildFullId(const std::string &prefix)
Build full id, including prefix and object index.
void SetObjectID(const std::string &id)
void SetObjectIDAsPtr(const void *ptr)
Assign id using arbitrary pointer value Typically drawable pointer should be used here.
static std::string ObjectIDFromPtr(const void *ptr)
Construct fillid using pointer value.
Base class for drawable entities: objects that can be painted on a RPad.
RAttrMap fAttr
attributes values
std::string fCssClass
user defined drawable class, can later go inside map
std::string fId
optional object identifier, may be used in CSS as well
virtual void OnDisplayItemDestroyed(RDisplayItem *) const
const std::string * fId
pointer on drawable id
const std::string * fCssClass
pointer on drawable class
const RAttrMap * fAttr
pointer on drawable attributes
const TObject * fObject
ROOT6 object.
bool fOwner
! if object must be deleted
UInt_t Hash(ECaseCompare cmp=kExact) const
Return hash value.
Definition TString.cxx:658