Logo ROOT   6.18/05
Reference Guide
TBufferMergerFile.cxx
Go to the documentation of this file.
1// @(#)root/io:$Id$
2// Author: Philippe Canal, Witold Pokorski, and Guilherme Amadio
3
4/*************************************************************************
5 * Copyright (C) 1995-2017, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
13
14#include "TBufferFile.h"
15
16namespace ROOT {
17namespace Experimental {
18
20 : TMemFile(m.fMerger.GetOutputFile()->GetName(), "RECREATE", "",
21 m.fMerger.GetOutputFile()->GetCompressionSettings()),
22 fMerger(m)
23{
24}
25
27{
28}
29
30Int_t TBufferMergerFile::Write(const char *name, Int_t opt, Int_t bufsize)
31{
32 Int_t nbytes = TMemFile::Write(name, opt, bufsize);
33
34 if (nbytes) {
36 CopyTo(*buffer);
37 buffer->SetReadMode();
38 fMerger.Push(buffer);
40 }
41 return nbytes;
42}
43
44} // namespace Experimental
45} // namespace ROOT
int Int_t
Definition: RtypesCore.h:41
char name[80]
Definition: TGX11.cxx:109
TBufferMergerFile()
TBufferMergerFile has no default constructor.
virtual Int_t Write(const char *name=nullptr, Int_t opt=0, Int_t bufsize=0) override
Write data into a TBufferFile and append it to TBufferMerger.
TBufferMerger is a class to facilitate writing data in parallel from multiple threads,...
void Push(TBufferFile *buffer)
The concrete implementation of TBuffer for writing/reading to/from a ROOT file or socket.
Definition: TBufferFile.h:46
@ kWrite
Definition: TBuffer.h:72
void SetReadMode()
Set buffer in read mode.
Definition: TBuffer.cxx:302
virtual Int_t Write(const char *name=0, Int_t opt=0, Int_t bufsiz=0)
Write memory objects to this file.
Definition: TFile.cxx:2337
A TMemFile is like a normal TFile except that it reads and writes only from memory.
Definition: TMemFile.h:19
virtual Long64_t GetSize() const
Return the current size of the memory file.
Definition: TMemFile.cxx:300
void ResetAfterMerge(TFileMergeInfo *)
Wipe all the data from the permanent buffer but keep, the in-memory object alive.
Definition: TMemFile.cxx:330
virtual Long64_t CopyTo(void *to, Long64_t maxsize) const
Copy the binary representation of the TMemFile into the memory area starting at 'to' and of length at...
Definition: TMemFile.cxx:265
std::string GetName(const std::string &scope_name)
Definition: Cppyy.cxx:146
Namespace for new ROOT classes and functions.
Definition: StringConv.hxx:21
auto * m
Definition: textangle.C:8