21 namespace Experimental {
31 Error(
"OutputFile",
"cannot open the MERGER output file %s", name);
36 Init(std::move(output));
41 fFile = output.release();
49 if (!f.expired())
Fatal(
"TBufferMerger",
" TBufferMergerFiles must be destroyed before the server");
59 gROOT->GetListOfFiles()->Remove(f.get());
96 std::vector<std::unique_ptr<TMemFile>> memfiles;
97 std::unique_ptr<TBufferFile> buffer;
111 buffer.reset(
fQueue.front());
128 merger.
AddFile(memfiles.back().get(),
false);
void SetBufferOffset(Int_t offset=0)
The concrete implementation of TBuffer for writing/reading to/from a ROOT file or socket...
std::vector< std::weak_ptr< TBufferMergerFile > > fAttachedFiles
Namespace for new ROOT classes and functions.
void Fatal(const char *location, const char *msgfmt,...)
R__EXTERN TVirtualMutex * gROOTMutex
size_t GetAutoSave() const
Returns the current value of the auto save setting in bytes (default = 0).
void Push(TBufferFile *buffer)
A TMemFile is like a normal TFile except that it reads and writes only from memory.
void Init(std::unique_ptr< TFile >)
std::queue< TBufferFile * > fQueue
virtual void ReadLong64(Long64_t &l)
void SetAutoSave(size_t size)
By default, TBufferMerger will call TFileMerger::PartialMerge() for each buffer pushed onto its merge...
void function(const Char_t *name_, T fun, const Char_t *docstring=0)
virtual Bool_t OutputFile(const char *url, Bool_t force)
Open merger output file.
virtual Bool_t AddFile(TFile *source, Bool_t own, Bool_t cpProgress)
Add the TFile to this file merger and give ownership of the TFile to this object (unless kFALSE is re...
size_t GetQueueSize() const
Returns the number of buffers currently in the queue.
void RegisterCallback(const std::function< void(void)> &f)
Register a user callback function to be called after a buffer has been removed from the merging queue...
virtual ~TBufferMerger()
Destructor.
std::condition_variable fDataAvailable
static TFilePtr Open(std::string_view name, const Options_t &opts=Options_t())
Open a file with name for reading.
This class provides file copy and merging services.
void SetReadMode()
Set buffer in read mode.
std::unique_ptr< std::thread > fMergingThread
#define R__LOCKGUARD(mutex)
TBufferMerger()
TBufferMerger has no default constructor.
friend class TBufferMergerFile
std::function< void(void)> fCallback
std::shared_ptr< TBufferMergerFile > GetFile()
Returns a TBufferMergerFile to which data can be written.
virtual Bool_t PartialMerge(Int_t type=kAll|kIncremental)
Merge the files.
virtual void Reset()
Reset merger file list.
void Error(ErrorHandler_t func, int code, const char *va_(fmt),...)
Write error message and call a handler, if required.