27namespace Experimental {
54std::pair<std::string_view, std::string_view>
DecomposePath(std::string_view path);
58class RFileKeyIterable;
183 RIterator
begin()
const;
184 RIterator
end()
const;
265 explicit RFile(std::unique_ptr<TFile> file);
270 std::variant<
const char *, std::reference_wrapper<const std::type_info>>
type)
const;
273 void PutUntyped(std::string_view path,
const std::type_info &
type,
const void *obj, std::uint32_t flags);
276 template <
typename T>
277 void PutInternal(std::string_view path,
const T &obj, std::uint32_t flags)
309 static std::unique_ptr<RFile>
Open(std::string_view path);
319 static std::unique_ptr<RFile>
Update(std::string_view path);
330 template <
typename T>
331 std::unique_ptr<T>
Get(std::string_view path)
const
334 return std::unique_ptr<T>(
static_cast<T *
>(obj));
344 template <
typename T>
345 void Put(std::string_view path,
const T &obj)
358 template <
typename T>
405 std::optional<RKeyInfo>
GetKeyInfo(std::string_view path)
const;
408 void Print(std::ostream &out = std::cout)
const;
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
bool operator==(const iterator &rh) const
bool operator!=(const iterator &rh) const
std::input_iterator_tag iterator_category
std::uint16_t fRootDirNesting
std::deque< RIterStackElem > fIterStack
RIterator(TIterator *iter, Pattern_t pattern, std::uint32_t flags)
std::ptrdiff_t difference_type
The iterable returned by RFile::ListKeys()
RFileKeyIterable(TFile *file, std::string_view rootDir, std::uint32_t flags)
An interface to read from, or write to, a ROOT file, as well as performing other common operations.
void Close()
Flushes the RFile if needed and closes it, disallowing any further reading or writing.
static constexpr int kMaxPathNesting
std::unique_ptr< TFile > fFile
size_t Flush()
Writes all objects and the file structure to disk.
static std::unique_ptr< RFile > Update(std::string_view path)
Opens the file for updating, creating a new one if it doesn't exist.
void Print(std::ostream &out=std::cout) const
Prints the internal structure of this RFile to the given stream.
void PutInternal(std::string_view path, const T &obj, std::uint32_t flags)
TKey * GetTKey(std::string_view path) const
Given path, returns the TKey corresponding to the object at that path (assuming the path is fully spl...
std::optional< RKeyInfo > GetKeyInfo(std::string_view path) const
Retrieves information about the key of object at path, if one exists.
static std::unique_ptr< RFile > Open(std::string_view path)
Opens the file for reading.
std::unique_ptr< T > Get(std::string_view path) const
Retrieves an object from the file.
void * GetUntyped(std::string_view path, std::variant< const char *, std::reference_wrapper< const std::type_info > > type) const
Gets object path from the file and returns an owning pointer to it.
static std::unique_ptr< RFile > Recreate(std::string_view path, const RRecreateOptions &opts=RRecreateOptions())
Opens the file for reading/writing, overwriting it if it already exists.
void Overwrite(std::string_view path, const T &obj, bool backupPrevious=true)
Puts an object into the file, overwriting any previously-existing object at that path.
void PutUntyped(std::string_view path, const std::type_info &type, const void *obj, std::uint32_t flags)
Writes obj to file, without taking its ownership.
PutFlags
Flags used in PutInternal()
@ kPutOverwriteKeepCycle
When overwriting an object, preserve the existing one and create a new cycle, rather than removing it...
@ kPutAllowOverwrite
When encountering an object at the specified path, overwrite it with the new one instead of erroring ...
RFileKeyIterable ListKeys(std::string_view basePath="", std::uint32_t flags=kListObjects|kListRecursive) const
Returns an iterable over all keys of objects and/or directories written into this RFile starting at p...
void Put(std::string_view path, const T &obj)
Puts an object into the file.
RFile(std::unique_ptr< TFile > file)
Information about an RFile object's Key.
const std::string & GetClassName() const
std::uint64_t GetNBytesKey() const
Returns the on-disk size of this object's key.
const std::string & GetTitle() const
std::uint64_t fSeekParentDir
ECategory GetCategory() const
std::uint64_t GetSeekParentDir() const
Returns the on-disk offset of this object's parent directory key.
std::string GetBaseName() const
Returns the base name of this key, i.e. the name of the object without the directory part.
std::uint16_t GetCycle() const
const std::string & GetPath() const
Returns the absolute path of this key, i.e. the directory part plus the object name.
std::uint64_t GetSeekKey() const
Returns the on-disk offset of this object's key.
std::uint64_t GetLenObj() const
Returns the in-memory size of the uncompressed object.
std::uint64_t GetNBytesObj() const
Returns the on-disk size of the (potentially compressed) object, excluding its key.
A log configuration for a channel, e.g.
A ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-li...
Iterator abstract base class.
Book space in a file, create I/O buffers, to fill them, (un)compress them.
std::pair< std::string_view, std::string_view > DecomposePath(std::string_view path)
Given a "path-like" string (like foo/bar/baz), returns a pair { dirName, baseName }.
ROOT::RLogChannel & RFileLog()
void * RFile_GetObjectFromKey(RFile &file, const RKeyInfo &key)
Returns an owning pointer to the object referenced by key.
TFile * GetRFileTFile(RFile &rfile)
bool operator==(const RIterStackElem &other) const
std::shared_ptr< TIterator > fIter
RIterStackElem(TIterator *it, const std::string &path="")
int fCompressionSettings
See core/zip/inc/Compression.h for the meaning of the compression argument.
@ kUseGeneralPurpose
Use the new recommended general-purpose setting; it is a best trade-off between compression ratio/dec...