Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
REveTableInfo.hxx
Go to the documentation of this file.
1// @(#)root/eve7:$Id$
2// Authors: Matevz Tadel & Alja Mrak-Tadel: 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#ifndef ROOT7_REveTableInfo
13#define ROOT7_REveTableInfo
14
15#include <ROOT/REveElement.hxx>
18
19namespace ROOT {
20namespace Experimental {
21
22///////////////////////////////////////////////////////////////////////////////
23/// REveTableEntry
24///////////////////////////////////////////////////////////////////////////////
25
27public:
28 std::string fName;
30 std::string fExpression;
32
33 REveTableEntry() : fName("unknown"), fPrecision(2), fType(REveDataColumn::FT_Double) {}
34
35 REveTableEntry(const std::string &name, int precision, const std::string &expression)
36 : fName(name), fPrecision(precision), fExpression(expression), fType(REveDataColumn::FT_Double)
37 {
38 }
39
40 void Print() const
41 {
42 printf("TableEntry\n");
43 printf("name: %s expression: %s\n", fName.c_str(), fExpression.c_str());
44 }
45};
46
47///////////////////////////////////////////////////////////////////////////////
48/// REveTableHandle
49///////////////////////////////////////////////////////////////////////////////
50
52{
53 friend class REveTableViewInfo;
54
55public:
56 typedef std::vector<REveTableEntry> Entries_t;
57 typedef std::map<std::string, Entries_t> Specs_t;
58
59 // REveTableHandle() {}
60
62 column(const std::string &name, int precision, const std::string &expression)
63 {
64 fSpecs[fClassName].emplace_back(name, precision, expression);
65 return *this;
66 }
67
68 REveTableHandle &column(const std::string &label, int precision)
69 {
70 return column(label, precision, label);
71 }
72
74 fSpecs[fClassName].clear();
75 }
76
77 REveTableHandle(std::string className, Specs_t &specs)
78 :fClassName(className), fSpecs(specs)
79 {
80 }
81
82protected:
83 std::string fClassName;
85};
86
87///////////////////////////////////////////////////////////////////////////////
88/// REveTableViewInfo
89///////////////////////////////////////////////////////////////////////////////
90
92{
93public:
94 REveTableViewInfo(const std::string &name = "TableViewManager", const std::string &title = "");
95
96 typedef std::function<void ()> Delegate_t;
97
100
101 void AddNewColumnToCurrentCollection(const char* expr, const char* title, int prec = 2);
102
103 void AddDelegate(Delegate_t d) { fDelegates.push_back(d); }
104
105 Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override;
106
107 // read
109
110 // filling
111 REveTableHandle table(std::string className)
112 {
113 REveTableHandle handle(className, fSpecs);
114 return handle;
115 }
116
117 bool GetConfigChanged() const { return fConfigChanged; }
118
120private:
122 std::vector<Delegate_t> fDelegates;
124 bool fConfigChanged{false};
125};
126
127
128}
129}
130
131#endif
#define d(i)
Definition RSha256.hxx:102
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char cname
char name[80]
Definition TGX11.cxx:110
REveDataColumn::FieldType_e fType
REveTableEntry(const std::string &name, int precision, const std::string &expression)
std::map< std::string, Entries_t > Specs_t
REveTableHandle & column(const std::string &name, int precision, const std::string &expression)
REveTableHandle & column(const std::string &label, int precision)
std::vector< REveTableEntry > Entries_t
REveTableHandle(std::string className, Specs_t &specs)
REveTableHandle::Specs_t & RefSpecs()
std::vector< Delegate_t > fDelegates
REveTableHandle::Entries_t & RefTableEntries(std::string cname)
Find column definitions for given class name.
REveTableHandle table(std::string className)
void AddNewColumnToCurrentCollection(const char *expr, const char *title, int prec=2)
Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override
Fill core part of JSON representation.
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...