Logo ROOT   6.10/09
Reference Guide
List of all members | Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
ROOT::Experimental::TBufferMerger Class Reference

TBufferMerger is a class to facilitate writing data in parallel from multiple threads, while writing to a single output file.

A TBufferMergerFile is similar to a TMemFile, but when data is written to it, it is appended to the TBufferMerger queue.

Its purpose is similar to TParallelMergingFile, but instead of using processes that connect to a network socket, TBufferMerger uses threads that each write to a TBufferMergerFile, which in turn push data into a queue managed by the TBufferMerger.

The TBufferMerger merges all data into the output file on disk.

Definition at line 44 of file TBufferMerger.hxx.

Public Member Functions

 TBufferMerger (const char *name, Option_t *option="RECREATE", Int_t compress=1)
 Constructor. More...
 
virtual ~TBufferMerger ()
 Destructor. More...
 
std::shared_ptr< TBufferMergerFileGetFile ()
 Returns a TBufferMergerFile to which data can be written. More...
 

Private Member Functions

 TBufferMerger ()
 TBufferMerger has no default constructor. More...
 
 TBufferMerger (const TBufferMerger &)
 TBufferMerger has no copy constructor. More...
 
TBufferMergeroperator= (const TBufferMerger &)
 TBufferMerger has no copy operator. More...
 
void Push (TBufferFile *buffer)
 
void WriteOutputFile ()
 

Private Attributes

std::vector< std::weak_ptr< TBufferMergerFile > > fAttachedFiles
 
const Int_t fCompress
 
std::condition_variable fDataAvailable
 
std::unique_ptr< std::thread > fMergingThread
 
const std::string fName
 
const std::string fOption
 
std::queue< TBufferFile * > fQueue
 
std::mutex fQueueMutex
 

Friends

class TBufferMergerFile
 

#include <ROOT/TBufferMerger.hxx>

Constructor & Destructor Documentation

◆ TBufferMerger() [1/3]

ROOT::Experimental::TBufferMerger::TBufferMerger ( const char *  name,
Option_t option = "RECREATE",
Int_t  compress = 1 
)

Constructor.

Parameters
nameOutput file name
optionOutput file creation options
ftitleOutput file title
compressionOutput file compression level

Definition at line 23 of file TBufferMerger.cxx.

◆ ~TBufferMerger()

ROOT::Experimental::TBufferMerger::~TBufferMerger ( )
virtual

Destructor.

Definition at line 29 of file TBufferMerger.cxx.

◆ TBufferMerger() [2/3]

ROOT::Experimental::TBufferMerger::TBufferMerger ( )
private

TBufferMerger has no default constructor.

◆ TBufferMerger() [3/3]

ROOT::Experimental::TBufferMerger::TBufferMerger ( const TBufferMerger )
private

TBufferMerger has no copy constructor.

Member Function Documentation

◆ GetFile()

std::shared_ptr< TBufferMergerFile > ROOT::Experimental::TBufferMerger::GetFile ( )

Returns a TBufferMergerFile to which data can be written.

At the end, all TBufferMergerFiles get merged into the output file. The user is responsible to "cd" into the file to associate objects such as histograms or trees to it.

After the creation of this file, the user must reset the kMustCleanup bit on any objects attached to it and take care of their deletion, as there is a possibility that a race condition will happen that causes a crash if ROOT manages these objects.

Definition at line 38 of file TBufferMerger.cxx.

◆ operator=()

TBufferMerger& ROOT::Experimental::TBufferMerger::operator= ( const TBufferMerger )
private

TBufferMerger has no copy operator.

◆ Push()

void ROOT::Experimental::TBufferMerger::Push ( TBufferFile buffer)
private

Definition at line 47 of file TBufferMerger.cxx.

◆ WriteOutputFile()

void ROOT::Experimental::TBufferMerger::WriteOutputFile ( )
private

Definition at line 56 of file TBufferMerger.cxx.

Friends And Related Function Documentation

◆ TBufferMergerFile

friend class TBufferMergerFile
friend

Definition at line 69 of file TBufferMerger.hxx.

Member Data Documentation

◆ fAttachedFiles

std::vector<std::weak_ptr<TBufferMergerFile> > ROOT::Experimental::TBufferMerger::fAttachedFiles
private

Definition at line 91 of file TBufferMerger.hxx.

◆ fCompress

const Int_t ROOT::Experimental::TBufferMerger::fCompress
private

Definition at line 86 of file TBufferMerger.hxx.

◆ fDataAvailable

std::condition_variable ROOT::Experimental::TBufferMerger::fDataAvailable
private

Definition at line 88 of file TBufferMerger.hxx.

◆ fMergingThread

std::unique_ptr<std::thread> ROOT::Experimental::TBufferMerger::fMergingThread
private

Definition at line 90 of file TBufferMerger.hxx.

◆ fName

const std::string ROOT::Experimental::TBufferMerger::fName
private

Definition at line 84 of file TBufferMerger.hxx.

◆ fOption

const std::string ROOT::Experimental::TBufferMerger::fOption
private

Definition at line 85 of file TBufferMerger.hxx.

◆ fQueue

std::queue<TBufferFile *> ROOT::Experimental::TBufferMerger::fQueue
private

Definition at line 89 of file TBufferMerger.hxx.

◆ fQueueMutex

std::mutex ROOT::Experimental::TBufferMerger::fQueueMutex
private

Definition at line 87 of file TBufferMerger.hxx.


The documentation for this class was generated from the following files: