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
73 REveTableHandle(std::string className, Specs_t &specs)
74 :fClassName(className), fSpecs(specs)
75 {
76 }
77
78protected:
79 std::string fClassName;
81};
82
83///////////////////////////////////////////////////////////////////////////////
84/// REveTableViewInfo
85///////////////////////////////////////////////////////////////////////////////
86
88{
89public:
90 REveTableViewInfo(const std::string &name = "TableViewManager", const std::string &title = "");
91
92 typedef std::function<void ()> Delegate_t;
93
96
97 void AddNewColumnToCurrentCollection(const char* expr, const char* title, int prec = 2);
98
99 void AddDelegate(Delegate_t d) { fDelegates.push_back(d); }
100
101 Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override;
102
103 // read
105
106 // filling
107 REveTableHandle table(std::string className)
108 {
109 REveTableHandle handle(className, fSpecs);
110 return handle;
111 }
112
113 bool GetConfigChanged() const { return fConfigChanged; }
114
116private:
118 std::vector<Delegate_t> fDelegates;
120 bool fConfigChanged{false};
121};
122
123
124}
125}
126
127#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.
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.
basic_json<> json