22using namespace std::string_literals;
39 std::shared_ptr<ROOT::Experimental::Detail::RPageSource>
fNtplSource;
47 RFieldElement(std::shared_ptr<ROOT::Experimental::Detail::RPageSource> ntplSource,
48 const std::string &parent_name,
64 return "RField name "s + fld.GetFieldName() +
" type "s + fld.GetTypeName();
70 const TClass *
GetClass()
const {
return TClass::GetClass<ROOT::Experimental::RNTuple>(); }
80 if (range.begin() != range.end())
return kActNone;
106 std::shared_ptr<ROOT::Experimental::Detail::RPageSource>
fNtplSource;
125 std::string
GetTitle()
const override {
return "RNTuple title"s; }
130 const TClass *
GetClass()
const {
return TClass::GetClass<ROOT::Experimental::RNTuple>(); }
151 std::shared_ptr<ROOT::Experimental::Detail::RPageSource>
fNtplSource;
152 std::vector<ROOT::Experimental::DescriptorId_t>
fFieldIds;
158 std::vector<ROOT::Experimental::DescriptorId_t> &&ids,
159 const std::string &parent_name =
""s)
179 return subrange.begin() != subrange.end();
191 auto item = std::make_unique<RItem>(field.GetFieldName(), nchilds, nchilds > 0 ?
"sap-icon://split" :
"sap-icon://e-care");
193 item->SetTitle(
"RField name "s + field.GetFieldName() +
" type "s + field.GetTypeName());
207 std::vector<ROOT::Experimental::DescriptorId_t> ids;
210 ids.emplace_back(
f.GetId());
212 if (ids.size() == 0)
return nullptr;
216 prefix.append(fld.GetFieldName());
219 return std::make_unique<RFieldsIterator>(
fNtplSource, std::move(ids), prefix);
224 std::vector<ROOT::Experimental::DescriptorId_t> ids;
226 for (
auto &
f :
fNtplSource->GetDescriptor().GetTopLevelFields())
227 ids.emplace_back(
f.GetId());
229 if (ids.size() == 0)
return nullptr;
230 return std::make_unique<RFieldsIterator>(
fNtplSource, std::move(ids));
250 RegisterNTupleFunc([](
const std::string &tuple_name,
const std::string &filename) -> std::shared_ptr<RElement> {
251 auto elem = std::make_shared<RNTupleElement>(tuple_name, filename);
252 return elem->IsNull() ? nullptr : elem;
typedef void(GLAPIENTRYP _GLUfuncptr)(void)
RNTupleBrowseProvider newRNTupleBrowseProvider
Browsing element representing of RField.
EActionKind GetDefaultAction() const override
Get default action.
bool IsCapable(EActionKind kind) const override
Check if want to perform action.
ROOT::Experimental::DescriptorId_t fFieldId
virtual ~RFieldElement()=default
std::shared_ptr< ROOT::Experimental::Detail::RPageSource > fNtplSource
std::unique_ptr< RHolder > GetObject() override
Access object.
std::string GetTitle() const override
Title of RField.
std::unique_ptr< RLevelIter > GetChildsIter() override
Create iterator for childs elements if any.
const TClass * GetClass() const
Return class of field - for a moment using RNTuple class as dummy.
std::string GetName() const override
Name of RField.
RFieldElement(std::shared_ptr< ROOT::Experimental::Detail::RPageSource > ntplSource, const std::string &parent_name, const ROOT::Experimental::DescriptorId_t id)
Iterator over RNTuple fields.
std::unique_ptr< RItem > CreateItem() override
Create element for the browser.
std::shared_ptr< RElement > GetElement() override
Create RElement for current entry - may take much time to load object or open file.
std::shared_ptr< ROOT::Experimental::Detail::RPageSource > fNtplSource
bool Next() override
Shift to next entry.
virtual ~RFieldsIterator()=default
RFieldsIterator(std::shared_ptr< ROOT::Experimental::Detail::RPageSource > ntplSource, std::vector< ROOT::Experimental::DescriptorId_t > &&ids, const std::string &parent_name=""s)
std::vector< ROOT::Experimental::DescriptorId_t > fFieldIds
std::string GetItemName() const override
Returns current entry name
bool CanItemHaveChilds() const override
Returns true if current item can have childs.
Provider for browsing RNTuple classes.
virtual ~RNTupleBrowseProvider()
Browsing element representing of RNTuple.
std::string GetName() const override
Name of NTuple.
std::unique_ptr< RLevelIter > GetChildsIter() override
Create iterator for childs elements if any.
std::shared_ptr< ROOT::Experimental::Detail::RPageSource > fNtplSource
virtual ~RNTupleElement()=default
bool IsNull() const
Returns true if no ntuple found.
RNTupleElement(const std::string &ntplName, const std::string &filename)
std::string GetTitle() const override
Title of NTuple.
const TClass * GetClass() const
Basic element of browsable hierarchy.
EActionKind
Possible actions on double-click.
@ kActDraw7
can be drawn inside ROOT7 canvas
@ kActDraw6
can be drawn inside ROOT6 canvas
Iterator over single level hierarchy like any array, keys list, ...
Provider of different browsing methods for supported classes.
void RegisterNTupleFunc(BrowseNTupleFunc_t func)
static std::unique_ptr< RPageSource > Create(std::string_view ntupleName, std::string_view location, const RNTupleReadOptions &options=RNTupleReadOptions())
Guess the concrete derived page source from the file name (location)
Common user-tunable settings for reading ntuples.
TClass instances represent classes, structs and namespaces in the ROOT type system.
std::uint64_t DescriptorId_t
Distriniguishes elements of the same type within a descriptor, e.g. different fields.