Belle II Software
light-2406-ragdoll
MetadataService.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 <string>
12
#include <nlohmann/json.hpp>
13
14
15
namespace
Belle2
{
21
class
FileMetaData;
22
27
class
MetadataService
{
28
29
public
:
30
36
static
MetadataService
&
Instance
();
37
43
void
setJsonFileName
(
const
std::string& fileName) {
m_fileName
= fileName;
writeJson
();};
44
48
void
addRootOutputFile
(
const
std::string& fileName,
const
FileMetaData
* metaData =
nullptr
);
49
53
void
addRootNtupleFile
(
const
std::string& fileName);
54
58
void
addHDF5File
(
const
std::string& fileName);
59
63
void
addBasf2Status
(
const
std::string& message =
""
);
64
68
void
addModuleCallsCount
();
69
73
void
finishBasf2
(
bool
success =
true
);
74
75
private
:
76
77
std::string
m_fileName
;
78
nlohmann::json
m_json
;
79
double
m_basf2StartTime
;
84
MetadataService
();
85
89
MetadataService
(
const
MetadataService
&) =
delete
;
90
94
MetadataService
&
operator=
(
const
MetadataService
&) =
delete
;
95
99
void
writeJson
();
100
101
};
102
104
}
//end of namespace Belle2
Belle2::FileMetaData
Metadata information about a file.
Definition:
FileMetaData.h:29
Belle2::MetadataService
This class provides a service for writing metadata about the basf2 execution and about output files t...
Definition:
MetadataService.h:27
Belle2::MetadataService::writeJson
void writeJson()
Serialize the current json content to the json file.
Definition:
MetadataService.cc:140
Belle2::MetadataService::MetadataService
MetadataService(const MetadataService &)=delete
Disable/Hide the copy constructor.
Belle2::MetadataService::m_basf2StartTime
double m_basf2StartTime
the start time of basf2
Definition:
MetadataService.h:79
Belle2::MetadataService::addModuleCallsCount
void addModuleCallsCount()
Add the metadata of number of calls of all modules.
Definition:
MetadataService.cc:113
Belle2::MetadataService::addBasf2Status
void addBasf2Status(const std::string &message="")
Add metadata of basf2 status.
Definition:
MetadataService.cc:89
Belle2::MetadataService::setJsonFileName
void setJsonFileName(const std::string &fileName)
Set the name of the json metadata file.
Definition:
MetadataService.h:43
Belle2::MetadataService::m_fileName
std::string m_fileName
The name of the json file.
Definition:
MetadataService.h:77
Belle2::MetadataService::MetadataService
MetadataService()
Constructor.
Definition:
MetadataService.cc:21
Belle2::MetadataService::addRootOutputFile
void addRootOutputFile(const std::string &fileName, const FileMetaData *metaData=nullptr)
Add the metadata of a root output file.
Definition:
MetadataService.cc:32
Belle2::MetadataService::m_json
nlohmann::json m_json
The json object.
Definition:
MetadataService.h:78
Belle2::MetadataService::operator=
MetadataService & operator=(const MetadataService &)=delete
Disable/Hide the copy assignment operator.
Belle2::MetadataService::addHDF5File
void addHDF5File(const std::string &fileName)
Add the metadata of a HDF5 file.
Definition:
MetadataService.cc:75
Belle2::MetadataService::Instance
static MetadataService & Instance()
Static method to get a reference to the MetadataService instance.
Definition:
MetadataService.cc:26
Belle2::MetadataService::finishBasf2
void finishBasf2(bool success=true)
Add metadata for basf2 completion.
Definition:
MetadataService.cc:132
Belle2::MetadataService::addRootNtupleFile
void addRootNtupleFile(const std::string &fileName)
Add the metadata of a root ntuple file.
Definition:
MetadataService.cc:57
Belle2
Abstract base class for different kinds of events.
Definition:
ClusterUtils.h:24
framework
core
include
MetadataService.h
Generated on Tue Jul 9 2024 23:28:09 for Belle II Software by
1.9.6