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 #include <ROOT/REveDataTable.hxx>
18 
19 namespace ROOT {
20 namespace Experimental {
21 
22 ///////////////////////////////////////////////////////////////////////////////
23 /// REveTableEntry
24 ///////////////////////////////////////////////////////////////////////////////
25 
27 public:
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 
55 public:
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 
78 protected:
79  std::string fClassName;
81 };
82 
83 ///////////////////////////////////////////////////////////////////////////////
84 /// REveTableViewInfo
85 ///////////////////////////////////////////////////////////////////////////////
86 
88 {
89 public:
90  REveTableViewInfo(const std::string &name = "TableViewManager", const std::string &title = "");
91 
93 
96 
97  void AddNewColumnToCurrentCollection(const std::string& expr, const std::string& 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
104  REveTableHandle::Entries_t &RefTableEntries(std::string cname);
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 
115 
116 private:
118  std::vector<Delegate_t> fDelegates;
120  bool fConfigChanged{false};
121 };
122 
123 
124 }
125 }
126 
127 #endif
ROOT::Experimental::REveTableViewInfo::AddDelegate
void AddDelegate(Delegate_t d)
Definition: REveTableInfo.hxx:99
REveDataTable.hxx
ROOT::Experimental::REveTableViewInfo::Delegate_t
std::function< void()> Delegate_t
Definition: REveTableInfo.hxx:92
REveDataCollection.hxx
Int_t
int Int_t
Definition: RtypesCore.h:45
ROOT::Experimental::REveTableViewInfo::SetDisplayedCollection
void SetDisplayedCollection(ElementId_t)
Definition: REveTableInfo.cxx:31
ROOT::Experimental::REveTableHandle::fSpecs
Specs_t & fSpecs
Definition: REveTableInfo.hxx:80
ROOT::Experimental::REveDataColumn
Definition: REveDataTable.hxx:44
ROOT::Experimental::REveTableViewInfo::AddNewColumnToCurrentCollection
void AddNewColumnToCurrentCollection(const std::string &expr, const std::string &title, int prec=2)
Definition: REveTableInfo.cxx:43
ROOT::Experimental::REveElement
Definition: REveElement.hxx:41
ROOT::Experimental::REveDataColumn::FieldType_e
FieldType_e
Definition: REveDataTable.hxx:46
ROOT::Experimental::REveTableHandle::column
REveTableHandle & column(const std::string &label, int precision)
Definition: REveTableInfo.hxx:68
ROOT::Experimental::REveTableHandle::Specs_t
std::map< std::string, Entries_t > Specs_t
Definition: REveTableInfo.hxx:57
ROOT::Experimental::REveTableViewInfo::WriteCoreJson
Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override
Fill core part of JSON representation.
Definition: REveTableInfo.cxx:155
ROOT::Experimental::REveTableViewInfo::fConfigChanged
bool fConfigChanged
Definition: REveTableInfo.hxx:120
ROOT::Experimental::REveTableHandle::REveTableHandle
REveTableHandle(std::string className, Specs_t &specs)
Definition: REveTableInfo.hxx:73
ROOT::Experimental::REveTableViewInfo::fDisplayedCollection
int fDisplayedCollection
Definition: REveTableInfo.hxx:117
ROOT::Experimental::REveTableViewInfo::RefTableEntries
REveTableHandle::Entries_t & RefTableEntries(std::string cname)
Find column definitions for given class name.
Definition: REveTableInfo.cxx:84
REveElement.hxx
ROOT::Experimental::REveTableEntry::fPrecision
int fPrecision
Definition: REveTableInfo.hxx:29
ROOT::R::function
void function(const Char_t *name_, T fun, const Char_t *docstring=0)
Definition: RExports.h:151
ROOT::Experimental::REveTableHandle
REveTableHandle.
Definition: REveTableInfo.hxx:52
ROOT::Experimental::REveTableEntry::REveTableEntry
REveTableEntry()
Definition: REveTableInfo.hxx:33
ROOT::Experimental::REveTableHandle::fClassName
std::string fClassName
Definition: REveTableInfo.hxx:79
ROOT::Experimental::REveTableViewInfo::fDelegates
std::vector< Delegate_t > fDelegates
Definition: REveTableInfo.hxx:118
void
typedef void((*Func_t)())
unsigned int
ROOT::Experimental::REveTableViewInfo
REveTableViewInfo.
Definition: REveTableInfo.hxx:88
ROOT::Experimental::REveTableViewInfo::fSpecs
REveTableHandle::Specs_t fSpecs
Definition: REveTableInfo.hxx:119
ROOT::Experimental::REveTableEntry::fName
std::string fName
Definition: REveTableInfo.hxx:28
ROOT::Experimental::REveTableEntry
REveTableEntry.
Definition: REveTableInfo.hxx:26
ROOT::Experimental::REveTableViewInfo::REveTableViewInfo
REveTableViewInfo(const std::string &name="TableViewManager", const std::string &title="")
Definition: REveTableInfo.cxx:27
ROOT::Experimental::REveTableHandle::Entries_t
std::vector< REveTableEntry > Entries_t
Definition: REveTableInfo.hxx:56
ROOT::Experimental::REveTableHandle::column
REveTableHandle & column(const std::string &name, int precision, const std::string &expression)
Definition: REveTableInfo.hxx:62
name
char name[80]
Definition: TGX11.cxx:110
ROOT::Experimental::REveTableViewInfo::GetDisplayedCollection
ElementId_t GetDisplayedCollection() const
Definition: REveTableInfo.hxx:95
ROOT::Experimental::REveTableEntry::Print
void Print() const
Definition: REveTableInfo.hxx:40
d
#define d(i)
Definition: RSha256.hxx:102
ROOT::Experimental::REveTableEntry::REveTableEntry
REveTableEntry(const std::string &name, int precision, const std::string &expression)
Definition: REveTableInfo.hxx:35
ROOT::Experimental::REveTableViewInfo::table
REveTableHandle table(std::string className)
Definition: REveTableInfo.hxx:107
ROOT::Experimental::REveTableViewInfo::GetConfigChanged
bool GetConfigChanged() const
Definition: REveTableInfo.hxx:113
ROOT
VSD Structures.
Definition: StringConv.hxx:21
ROOT::Experimental::REveTableEntry::fExpression
std::string fExpression
Definition: REveTableInfo.hxx:30
ROOT::Experimental::REveTableEntry::fType
REveDataColumn::FieldType_e fType
Definition: REveTableInfo.hxx:31