19 using namespace ROOT::Experimental;
21 REveTableViewInfo::REveTableViewInfo(
const std::string &name,
const std::string &title) : REveElement(name, title), fConfigChanged(false)
25 void REveTableViewInfo::SetDisplayedCollection(ElementId_t collectionId)
27 fDisplayedCollection = collectionId;
29 fConfigChanged =
true;
30 for (
auto &it : fDelegates)
33 fConfigChanged =
false;
37 void REveTableViewInfo::AddNewColumnToCurrentCollection(
const std::string& expr,
const std::string& title,
int prec)
39 if (!fDisplayedCollection)
return;
41 REveDataCollection* col =
dynamic_cast<REveDataCollection*
>(gEve->FindElementById(fDisplayedCollection));
43 printf(
"REveTableViewInfo::AddNewColumnToCurrentCollection error: collection not found\n");
47 const char *rtyp =
"void";
48 auto icls = col->GetItemClass();
49 std::function<void(void *)> fooptr;
51 s <<
"*((std::function<" << rtyp <<
"(" << icls->GetName() <<
"*)>*)" << std::hex << std::showbase << (size_t)(&fooptr)
52 <<
") = [](" << icls->GetName() <<
"* p){" << icls->GetName() <<
" &i=*p; return (" << expr
56 gROOT->ProcessLine(s.str().c_str(), &err);
57 if (err != TInterpreter::kNoError)
59 std::cout <<
"REveTableViewInfo::AddNewColumnToCurrentCollection failed." << std::endl;
63 fConfigChanged =
true;
64 table(col->GetItemClass()->GetName()).column(title, prec, expr);
66 for (
auto &it : fDelegates)
69 fConfigChanged =
false;
77 Int_t REveTableViewInfo::WriteCoreJson(nlohmann::json &j, Int_t rnr_offset)
79 auto ret = REveElement::WriteCoreJson(j, rnr_offset);
80 j[
"fDisplayedCollection"] = fDisplayedCollection;