Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
REveTableProxyBuilder.cxx
Go to the documentation of this file.
1// @(#)root/eve7:$Id$
2// Authors: Matevz Tadel & Alja Mrak-Tadel: 2020
3
4/*************************************************************************
5 * Copyright (C) 1995-2020, 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#include "TClass.h"
13#include "TROOT.h"
19#include <ROOT/REveManager.hxx>
20
21using namespace ROOT::Experimental;
22
24{
25 fTable = new REveDataTable("ProxyTable");
26}
27
29{
30 fTable->Destroy();
31 fTable = nullptr;
32}
33
34// reuse table product
36{
37}
38
40{
41 if (Collection())
42 {
43 // printf("REveDataProxyBuilderBase::Build %p %s products %lu\n", m_collection, m_collection->GetCName(), m_products.size());
44 try
45 {
46
47 Clean();
48
49 for (auto &pp: m_products)
50 {
51
52 REveElement* product = pp->m_elements;
53 const REveViewContext* context = pp->m_viewContext;
54
55 REveTableViewInfo *info = context->GetTableViewInfo();
57 return;
58 }
59
60 if (product->NumChildren() == 0) {
61 product->AddElement(fTable);
62 }
63
64 // printf("-----REveTableProxyBuilder::Build() body for %s (%p, %p)\n",collection->GetCName(), collection,
65 // Collection() );
66
67 if (info->GetConfigChanged() || fTable->NumChildren() == 0) {
69 std::stringstream ss;
70 REveTableHandle::Entries_t &tableEntries =
72 for (const REveTableEntry &spec : tableEntries) {
73 auto c = new REveDataColumn(spec.fName);
75 using namespace std::string_literals;
76 std::string exp = spec.fExpression;
77 c->SetPrecision(spec.fPrecision);
78 c->SetExpressionAndType(exp, spec.fType);
79 ss << c->GetFunctionExpressionString();
80 ss << "\n";
81 }
82 // std::cout << ss.str();
83 gROOT->ProcessLine(ss.str().c_str());
84 }
86 }
87 }
88 catch (const std::runtime_error &iException) {
89 R__LOG_ERROR(REveLog()) << "Caught exception in build function for item " << Collection()->GetName() << ":\n"
90 << iException.what() << std::endl;
91 }
92 }
93}
94
96{
98 fTable->SetCollection(collection);
99}
100
102{
103 // printf("REveTableProxyBuilder::ModelChanges\n");
105}
106
108 Build();
109}
#define R__LOG_ERROR(...)
Definition RLogger.hxx:362
#define c(i)
Definition RSha256.hxx:101
#define gROOT
Definition TROOT.h:406
void SetCollection(const REveDataCollection *col)
const std::string & GetName() const
virtual void Destroy()
Destroy this element.
virtual void AddElement(REveElement *el)
Add el to the list of children.
virtual void DestroyElements()
Destroy all children of this element.
ElementId_t GetElementId() const
std::vector< REveTableEntry > Entries_t
void SetCollection(REveDataCollection *) override
void ModelChanges(const REveDataCollection::Ids_t &, REveDataProxyBuilderBase::Product *p) override
REveTableHandle::Entries_t & RefTableEntries(std::string cname)
Find column definitions for given class name.
REveTableViewInfo * GetTableViewInfo() const
const char * GetName() const override
Returns name of object.
Definition TNamed.h:47
RLogChannel & REveLog()
Log channel for Eve diagnostics.
Definition REveTypes.cxx:51