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 
9 #include "ROOT/RDisplayItem.hxx"
10 
11 #include "ROOT/RDrawable.hxx"
12 
13 #include "TString.h"
14 #include "TObject.h"
15 
16 using namespace ROOT::Experimental;
17 
18 ////////////////////////////////////////////////////////////////////////////
19 /// Assign id using arbitrary pointer value
20 /// Typically drawable pointer should be used here
21 
22 void RDisplayItem::SetObjectIDAsPtr(const void *ptr)
23 {
25 }
26 
27 ////////////////////////////////////////////////////////////////////////////
28 /// Build full id, including prefix and object index
29 
30 void 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 
38 std::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 
ROOT::Experimental::RIndirectDisplayItem::RIndirectDisplayItem
RIndirectDisplayItem()=default
RDisplayItem.hxx
ROOT::Experimental::RDrawable::OnDisplayItemDestroyed
virtual void OnDisplayItemDestroyed(RDisplayItem *) const
Definition: RDrawable.hxx:192
ROOT::Experimental::RDisplayItem::ObjectIDFromPtr
static std::string ObjectIDFromPtr(const void *ptr)
Construct fillid using pointer value.
Definition: RDisplayItem.cxx:38
ROOT::Experimental::RDisplayItem::SetObjectID
void SetObjectID(const std::string &id)
Definition: RDisplayItem.hxx:43
TString::Hash
UInt_t Hash(ECaseCompare cmp=kExact) const
Return hash value.
Definition: TString.cxx:638
ROOT::Experimental::RIndirectDisplayItem::fAttr
const RAttrMap * fAttr
pointer on drawable attributes
Definition: RDisplayItem.hxx:98
ROOT::Experimental::RDrawable::fAttr
RAttrMap fAttr
attributes values
Definition: RDrawable.hxx:172
ROOT::Experimental::TObjectDisplayItem::fOwner
bool fOwner
! if object must be deleted
Definition: RDisplayItem.hxx:124
ROOT::Experimental::RDisplayItem::SetObjectIDAsPtr
void SetObjectIDAsPtr(const void *ptr)
Assign id using arbitrary pointer value Typically drawable pointer should be used here.
Definition: RDisplayItem.cxx:22
TString.h
ROOT::Experimental::RDrawableDisplayItem::~RDrawableDisplayItem
virtual ~RDrawableDisplayItem()
destructor
Definition: RDisplayItem.cxx:47
ROOT::Experimental::RDrawableDisplayItem::fDrawable
const RDrawable * fDrawable
drawable
Definition: RDisplayItem.hxx:70
ROOT::Experimental::RDisplayItem::GetIndex
unsigned GetIndex() const
Definition: RDisplayItem.hxx:51
ROOT::Experimental::TObjectDisplayItem::fObject
const TObject * fObject
ROOT6 object.
Definition: RDisplayItem.hxx:122
ROOT::Experimental::RIndirectDisplayItem::fId
const std::string * fId
pointer on drawable id
Definition: RDisplayItem.hxx:100
ROOT::Experimental::TObjectDisplayItem::~TObjectDisplayItem
virtual ~TObjectDisplayItem()
destructor
Definition: RDisplayItem.cxx:67
ROOT::Experimental::RDisplayItem::BuildFullId
virtual void BuildFullId(const std::string &prefix)
Build full id, including prefix and object index.
Definition: RDisplayItem.cxx:30
ROOT::Experimental::RDrawable::fCssClass
std::string fCssClass
user defined drawable class, can later go inside map
Definition: RDrawable.hxx:175
RDrawable.hxx
ROOT::Experimental::RDrawable
Base class for drawable entities: objects that can be painted on a RPad.
Definition: RDrawable.hxx:109
TObject.h
ROOT::Experimental::RDrawable::fId
std::string fId
optional object identifier, may be used in CSS as well
Definition: RDrawable.hxx:176
ROOT::Experimental::RDisplayItem::GetObjectID
std::string GetObjectID() const
Definition: RDisplayItem.hxx:44
ROOT::Experimental
Definition: RDirectory.hxx:30
ROOT::Experimental::RIndirectDisplayItem::fCssClass
const std::string * fCssClass
pointer on drawable class
Definition: RDisplayItem.hxx:99