28#include <unordered_map>
35 std::unordered_map<const Detail::RFieldBase *, DescriptorId_t> fieldPtr2Id;
37 for (
auto &field : *
fModel->GetRootField()) {
38 auto parentId = fieldPtr2Id[field.GetParent()];
39 auto fieldId =
fSource->GetDescriptor().FindFieldId(field.GetName(), parentId);
41 fieldPtr2Id[&field] = fieldId;
47 std::unique_ptr<ROOT::Experimental::RNTupleModel> model,
48 std::unique_ptr<ROOT::Experimental::Detail::RPageSource> source)
49 : fSource(std::move(source))
50 , fModel(std::move(model))
51 , fMetrics(
"RNTupleReader")
59 : fSource(std::move(source))
61 , fMetrics(
"RNTupleReader")
74 std::unique_ptr<RNTupleModel> model,
91 char frameSymbol =
'*';
99 std::string
name = fSource->GetDescriptor().GetName();
106 for (
int i = 0; i < (
width/2 +
width%2 - 4); ++i)
109 for (
int i = 0; i < (
width/2 - 4); ++i)
115 GetModel()->GetRootField()->AcceptVisitor(prepVisitor);
122 for (
int i = 0; i <
width; ++i)
125 GetModel()->GetRootField()->AcceptVisitor(printVisitor);
126 for (
int i = 0; i <
width; ++i)
131 fSource->GetDescriptor().PrintInfo(
output);
145 auto entry = fModel->CreateEntry();
146 LoadEntry(index, entry.get());
151 for (
auto iValue = entry->begin(); iValue != entry->end(); ) {
154 iValue->GetField()->AcceptVisitor(visitor);
156 if (++iValue == entry->end()) {
163 output <<
"}" << std::endl;
177 std::unique_ptr<ROOT::Experimental::RNTupleModel> model,
178 std::unique_ptr<ROOT::Experimental::Detail::RPageSink> sink)
179 : fSink(std::move(sink))
180 , fModel(std::move(model))
181 , fClusterSizeEntries(kDefaultClusterSizeEntries)
191 fSink->CommitDataset();
195 std::unique_ptr<RNTupleModel> model,
206 if (fNEntries == fLastCommitted)
return;
207 for (
auto& field : *fModel->GetRootField()) {
209 field.CommitCluster();
211 fSink->CommitCluster(fNEntries);
212 fLastCommitted = fNEntries;
220 : fOffset(0), fDefaultEntry(std::move(defaultEntry))
include TDocParser_001 C image html pict1_TDocParser_001 png width
static void Connect(DescriptorId_t fieldId, RPageStorage &pageStorage, RFieldBase &field)
void ObserveMetrics(RNTupleMetrics &observee)
static std::unique_ptr< RPageSink > Create(std::string_view ntupleName, std::string_view location, const RNTupleWriteOptions &options=RNTupleWriteOptions())
Guess the concrete derived page source from the file name (location)
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)
RCollectionNTuple(std::unique_ptr< REntry > defaultEntry)
static std::unique_ptr< RNTupleReader > Open(std::unique_ptr< RNTupleModel > model, std::string_view ntupleName, std::string_view storage)
Detail::RNTupleMetrics fMetrics
void Show(NTupleSize_t index, const ENTupleFormat format=ENTupleFormat::kJSON, std::ostream &output=std::cout)
Shows the values of the i-th entry/row, starting with 0 for the first entry.
std::unique_ptr< Detail::RPageSource > fSource
RNTupleReader(std::unique_ptr< RNTupleModel > model, std::unique_ptr< Detail::RPageSource > source)
The user imposes an ntuple model, which must be compatible with the model found in the data on storag...
void PrintInfo(const ENTupleInfo what=ENTupleInfo::kSummary, std::ostream &output=std::cout)
Prints a detailed summary of the ntuple, including a list of fields.
std::unique_ptr< RNTupleModel > fModel
Needs to be destructed before fSource.
Common user-tunable settings for storing ntuples.
void CommitCluster()
Ensure that the data from the so far seen Fill calls has been written to storage.
RNTupleWriter(std::unique_ptr< RNTupleModel > model, std::unique_ptr< Detail::RPageSink > sink)
std::unique_ptr< RNTupleModel > fModel
Needs to be destructed before fSink.
std::unique_ptr< Detail::RPageSink > fSink
static std::unique_ptr< RNTupleWriter > Recreate(std::unique_ptr< RNTupleModel > model, std::string_view ntupleName, std::string_view storage, const RNTupleWriteOptions &options=RNTupleWriteOptions())
Visitor used for a pre-processing run to collect information needed by another visitor class.
unsigned int GetDeepestLevel() const
unsigned int GetNumFields() const
Contains settings for printing and prints a summary of an RField instance.
void SetDeepestLevel(int d)
void SetFrameSymbol(char s)
Renders a JSON value corresponding to the field.
basic_string_view< char > string_view
ENTupleInfo
Listing of the different options that can be printed by RNTupleReader::GetInfo()
std::uint64_t NTupleSize_t
Integer type long enough to hold the maximum number of entries in a column.
ENTupleFormat
Listing of the different entry output formats of RNTupleReader::Show()
constexpr DescriptorId_t kInvalidDescriptorId
static void output(int code)