/// Must not call Write() of all attached objects:
/// some might not be needed to be written or writing might be aborted due to
/// an exception; require explicit Write().
~TFile();
/// Save all objects associated with this directory (including file header) to
/// the storage medium.
voidFlush();
/// Flush() and make the file non-writable: close it.
voidClose();
/// Read the object for a key. `T` must be the object's type.
/// This will re-read the object for each call, returning a new copy; whether
/// the `TDirectory` is managing an object attached to this key or not.
/// \returns a `unique_ptr` to the object.
/// \throws TDirectoryUnknownKey if no object is stored under this name.
/// \throws TDirectoryTypeMismatch if the object stored under this name is of
/// a type different from `T`.
template<classT>
std::unique_ptr<T>Read(std::string_viewname){
// FIXME: need separate collections for a TDirectory's key/value and registered objects. Here, we want to emit a read and must look through the key/values without attaching an object to the TDirectory.
/// Options for TFile construction.
structOptions_t{
/// Default constructor needed for member inits.
Options_t(){}
/// Whether the file should be opened asynchronously, if available.
boolfAsynchronousOpen=false;
/// Timeout for asynchronous opening.
intfAsyncTimeout=0;
/// Whether the file should be cached before reading. Only available for
/// "remote" file protocols. If the download fails, the file will be opened
/// remotely.
boolfCachedRead=false;
/// Where to cache the file. If empty, defaults to TFilePtr::GetCacheDir().
std::stringfCacheDir;
};
///\name Generator functions
///\{
/// Open a file with `name` for reading.
///
/// \note: Synchronizes multi-threaded accesses through locks.