|
ROOT 6.10/09 Reference Guide |
A ROOT file.
A ROOT file is an object store: it can serialize any object for which ROOT I/O is available (generally: an object which has a dictionary), and it stores the object's data under a key name.
Classes | |
| struct | Options_t |
| Options for TFile construction. More... | |
Public Member Functions | |
| ~TFile () | |
| 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(). More... | |
| void | Close () |
| Flush() and make the file non-writable: close it. More... | |
| void | Flush () |
| Save all objects associated with this directory (including file header) to the storage medium. More... | |
| template<class T > | |
| std::unique_ptr< T > | Read (std::string_view name) |
| Read the object for a key. More... | |
| template<class T > | |
| void | Write (std::string_view name, const T &obj) |
| Write an object that is not lifetime managed by this TFileImplBase. More... | |
| template<class T > | |
| void | Write (std::string_view name, const T *obj) |
| Write an object that is not lifetime managed by this TFileImplBase. More... | |
| void | Write (std::string_view name) |
| Write an object that is already lifetime managed by this TFileImplBase. More... | |
| template<class T > | |
| void | Write (std::string_view name, std::shared_ptr< T > &&obj) |
| Hand over lifetime management of an object to this TFileImplBase, and write it. More... | |
Public Member Functions inherited from ROOT::Experimental::TDirectory | |
| template<class T > | |
| void | Add (const std::string &name, const std::shared_ptr< T > &ptr) |
Add an existing object (rather a shared_ptr to it) to the TDirectory. More... | |
| template<class T , class... ARGS> | |
| std::shared_ptr< ToContentType_t< T > > | Create (const std::string &name, ARGS &&... args) |
Create an object of type T (passing some arguments to its constructor). More... | |
| Internal::TDirectoryEntry | Find (const std::string &name) const |
| Find the TDirectoryEntry associated to the name. More... | |
| template<class T > | |
| std::pair< Internal::TDirectoryEntry, EFindStatus > | Find (const std::string &name) const |
| Find the TDirectoryEntry associated with the name. More... | |
| template<class T > | |
| std::shared_ptr< ToContentType_t< T > > | Get (const std::string &name) |
| Get the object for a key. More... | |
Static Public Member Functions | |
| static std::string | GetCacheDir () |
| Get the directory used for cached reads. More... | |
| static std::string | SetCacheDir (std::string_view path) |
| Set the new directory used for cached reads, returns the old directory. More... | |
Generator functions | |
| static TFilePtr | Open (std::string_view name, const Options_t &opts=Options_t()) |
Open a file with name for reading. More... | |
| static TFilePtr | OpenForUpdate (std::string_view name, const Options_t &opts=Options_t()) |
Open an existing file with name for reading and writing. More... | |
| static TFilePtr | Create (std::string_view name, const Options_t &opts=Options_t()) |
Open a file with name for reading and writing. More... | |
| static TFilePtr | Recreate (std::string_view name, const Options_t &opts=Options_t()) |
Open a file with name for reading and writing. More... | |
Static Public Member Functions inherited from ROOT::Experimental::TDirectory | |
| static TDirectory & | Heap () |
| Dedicated, process-wide TDirectory. More... | |
Private Member Functions | |
| TFile (std::unique_ptr< Internal::TFileStorageInterface > &&storage) | |
| void | WriteMemoryWithType (std::string_view name, const void *address, TClass *cl) |
| Serialize the object at address, using the object's TClass. More... | |
Private Attributes | |
| std::unique_ptr< Internal::TFileStorageInterface > | fStorage |
| Storage backend. More... | |
Additional Inherited Members | |
Public Types inherited from ROOT::Experimental::TDirectory | |
| enum | EFindStatus { EFindStatus::kValidValue, EFindStatus::kValidValueBase, EFindStatus::kKeyNameNotFound, EFindStatus::kTypeMismatch } |
| Status of the call to Find<T>(name). More... | |
#include <ROOT/TFile.hxx>
|
private |
|
default |
| void TFile::Close | ( | ) |
|
static |
| void TFile::Flush | ( | ) |
|
static |
|
static |
|
static |
|
inline |
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.
unique_ptr to the object. | TDirectoryUnknownKey | if no object is stored under this name. |
| TDirectoryTypeMismatch | if the object stored under this name is of a type different from T. |
|
static |
|
static |
|
inline |
|
inline |
|
inline |
|
inline |
|
private |