Logo ROOT  
Reference Guide
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>
17
18namespace ROOT {
19namespace Experimental {
20
21///////////////////////////////////////////////////////////////////////////////
22/// REveTableEntry
23///////////////////////////////////////////////////////////////////////////////
24
26public:
27 std::string fName;
29 std::string fExpression;
31
32 REveTableEntry() : fName("unknown"), fPrecision(2), fType(REveDataColumn::FT_Double) {}
33
34 REveTableEntry(const std::string &name, int precision, const std::string &expression)
35 : fName(name), fPrecision(precision), fExpression(expression), fType(REveDataColumn::FT_Double)
36 {
37 }
38
39 void Print() const
40 {
41 printf("TableEntry\n");
42 printf("name: %s expression: %s\n", fName.c_str(), fExpression.c_str());
43 }
44};
45
46///////////////////////////////////////////////////////////////////////////////
47/// REveTableHandle
48///////////////////////////////////////////////////////////////////////////////
49
51{
52 friend class REveTableViewInfo;
53
54public:
55 typedef std::vector<REveTableEntry> Entries_t;
56 typedef std::map<std::string, Entries_t> Specs_t;
57
58 // REveTableHandle() {}
59
61 column(const std::string &name, int precision, const std::string &expression)
62 {
63 fSpecs[fClassName].emplace_back(name, precision, expression);
64 return *this;
65 }
66
67 REveTableHandle &column(const std::string &label, int precision)
68 {
69 return column(label, precision, label);
70 }
71
72 REveTableHandle(std::string className, Specs_t &specs)
73 :fClassName(className), fSpecs(specs)
74 {
75 }
76
77protected:
78 std::string fClassName;
80};
81
82///////////////////////////////////////////////////////////////////////////////
83/// REveTableViewInfo
84///////////////////////////////////////////////////////////////////////////////
85
87{
88public:
89 REveTableViewInfo(const std::string &name = "TableViewManager", const std::string &title = "");
90
92
95
96 void AddNewColumnToCurrentCollection(const std::string& expr, const std::string& title, int prec = 2);
97
98 void AddDelegate(Delegate_t d) { fDelegates.push_back(d); }
99
100 Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override;
101
102 // read
103 REveTableHandle::Entries_t &RefTableEntries(std::string cname) { return fSpecs[cname]; }
104
105 // filling
106 REveTableHandle table(std::string className)
107 {
108 REveTableHandle handle(className, fSpecs);
109 return handle;
110 }
111
112 bool GetConfigChanged() const { return fConfigChanged; }
113
114
115private:
117 std::vector<Delegate_t> fDelegates;
119 bool fConfigChanged{false};
120};
121
122
123}
124}
125
126#endif
#define d(i)
Definition: RSha256.hxx:102
int Int_t
Definition: RtypesCore.h:41
char name[80]
Definition: TGX11.cxx:109
typedef void((*Func_t)())
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)
void AddNewColumnToCurrentCollection(const std::string &expr, const std::string &title, int prec=2)
REveTableHandle::Entries_t & RefTableEntries(std::string cname)
REveTableViewInfo(const std::string &name="TableViewManager", const std::string &title="")
ElementId_t GetDisplayedCollection() const
std::vector< Delegate_t > fDelegates
REveTableHandle table(std::string className)
Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override
Fill core part of JSON representation.
unsigned int ElementId_t
Definition: REveTypes.hxx:25
void function(const Char_t *name_, T fun, const Char_t *docstring=0)
Definition: RExports.h:151
VSD Structures.
Definition: StringConv.hxx:21