28#include <nlohmann/json.hpp>
57 fItems[idx]->SetRnrSelf(visible);
115 j[
"items"] = nlohmann::json::array();
116 for (
auto & chld :
fItems)
119 i[
"fFiltered"] = chld->GetFiltered();
120 i[
"fRnrSelf"] = chld->GetRnrSelf();
121 i[
"fColor"] = chld->GetMainColor();
122 j[
"items"].push_back(i);
133 std::vector<int> ids;
135 for (
size_t i = 0; i <
fItems.size(); ++i ) {
151 static const REveException eh(
"REveDataItemList::ProcessSelectionStr ");
152 static const std::regex comma_re(
"\\s*,\\s*", std::regex::optimize);
153 std::string str(secondary_idcs);
155 std::sregex_token_iterator itr(str.begin(), str.end(), comma_re, -1);
156 std::sregex_token_iterator end;
159 while (itr != end) sis.insert(std::stoi(*itr++));
161 catch (
const std::invalid_argument& ia) {
162 throw eh +
"invalid secondary index argument '" + *itr +
"' - must be int.";
180 if (secondary_idcs.empty()) {
185 int idx = *secondary_idcs.begin();
188 std::string
name = col->GetName();
189 auto li =
name.size();
190 if (li &&
name[li-1] ==
's')
196 for (
auto &z : secondary_idcs)
199 data = col->GetDataPtr(idx);
202 std::string eval = t->fTooltipFunction.EvalExpr(data);
203 res += std::string(
TString::Format(
"\n %s = %s", t->fTooltipTitle.c_str(), eval.c_str()));
217 tt->fTooltipFunction.SetPrecision(2);
223 auto re =
tt->fTooltipFunction.GetFunctionExpressionString();
224 gROOT->ProcessLine(re.c_str());
244 printf(
"REveDataItemList::DummyItemsCahngeDelegate not implemented\n");
253 printf(
"REveDataItemList::DummyFillImpliedSelectedDelegate not implemented\n");
264 std::string lname =
n +
"Items";
281 static const REveException eh(
"REveDataCollection::SetFilterExpr ");
284 throw eh +
"item class has to be set before the filter expression.";
288 int ibeg = 0, iend = strlen(filter);
289 while (ibeg < iend && isspace(filter[ibeg])) ++ibeg;
290 while (iend > ibeg && isspace(filter[iend-1])) --iend;
300 s <<
"*((std::function<bool(" <<
fItemClass->
GetName() <<
"*)>*)" << std::hex << std::showbase
306 gROOT->ProcessLine(s.str().c_str());
310 catch (
const std::exception &exc)
322 if (ii->GetFiltered()) {
323 ii->SetFiltered(
false);
348 ii->SetFiltered( ! res );
350 ids.push_back(idx++);
365 TString ctor =
c->GetName(), dtor =
"~";
367 int i = ctor.
Last(
':');
376 TIter next(
c->GetListOfMethods());
377 while ((meth = (
TMethod*) next()))
382 if (
m == ctor ||
m == dtor ||
383 m ==
"Class" ||
m ==
"Class_Name" ||
m ==
"Class_Version" ||
m ==
"Dictionary" ||
m ==
"IsA" ||
384 m ==
"DeclFileName" ||
m ==
"ImplFileName" ||
m ==
"DeclFileLine" ||
m ==
"ImplFileLine" ||
385 m ==
"Streamer" ||
m ==
"StreamerNVirtual" ||
m ==
"ShowMembers" ||
386 m ==
"CheckTObjectHashConsistency")
397 if ( ! ms.
IsNull()) ms +=
", ";
407 jm[
"c"] =
c->GetName();
412 TIter blnext(
c->GetListOfBases());
420 j[
"fPublicFunctions"] = nlohmann::json::array();
422 pm.FillJSON(
fItemClass, j[
"fPublicFunctions"]);
433 chld->SetMainColor(newv);
441 chld->SetMainColor(newv);
#define R__LOG_ERROR(...)
void SetFilterExpr(const char *filter)
TClass * GetItemClass() const
static Color_t fgDefaultColor
std::function< bool(void *)> fFilterFoo
void * GetDataPtr(Int_t i) const
void StreamPublicMethods(nlohmann::json &cj) const
REveDataItemList * fItemList
void AddItem(void *data_ptr, const std::string &n, const std::string &t)
Bool_t SetRnrState(Bool_t) override
Set render state of this element and of its children to the same value.
void SetMainColor(Color_t) override
Set main color of the element.
Int_t WriteCoreJson(nlohmann::json &cj, Int_t rnr_offset) override
Write core json.
REveDataCollection(const std::string &n="REveDataCollection", const std::string &t="")
REveDataItemList(const std::string &n="Items", const std::string &t="")
virtual void ItemChanged(REveDataItem *item)
Int_t WriteCoreJson(nlohmann::json &cj, Int_t rnr_offset) override
Write core json.
void AddTooltipExpression(const std::string &title, const std::string &expr, bool init=true)
FillImpliedSelectedFunc_t fHandlerFillImplied
void ProcessSelection(ElementId_t id, bool multi, bool secondary, const std::set< int > &in_secondary_idcs)
void FillImpliedSelectedSet(Set_t &impSelSet) override
Populate set impSelSet with derived / dependant elements.
void ProcessSelectionStr(ElementId_t id, bool multi, bool secondary, const char *in_secondary_idcs)
void SetItemColorRGB(Int_t idx, UChar_t r, UChar_t g, UChar_t b)
std::vector< std::unique_ptr< TTip > > fTooltipExpressions
Bool_t SetRnrState(Bool_t) override
Set render state of this element and of its children to the same value.
std::string GetHighlightTooltip(const std::set< int > &secondary_idcs) const override
void SetItemsChangeDelegate(ItemsChangeFunc_t)
static void DummyFillImpliedSelected(REveDataItemList *, Set_t &impSelSet)
void SetFillImpliedSelectedDelegate(FillImpliedSelectedFunc_t)
std::vector< REveDataItem * > fItems
ItemsChangeFunc_t fHandlerItemsChange
static void DummyItemsChange(REveDataItemList *, const std::vector< int > &)
std::function< void(REveDataItemList *, Set_t &)> FillImpliedSelectedFunc_t
void SetItemVisible(Int_t idx, Bool_t visible)
std::function< void(REveDataItemList *, const std::vector< int > &)> ItemsChangeFunc_t
const std::string & GetName() const
virtual Int_t WriteCoreJson(nlohmann::json &cj, Int_t rnr_offset)
Write core json.
void SetupDefaultColorAndTransparency(Color_t col, Bool_t can_edit_color, Bool_t can_edit_transparency)
Set up element to use built-in main color and set flags allowing editing of main color and transparen...
virtual void AddElement(REveElement *el)
Add el to the list of children.
virtual Bool_t SetRnrState(Bool_t rnr)
Set render state of this element and of its children to the same value.
std::set< REveElement * > Set_t
ElementId_t GetElementId() const
virtual void SetMainColor(Color_t color)
Set main color of the element.
virtual Color_t GetMainColor() const
REveException Exception-type thrown by Eve classes.
SelectionSet_t & RefSelectedSet()
REveSelection Container for selected and highlighted elements.
void NewElementPicked(ElementId_t id, bool multi, bool secondary, const std::set< int > &secondary_idcs={})
Called from GUI when user picks or un-picks an element.
Each class (see TClass) has a linked list of its base class(es).
TClass * GetClassPointer(Bool_t load=kTRUE)
Get pointer to the base class TClass.
TClass instances represent classes, structs and namespaces in the ROOT type system.
static Int_t GetColor(const char *hexcolor)
Static method returning color number for color specified by hex color string of form: "#rrggbb",...
const char * GetReturnTypeName() const
Get full type description of function return type, e,g.: "class TDirectory*".
Each ROOT method (see TMethod) has a linked list of its arguments.
const char * GetTypeName() const
Get type of method argument, e.g.: "class TDirectory*" -> "TDirectory" Result needs to be used or cop...
Each ROOT class (see TClass) has a linked list of methods.
virtual TList * GetListOfMethodArgs()
Returns methodarg list and additionally updates fDataMember in TMethod by calling FindDataMember();.
virtual const char * GetName() const
Returns name of object.
TString & Replace(Ssiz_t pos, Ssiz_t n, const char *s)
const char * Data() const
Ssiz_t Last(char c) const
Find last occurrence of a character c.
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
R__EXTERN REveManager * gEve
RLogChannel & REveLog()
Log channel for Eve diagnostics.
basic_json< std::map, std::vector, std::string, bool, std::int64_t, std::uint64_t, double, std::allocator, adl_serializer, std::vector< std::uint8_t > > json
std::string fTooltipTitle