Belle II Software development
FileCatalog.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 <map>
12#include <string>
13
14namespace Belle2 {
19 class FileMetaData;
20
25
26 public:
27
33 static FileCatalog& Instance();
34
45 virtual bool registerFile(const std::string& fileName, FileMetaData& metaData, const std::string& oldLFN = "");
46
54 virtual bool getMetaData(std::string& fileName, FileMetaData& metaData);
55
62 virtual std::string getPhysicalFileName(const std::string& lfn);
63
64 private:
65
70
71 typedef std::map<std::string, std::pair<std::string, FileMetaData>> FileMap;
72
79 bool readCatalog(FileMap& fileMap);
80
87 bool writeCatalog(const FileMap& fileMap);
88
89 std::string m_fileName;
90 };
91
93} //end of namespace Belle2
static FileCatalog & Instance()
Static method to get a reference to the FileCatalog instance.
virtual bool registerFile(const std::string &fileName, FileMetaData &metaData, const std::string &oldLFN="")
Register a file in the (local) file catalog.
std::map< std::string, std::pair< std::string, FileMetaData > > FileMap
Map with file catalog content.
Definition FileCatalog.h:71
virtual bool getMetaData(std::string &fileName, FileMetaData &metaData)
Get the metadata of a file with given (logical) file name.
virtual std::string getPhysicalFileName(const std::string &lfn)
Get the physical file name for the LFN.
std::string m_fileName
Name of the file catalog file.
Definition FileCatalog.h:89
bool writeCatalog(const FileMap &fileMap)
Write the file catalog to the local file.
FileCatalog()
Constructor: locate local database file.
bool readCatalog(FileMap &fileMap)
Read the file catalog from the local file.
Metadata information about a file.
Abstract base class for different kinds of events.