Belle II Software  release-08-01-10
RootFileCreationManager.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 
9 #pragma once
10 
11 #include <TFile.h>
12 #include <string>
13 #include <map>
14 #include <memory>
15 
16 namespace Belle2 {
36 
37  public:
38 
51  std::shared_ptr<TFile> getFile(std::string, bool ignoreErrors = false);
52 
53  private:
59  void operator=(RootFileCreationManager const&) = delete;
61  std::map<std::string, std::weak_ptr<TFile>> m_files;
62  };
64 }
This single instance class takes track of all open ROOT files open in "create" mode,...
RootFileCreationManager()
Constructor is private.
void operator=(RootFileCreationManager const &)=delete
We do not need this interface.
std::map< std::string, std::weak_ptr< TFile > > m_files
store for the open files
RootFileCreationManager(RootFileCreationManager const &)=delete
We so not want copy construction.
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 RootFileCreationManager & getInstance()
Interface for the FileManager.
Abstract base class for different kinds of events.