Analysis-Utilities
26.9.9
C++/ROOT utilities for nuclear measurement data analysis
Toggle main menu visibility
Loading...
Searching...
No Matches
IOUtils.hpp
Go to the documentation of this file.
1
#ifndef IOUTILS_H
2
#define IOUTILS_H
3
4
#include <TFile.h>
5
#include <TString.h>
6
#include <TSystem.h>
7
18
namespace
IO
{
19
30
void
SetRootFilesBaseDir
(
const
TString &dir);
31
34
TString
GetRootFilesBaseDir
();
35
50
void
SetThreadSafe
(Bool_t enabled = kTRUE);
51
54
Bool_t
IsThreadSafe
();
55
71
TFile *
OpenForReading
(
const
TString &subpath);
72
98
TFile *
OpenForWriting
(
const
TString &subpath,
const
TString mode =
"RECREATE"
);
99
113
class
ScopedRootLock
{
114
public
:
116
ScopedRootLock
();
118
~ScopedRootLock
();
119
120
private
:
121
Bool_t engaged_;
122
ScopedRootLock
(
const
ScopedRootLock
&);
123
ScopedRootLock
&operator=(
const
ScopedRootLock
&);
124
};
125
}
// namespace IO
126
127
#endif
IO::ScopedRootLock::ScopedRootLock
ScopedRootLock()
Acquire the shared file-open lock if thread-safe mode is on.
Definition
IOUtils.cpp:48
IO::ScopedRootLock::~ScopedRootLock
~ScopedRootLock()
Release the lock if this guard acquired one.
Definition
IOUtils.cpp:53
IO
Path-aware ROOT file helpers with optional thread-safe opening.
Definition
IOUtils.hpp:18
IO::GetRootFilesBaseDir
TString GetRootFilesBaseDir()
Current base directory for relative subpaths, without trailing slash.
Definition
IOUtils.cpp:37
IO::SetRootFilesBaseDir
void SetRootFilesBaseDir(const TString &dir)
Set the base directory that relative subpaths resolve against.
Definition
IOUtils.cpp:30
IO::IsThreadSafe
Bool_t IsThreadSafe()
Whether thread-safe file opening is currently engaged.
Definition
IOUtils.cpp:46
IO::SetThreadSafe
void SetThreadSafe(Bool_t enabled=kTRUE)
Enable ROOT thread safety and serialise file opening.
Definition
IOUtils.cpp:39
IO::OpenForWriting
TFile * OpenForWriting(const TString &subpath, const TString mode="RECREATE")
Open a ROOT file for writing, creating parent directories first.
Definition
IOUtils.cpp:68
IO::OpenForReading
TFile * OpenForReading(const TString &subpath)
Open a ROOT file for reading, resolved against the base directory.
Definition
IOUtils.cpp:58
include
IOUtils.hpp
Generated by
1.17.0