Belle II Software development
RootFileCreationManager Class Reference

This single instance class takes track of all open ROOT files open in "create" mode, usually meant for all the ntuple output modules. More...

#include <RootFileCreationManager.h>

Public Member Functions

std::shared_ptr< TFile > getFile (std::string, bool ignoreErrors=false)
 Get a file with a specific name, if is does not exist it will be created.
 

Static Public Member Functions

static RootFileCreationManagergetInstance ()
 Interface for the FileManager.
 

Private Member Functions

 RootFileCreationManager ()
 Constructor is private.
 
 RootFileCreationManager (RootFileCreationManager const &)=delete
 We so not want copy construction.
 
void operator= (RootFileCreationManager const &)=delete
 We do not need this interface.
 

Private Attributes

std::map< std::string, std::weak_ptr< TFile > > m_files
 store for the open files
 

Detailed Description

This single instance class takes track of all open ROOT files open in "create" mode, usually meant for all the ntuple output modules.

Multiple different users can use the same file if they provide the same filename. Currently there is no path name manipulation so "test.root" and "./test.root" are not the same filename. Please keep the shared_ptr returned by this class as long as you need the file to stay open. Temporary objects might not work.

The files are created and managed by this class. They get destroyed when the last user is freeing its copy. Users of this module should free their files in the terminate() function by just calling reset() on the shared_ptr.

Definition at line 35 of file RootFileCreationManager.h.

Constructor & Destructor Documentation

◆ RootFileCreationManager()

RootFileCreationManager ( )
inlineprivate

Constructor is private.

Definition at line 55 of file RootFileCreationManager.h.

55{}

Member Data Documentation

◆ m_files

std::map<std::string, std::weak_ptr<TFile> > m_files
private

store for the open files

Definition at line 61 of file RootFileCreationManager.h.


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