16#ifndef ROOT7_RMiniFile
17#define ROOT7_RMiniFile
35namespace Experimental {
89struct RTFileControlBlock;
119 void ReadBuffer(
void *buffer,
size_t nbytes, std::uint64_t offset);
140 void Write(
const void *buffer,
size_t nbytes, std::int64_t offset);
142 std::uint64_t
WriteKey(
const void *buffer,
size_t nbytes,
size_t len);
152 std::unique_ptr<ROOT::Experimental::Internal::RTFileControlBlock>
fControlBlock;
162 void Write(
const void *buffer,
size_t nbytes, std::int64_t offset = -1);
165 std::uint64_t
WriteKey(
const void *buffer, std::size_t nbytes, std::size_t len, std::int64_t offset = -1,
166 std::uint64_t directoryOffset = 100,
167 const std::string &className =
"",
168 const std::string &objectName =
"",
169 const std::string &title =
"");
203 std::unique_ptr<TFile> &
file);
214 std::uint64_t
WriteNTupleHeader(
const void *data,
size_t nbytes,
size_t lenHeader);
216 std::uint64_t
WriteNTupleFooter(
const void *data,
size_t nbytes,
size_t lenFooter);
218 std::uint64_t
WriteBlob(
const void *data,
size_t nbytes,
size_t len);
Read RNTuple data blocks from a TFile container, provided by a RRawFile.
bool fIsBare
Indicates whether the file is a TFile container or an RNTuple bare file.
RNTuple GetNTupleProper(std::string_view ntupleName)
Used when the file turns out to be a TFile container.
RMiniFileReader()=default
RNTuple GetNTuple(std::string_view ntupleName)
Extracts header and footer location for the RNTuple identified by ntupleName.
RNTuple GetNTupleBare(std::string_view ntupleName)
Used when the file container turns out to be a bare file.
ROOT::Internal::RRawFile * fRawFile
The raw file used to read byte ranges.
void ReadBuffer(void *buffer, size_t nbytes, std::uint64_t offset)
Reads a given byte range from the file into the provided memory buffer.
Write RNTuple data blocks in a TFile or a bare file container.
std::uint64_t WriteBlob(const void *data, size_t nbytes, size_t len)
Writes a new record as an RBlob key into the file.
std::string fNTupleName
The identifier of the RNTuple; A single writer object can only write a single RNTuple but multiple wr...
std::string fFileName
The file name without parent directory; only required when writing with a C file stream.
std::uint64_t WriteNTupleFooter(const void *data, size_t nbytes, size_t lenFooter)
Writes the compressed footer and registeres its location; lenFooter is the size of the uncompressed f...
void Commit()
Writes the RNTuple key to the file so that the header and footer keys can be found.
RFileProper fFileProper
For updating existing files and for storing more than just an RNTuple in the file.
RFileSimple fFileSimple
For simple use cases, survives without libRIO dependency.
RNTupleFileWriter(const RNTupleFileWriter &other)=delete
static RNTupleFileWriter * Append(std::string_view ntupleName, TFile &file)
Add a new RNTuple identified by ntupleName to the existing TFile.
static RNTupleFileWriter * Recreate(std::string_view ntupleName, std::string_view path, int defaultCompression, ENTupleContainerFormat containerFormat)
Create or truncate the local file given by path with the new empty RNTuple identified by ntupleName.
RNTupleFileWriter(std::string_view name)
RNTupleFileWriter & operator=(const RNTupleFileWriter &other)=delete
bool fIsBare
A simple file can either be written as TFile container or as NTuple bare file.
void WriteTFileSkeleton(int defaultCompression)
For a TFile container written by a C file stream, write the records that constitute an empty file.
void WriteBareFileSkeleton(int defaultCompression)
For a bare file, which is necessarily written by a C file stream, write file header.
std::uint64_t WriteNTupleHeader(const void *data, size_t nbytes, size_t lenHeader)
Writes the compressed header and registeres its location; lenHeader is the size of the uncompressed h...
RNTuple fNTupleAnchor
Header and footer location of the ntuple, written on Commit()
RNTupleFileWriter(RNTupleFileWriter &&other)=delete
The RRawFile provides read-only access to local and remote files.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
basic_string_view< char > string_view
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
void Write(const void *buffer, size_t nbytes, std::int64_t offset)
Low-level writing using a TFile.
std::uint64_t WriteKey(const void *buffer, size_t nbytes, size_t len)
Writes an RBlob opaque key with the provided buffer as data record and returns the offset of the reco...
RFileSimple(const RFileSimple &other)=delete
std::unique_ptr< ROOT::Experimental::Internal::RTFileControlBlock > fControlBlock
Keeps track of TFile control structures, which need to be updated on committing the data set.
RFileSimple(RFileSimple &&other)=delete
FILE * fFile
For the simplest cases, a C file stream can be used for writing.
RFileSimple & operator=(const RFileSimple &other)=delete
void Write(const void *buffer, size_t nbytes, std::int64_t offset=-1)
Writes bytes in the open stream, either at fFilePos or at the given offset.
std::uint64_t fFilePos
Keeps track of the seek offset.
std::uint64_t WriteKey(const void *buffer, std::size_t nbytes, std::size_t len, std::int64_t offset=-1, std::uint64_t directoryOffset=100, const std::string &className="", const std::string &objectName="", const std::string &title="")
Writes a TKey including the data record, given by buffer, into fFile; returns the file offset to the ...
Entry point for an RNTuple in a ROOT file.
std::uint64_t fSeekFooter
The file offset of the footer excluding the TKey part.
std::uint32_t fLenHeader
The size of the uncompressed ntuple header.
bool operator==(const RNTuple &other) const
The canonical, member-wise equality test.
std::uint64_t fReserved
Currently unused, reserved for later use.
std::uint32_t fVersion
Allows for evolving the struct in future versions.
std::uint32_t fNBytesHeader
The size of the compressed ntuple header.
std::uint32_t fSize
Allows for skipping the struct.
std::uint32_t fNBytesFooter
The size of the compressed ntuple footer.
std::uint32_t fLenFooter
The size of the uncompressed ntuple footer.
std::uint64_t fSeekHeader
The file offset of the header excluding the TKey part.