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
15using namespace ROOT::Experimental;
16
17////////////////////////////////////////////////////////////////////////////
18/// Assign id using arbitrary pointer value
19/// Typically drawable pointer should be used here
20
21void RDisplayItem::SetObjectIDAsPtr(const void *ptr)
22{
24}
25
26////////////////////////////////////////////////////////////////////////////
27/// Build full id, including prefix and object index
28
29void RDisplayItem::BuildFullId(const std::string &prefix)
30{
31 SetObjectID(prefix + std::to_string(GetIndex()) + "_" + GetObjectID());
32}
33
34////////////////////////////////////////////////////////////////////////////
35/// Construct fillid using pointer value
36
37std::string RDisplayItem::ObjectIDFromPtr(const void *ptr)
38{
39 auto hash = TString::Hash(&ptr, sizeof(ptr));
40 return std::to_string(hash);
41}
42
43///////////////////////////////////////////////////////////
44/// destructor
45
47{
48 if (fDrawable)
50}
51
52///////////////////////////////////////////////////////////
53/// Constructor
54
56{
57 fAttr = &dr.fAttr;
58 fCssClass = &dr.fCssClass;
59 fId = &dr.fId;
60}
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 CSS class, used for RStyle
std::string fId
user-defined CSS id, used for RStyle
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
UInt_t Hash(ECaseCompare cmp=kExact) const
Return hash value.
Definition TString.cxx:677