File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -527,6 +527,12 @@ public:
527527 // / ~~~
528528 void EnableMetrics () { fMetrics .Enable (); }
529529 const Experimental::Detail::RNTupleMetrics &GetMetrics () const { return fMetrics ; }
530+
531+ // / Looks for an attribute set with the given name and creates an RNTupleAttrSetReader for it, with the provided
532+ // / read options.
533+ // / The returned reader has an independent lifetime from this RNTupleReader.
534+ std::unique_ptr<Experimental::RNTupleAttrSetReader>
535+ OpenAttributeSet (std::string_view attrSetName, const ROOT::RNTupleReadOptions &options = {});
530536}; // class RNTupleReader
531537
532538} // namespace ROOT
Original file line number Diff line number Diff line change 1515
1616#include < ROOT/RField.hxx>
1717#include < ROOT/RFieldVisitor.hxx>
18+ #include < ROOT/RNTupleAttrReading.hxx>
1819#include < ROOT/RNTupleImtTaskScheduler.hxx>
1920#include < ROOT/RNTuple.hxx>
2021#include < ROOT/RNTupleModel.hxx>
@@ -366,3 +367,20 @@ ROOT::DescriptorId_t ROOT::RNTupleReader::RetrieveFieldId(std::string_view field
366367 }
367368 return fieldId;
368369}
370+
371+ std::unique_ptr<ROOT::Experimental::RNTupleAttrSetReader>
372+ ROOT::RNTupleReader::OpenAttributeSet (std::string_view attrSetName, const ROOT::RNTupleReadOptions &readOpts)
373+ {
374+ auto attrSets = GetDescriptor ().GetAttrSetIterable ();
375+ const auto it =
376+ std::find_if (attrSets.begin (), attrSets.end (), [&](const auto &d) { return d.GetName () == attrSetName; });
377+ if (it == attrSets.end ())
378+ throw ROOT::RException (R__FAIL (std::string (" No such attribute set: " ) + std::string (attrSetName)));
379+
380+ auto attrSource = fSource ->OpenWithDifferentAnchor ({it->GetAnchorLocator (), it->GetAnchorLength ()}, readOpts);
381+ auto newReader = std::unique_ptr<RNTupleReader>(new RNTupleReader (std::move (attrSource), readOpts));
382+ R__ASSERT (newReader);
383+ auto attrSetReader = std::unique_ptr<ROOT::Experimental::RNTupleAttrSetReader>(
384+ new ROOT::Experimental::RNTupleAttrSetReader (std::move (newReader), it->GetSchemaVersionMajor ()));
385+ return attrSetReader;
386+ }
You can’t perform that action at this time.
0 commit comments