rntviewer/src/rntuple.cpp
2024-07-12 10:25:58 +02:00

38 lines
1.5 KiB
C++

internal
String8 rntuple_description(Arena *arena, const RNTuple_Info &ntuple)
{
String8 desc = push_str8f(arena, "version %u.%u.%u.%u",
ntuple.version.epoch,
ntuple.version.major,
ntuple.version.minor,
ntuple.version.patch);
return desc;
}
internal
RNTuple_Info get_rntuple_info(const char *fname, const char *ntpl_name)
{
RNTuple_Info info = {};
// TODO: proper error handling
root::RMicroFileReader file_reader { fname };
root::RNTuple_File_Info file_info = file_reader.GetNTupleProper(ntpl_name);
if (!file_info.failed) {
info.version.epoch = file_info.anchor.fVersionEpoch;
info.version.major = file_info.anchor.fVersionMajor;
info.version.minor = file_info.anchor.fVersionMinor;
info.version.patch = file_info.anchor.fVersionPatch;
info.rng_header.start = file_info.anchor.fSeekHeader;
info.rng_header.len = file_info.anchor.fNBytesHeader;
info.rng_footer.start = file_info.anchor.fSeekFooter;
info.rng_footer.len = file_info.anchor.fNBytesFooter;
info.rng_anchor.start = file_info.anchor_seek;
info.rng_anchor.len = file_info.anchor_nbytes;
info.rng_anchor_key.start = file_info.anchor_key_seek;
info.rng_anchor_key.len = file_info.anchor_key_nbytes;
info.rblob_header_size = file_info.rblob_key_header_nbytes;
info.root_file_header_size = file_info.tfile_header_nbytes;
}
return info;
}