Logo ROOT  
Reference Guide
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
15////////////////////////////////////////////////////////////////////////////
16/// Assign id using arbitrary pointer value
17/// Typically drawable pointer should be used here
18
20{
22}
23
24////////////////////////////////////////////////////////////////////////////
25/// Build full id, including prefix and object index
26
27void ROOT::Experimental::RDisplayItem::BuildFullId(const std::string &prefix)
28{
29 SetObjectID(prefix + std::to_string(GetIndex()) + "_" + GetObjectID());
30}
31
32////////////////////////////////////////////////////////////////////////////
33/// Construct fillid using pointer value
34
36{
37 auto hash = TString::Hash(&ptr, sizeof(ptr));
38 return std::to_string(hash);
39}
40
41///////////////////////////////////////////////////////////
42/// Constructor
43
45{
46 fAttr = &dr.fAttr;
47 fCssClass = &dr.fCssClass;
48 fId = &dr.fId;
49}
50
void SetObjectID(const std::string &id)
static std::string ObjectIDFromPtr(const void *ptr)
Construct fillid using pointer value.
void SetObjectIDAsPtr(const void *ptr)
Assign id using arbitrary pointer value Typically drawable pointer should be used here.
virtual void BuildFullId(const std::string &prefix)
Build full id, including prefix and object index.
Base class for drawable entities: objects that can be painted on a RPad.
Definition: RDrawable.hxx:102
RAttrMap fAttr
attributes values
Definition: RDrawable.hxx:164
std::string fCssClass
user defined drawable class, can later go inside map
Definition: RDrawable.hxx:167
std::string fId
optional object identifier, may be used in CSS as well
Definition: RDrawable.hxx:168
UInt_t Hash(ECaseCompare cmp=kExact) const
Return hash value.
Definition: TString.cxx:638