Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
REveDataCollection.hxx
Go to the documentation of this file.
1// @(#)root/eve7:$Id$
2// Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007, 2018
3
4/*************************************************************************
5 * Copyright (C) 1995-2019, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12
13#ifndef ROOT7_REveDataCollection
14#define ROOT7_REveDataCollection
15
16#include <ROOT/REveElement.hxx>
17#include <ROOT/REveCompound.hxx>
20
21#include <functional>
22#include <vector>
23#include <iostream>
24
25class TClass;
26
27namespace ROOT {
28namespace Experimental {
29
30//==============================================================================
32{
33private:
34 void* fDataPtr{nullptr};
35
39
40public:
41
43
44 Bool_t GetRnrSelf() const { return fRnrSelf; }
45 Color_t GetMainColor() const { return fColor; }
46 Bool_t GetFiltered() const { return fFiltered; }
47 Bool_t GetVisible() const { return (!fFiltered) && fRnrSelf; }
48
49 void* GetDataPtr() { return fDataPtr; }
50
51 void SetFiltered(Bool_t i) { fFiltered = i; }
52 void SetMainColor(Color_t i) { fColor = i; }
53 void SetRnrSelf(Bool_t i) { fRnrSelf = i; }
54};
55
56//==============================================================================
59{
60 friend class REveDataCollection;
61
62public:
63 typedef std::function<void (REveDataItemList*, const std::vector<int>&)> ItemsChangeFunc_t;
65
66 struct TTip {
67 std::string fTooltipTitle;
69 };
70
71private:
72 std::vector<REveDataItem*> fItems;
75
76 std::vector<TTip> fTooltipExpressions;
77
78public:
79 REveDataItemList(const std::string& n = "Items", const std::string& t = "");
80 virtual ~REveDataItemList() {}
81 Int_t WriteCoreJson(nlohmann::json &cj, Int_t rnr_offset) override;
82
83 virtual void ItemChanged(REveDataItem *item);
84 virtual void ItemChanged(Int_t idx);
85 void FillImpliedSelectedSet(Set_t &impSelSet) override;
86
87 void SetItemVisible(Int_t idx, Bool_t visible);
89
90 Bool_t SingleRnrState() const override { return kTRUE; }
91 Bool_t SetRnrState(Bool_t) override;
92
93 void ProcessSelection(ElementId_t id, bool multi, bool secondary, const std::set<int>& in_secondary_idcs);
94
95 void AddTooltipExpression(const std::string &title, const std::string &expr);
96
98 std::string GetHighlightTooltip(const std::set<int>& secondary_idcs) const override;
99
102
103 static void DummyItemsChange(REveDataItemList*, const std::vector<int>&);
104 static void DummyFillImpliedSelected(REveDataItemList*, Set_t& impSelSet);
105};
106
107//==============================================================================
108
110{
111private:
113
114public:
115 typedef std::vector<int> Ids_t;
117
118 TClass *fItemClass{nullptr}; // so far only really need class name
119
121 std::function<bool(void *)> fFilterFoo = [](void *) { return true; };
122
123 REveDataCollection(const std::string& n = "REveDataCollection", const std::string& t = "");
125
126 void ReserveItems(Int_t items_size) { fItemList->fItems.reserve(items_size); }
127 void AddItem(void *data_ptr, const std::string& n, const std::string& t);
128 void ClearItems() { fItemList->fItems.clear(); }
129
130 Bool_t SingleRnrState() const override { return kTRUE; }
131 Bool_t SetRnrState(Bool_t) override;
132
133
134 TClass *GetItemClass() const { return fItemClass; }
135 void SetItemClass(TClass *cls) { fItemClass = cls;
136 }
138
139 void SetFilterExpr(const TString &filter);
140 void ApplyFilter();
141
142 Int_t GetNItems() const { return (Int_t) fItemList->fItems.size(); }
143 void *GetDataPtr(Int_t i) const { return fItemList->fItems[i]->GetDataPtr(); }
144 const REveDataItem* GetDataItem(Int_t i) const { return fItemList->fItems[i]; }
145
146 void StreamPublicMethods(nlohmann::json &cj) const;
147 Int_t WriteCoreJson(nlohmann::json &cj, Int_t rnr_offset) override;
148
149 void SetMainColor(Color_t) override;
150
151};
152
153} // namespace Experimental
154} // namespace ROOT
155
156#endif
ROOT::R::TRInterface & r
Definition Object.C:4
#define d(i)
Definition RSha256.hxx:102
#define b(i)
Definition RSha256.hxx:100
#define c(i)
Definition RSha256.hxx:101
#define g(i)
Definition RSha256.hxx:105
int Int_t
Definition RtypesCore.h:45
unsigned char UChar_t
Definition RtypesCore.h:38
bool Bool_t
Definition RtypesCore.h:63
short Color_t
Definition RtypesCore.h:83
const Bool_t kTRUE
Definition RtypesCore.h:91
typedef void((*Func_t)())
void StreamPublicMethods(nlohmann::json &cj) const
void AddItem(void *data_ptr, const std::string &n, const std::string &t)
Bool_t SetRnrState(Bool_t) override
Set render state of this element and of its children to the same value.
void SetMainColor(Color_t) override
Set main color of the element.
Int_t WriteCoreJson(nlohmann::json &cj, Int_t rnr_offset) override
Write core json.
const REveDataItem * GetDataItem(Int_t i) const
void AddTooltipExpression(const std::string &title, const std::string &expr)
virtual void ItemChanged(REveDataItem *item)
Int_t WriteCoreJson(nlohmann::json &cj, Int_t rnr_offset) override
Write core json.
FillImpliedSelectedFunc_t fHandlerFillImplied
void ProcessSelection(ElementId_t id, bool multi, bool secondary, const std::set< int > &in_secondary_idcs)
void FillImpliedSelectedSet(Set_t &impSelSet) override
Populate set impSelSet with derived / dependant elements.
void SetItemColorRGB(Int_t idx, UChar_t r, UChar_t g, UChar_t b)
Bool_t SetRnrState(Bool_t) override
Set render state of this element and of its children to the same value.
std::string GetHighlightTooltip(const std::set< int > &secondary_idcs) const override
static void DummyFillImpliedSelected(REveDataItemList *, Set_t &impSelSet)
void SetFillImpliedSelectedDelegate(FillImpliedSelectedFunc_t)
std::vector< REveDataItem * > fItems
static void DummyItemsChange(REveDataItemList *, const std::vector< int > &)
std::function< void(REveDataItemList *, Set_t &)> FillImpliedSelectedFunc_t
void SetItemVisible(Int_t idx, Bool_t visible)
std::function< void(REveDataItemList *, const std::vector< int > &)> ItemsChangeFunc_t
virtual std::string GetHighlightTooltip(const std::set< int > &) const
std::set< REveElement * > Set_t
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:80
Basic string class.
Definition TString.h:136
const Int_t n
Definition legend1.C:16
unsigned int ElementId_t
Definition REveTypes.hxx:25
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...