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;
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
This class provides an interface to the file (metadata) catalog.
Definition: FileCatalog.h:24
static FileCatalog & Instance()
Static method to get a reference to the FileCatalog instance.
Definition: FileCatalog.cc:23
virtual bool registerFile(const std::string &fileName, FileMetaData &metaData, const std::string &oldLFN="")
Register a file in the (local) file catalog.
Definition: FileCatalog.cc:90
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.
Definition: FileCatalog.cc:142
virtual std::string getPhysicalFileName(const std::string &lfn)
Get the physical file name for the LFN.
Definition: FileCatalog.cc:180
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.
Definition: FileCatalog.cc:77
FileCatalog()
Constructor: locate local database file.
Definition: FileCatalog.cc:30
bool readCatalog(FileMap &fileMap)
Read the file catalog from the local file.
Definition: FileCatalog.cc:54
Metadata information about a file.
Definition: FileMetaData.h:29
Abstract base class for different kinds of events.