Logo ROOT   6.14/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 
12 #include "ROOT/TBufferMerger.hxx"
13 
14 #include "TBufferFile.h"
15 
16 namespace ROOT {
17 namespace Experimental {
18 
20  : TMemFile(m.fMerger.GetOutputFile()->GetName(), "RECREATE", "",
21  m.fMerger.GetOutputFile()->GetCompressionSettings()),
22  fMerger(m)
23 {
24 }
25 
27 {
28 }
29 
30 Int_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);
39  ResetAfterMerge(0);
40  }
41  return nbytes;
42 }
43 
44 } // namespace Experimental
45 } // namespace ROOT
void ResetAfterMerge(TFileMergeInfo *)
Wipe all the data from the permanent buffer but keep, the in-memory object alive. ...
Definition: TMemFile.cxx:298
std::string GetName(const std::string &scope_name)
Definition: Cppyy.cxx:145
The concrete implementation of TBuffer for writing/reading to/from a ROOT file or socket...
Definition: TBufferFile.h:46
auto * m
Definition: textangle.C:8
Namespace for new ROOT classes and functions.
Definition: StringConv.hxx:21
int Int_t
Definition: RtypesCore.h:41
void Push(TBufferFile *buffer)
A TMemFile is like a normal TFile except that it reads and writes only from memory.
Definition: TMemFile.h:19
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.
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:2336
void SetReadMode()
Set buffer in read mode.
Definition: TBuffer.cxx:281
TBufferMerger is a class to facilitate writing data in parallel from multiple threads, while writing to a single output file.
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:233
char name[80]
Definition: TGX11.cxx:109