26namespace Experimental {
31class RFileStorageInterface;
32class RFileSharedPtrCtor;
45 std::unique_ptr<Internal::RFileStorageInterface>
fStorage;
47 RFile(std::unique_ptr<Internal::RFileStorageInterface> &&storage);
107 static std::string
SetCacheDir(std::string_view path);
139 return std::make_unique<T>(*Get<T>(
name));
166 void Write(std::string_view
name, std::shared_ptr<T> &&obj)
189 RFilePtr(std::shared_ptr<RFile> &&);
Key/value store of objects.
Internal::RDirectoryEntry Find(std::string_view name) const
Find the RDirectoryEntry associated to the name.
void Add(std::string_view name, const std::shared_ptr< T > &ptr)
Add an existing object (rather a shared_ptr to it) to the RDirectory.
Points to an object that stores or reads objects in ROOT's binary format.
RFile * operator->()
Dereference the file pointer, giving access to the RFileImplBase object.
const RFile * operator->() const
Dereference the file pointer, giving access to the RFileImplBase object.
std::shared_ptr< RFile > fFile
static RFilePtr Recreate(std::string_view name, const Options_t &opts=Options_t())
Open a file with name for reading and writing.
void Flush()
Save all objects associated with this directory (including file header) to the storage medium.
static std::string SetCacheDir(std::string_view path)
Set the new directory used for cached reads, returns the old directory.
void Write(std::string_view name)
Write an object that is already lifetime managed by this RFileImplBase.
void Write(std::string_view name, const T *obj)
Write an object that is not lifetime managed by this RFileImplBase.
static std::string GetCacheDir()
Get the directory used for cached reads.
std::unique_ptr< T > Read(std::string_view name)
Read the object for a key.
~RFile()
Must not call Write() of all attached objects: some might not be needed to be written or writing migh...
std::unique_ptr< Internal::RFileStorageInterface > fStorage
Storage backend.
static RFilePtr Open(std::string_view name, const Options_t &opts=Options_t())
Open a file with name for reading.
void Write(std::string_view name, std::shared_ptr< T > &&obj)
Hand over lifetime management of an object to this RFileImplBase, and write it.
static RFilePtr OpenForUpdate(std::string_view name, const Options_t &opts=Options_t())
Open an existing file with name for reading and writing.
void WriteMemoryWithType(std::string_view name, const void *address, TClass *cl)
Serialize the object at address, using the object's TClass.
static RFilePtr Create(std::string_view name, const Options_t &opts=Options_t())
Open a file with name for reading and writing.
void Close()
Flush() and make the file non-writable: close it.
void Write(std::string_view name, const T &obj)
Write an object that is not lifetime managed by this RFileImplBase.
TClass instances represent classes, structs and namespaces in the ROOT type system.
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.
Options for RFile construction.
bool fCachedRead
Whether the file should be cached before reading.
int fAsyncTimeout
Timeout for asynchronous opening.
Options_t()
Default constructor needed for member inits.
std::string fCacheDir
Where to cache the file. If empty, defaults to RFilePtr::GetCacheDir().
bool fAsynchronousOpen
Whether the file should be opened asynchronously, if available.