|
REST-for-Physics
v2.3
Rare Event Searches ToolKit for Physics
|
Move-only owner for ROOT files opened by REST.
UPDATE mode preserves all semantically required historical user schemas and embedded rules before the writable file is exposed. A failed open or preservation produces an invalid handle, queryable through operator bool() and Error().
Definition at line 71 of file TRestTools.h.
#include <TRestTools.h>
Public Member Functions | |
| bool | Close () noexcept |
| const std::string & | Error () const noexcept |
| TFile * | Get () const noexcept |
| Borrow the file without transferring ownership; do not delete or outlive the handle. More... | |
| operator bool () const noexcept | |
| TFile & | operator* () const noexcept |
| TFile * | operator-> () const noexcept |
| TRestRootFileHandle & | operator= (const TRestRootFileHandle &)=delete |
| TRestRootFileHandle & | operator= (TRestRootFileHandle &&other) noexcept |
| TRestRootFileHandle (const TRestRootFileHandle &)=delete | |
| TRestRootFileHandle (TRestRootFileHandle &&other) noexcept | |
Static Public Member Functions | |
| static TRestRootFileHandle | Open (const std::string &filename, TRestRootFileMode mode) |
| static bool | PrepareBorrowedUpdate (TFile &file, std::string *error=nullptr) |
Private Attributes | |
| std::string | fError |
| std::unique_ptr< TFile > | fFile |
Friends | |
| class | TRestTools |
|
noexcept |
Definition at line 645 of file TRestTools.cxx.
| TRestRootFileHandle::~TRestRootFileHandle | ( | ) |
Definition at line 656 of file TRestTools.cxx.
|
noexcept |
Release the file and report ROOT close/write errors. Check before claiming write success; destructor cleanup alone cannot report success to the caller.
Close and release the owned file, reporting ROOT's zombie/write-error flags. Writers must call and check this explicitly: the destructor also cleans up, but cannot report success to its caller. Borrowed pointers become invalid. This checks reported ROOT errors, not filesystem durability after power loss.
Definition at line 662 of file TRestTools.cxx.
|
inlinenoexcept |
Definition at line 93 of file TRestTools.h.
|
inlinenoexcept |
Borrow the file without transferring ownership; do not delete or outlive the handle.
Definition at line 90 of file TRestTools.h.
|
static |
Open with explicit ownership and checked writable-mode policy. Existing UPDATE files first open READ and pass PrepareBorrowedUpdate; missing ones use CREATE to avoid overwriting a file appearing during the existence check. RECREATE is intentionally destructive. Remote files are supported only in READ mode. Failure returns an invalid handle with Error(); callers must check it.
Definition at line 597 of file TRestTools.cxx.
|
inlineexplicitnoexcept |
Definition at line 88 of file TRestTools.h.
|
inlinenoexcept |
Definition at line 92 of file TRestTools.h.
|
inlinenoexcept |
Definition at line 91 of file TRestTools.h.
|
noexcept |
Definition at line 648 of file TRestTools.cxx.
|
static |
Validate an already-owned READ file, then transition it safely to UPDATE.
The file remains read-only when validation fails before ReOpen.
Gate an existing owner's READ file into UPDATE without taking ownership. Resolve and retain historical schemas/rules before requesting writable access; compare local path identity around ReOpen, then select schemas for later writes. A preflight refusal leaves the file read-only. If the transition was attempted before a failure, disable writable state; this is not rollback for arbitrary subsequent writes and does not serialize concurrent writers.
Definition at line 678 of file TRestTools.cxx.
|
friend |
Definition at line 73 of file TRestTools.h.
|
private |
Definition at line 76 of file TRestTools.h.
|
private |
Definition at line 75 of file TRestTools.h.