ATLAS Offline Software
PhysicsAnalysis
AnalysisCommon
HDF5Utils
src
H5FileSvc.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3
*/
4
#include "
H5FileSvc.h
"
5
#include "H5Cpp.h"
6
7
H5FileSvc::H5FileSvc
(
const
std::string&
name
, ISvcLocator* pSvcLocator):
8
AthService
(
name
, pSvcLocator)
9
{
10
}
11
12
H5FileSvc::~H5FileSvc
() =
default
;
13
14
StatusCode
H5FileSvc::initialize
() {
15
if
(
m_file_path
.empty()) {
16
return
StatusCode::FAILURE;
17
}
18
m_file
= std::make_unique<H5::H5File>(
m_file_path
, H5F_ACC_TRUNC);
19
return
StatusCode::SUCCESS;
20
}
21
22
H5::Group
*
H5FileSvc::group
() {
23
return
m_file
.get();
24
}
25
26
// interface magic, sort of copied from
27
// Control/AthenaBaseComps/src/AthCnvSvc.cxx
28
// There's another example under PerfMonComps
29
// https://gitlab.cern.ch/atlas/athena/-/tree/main/Control/PerformanceMonitoring/PerfMonComps
30
//
31
StatusCode
H5FileSvc::queryInterface
(
const
InterfaceID& riid,
32
void
** ppvInterface)
33
{
34
if
(
IH5GroupSvc::interfaceID
().versionMatch(riid) ) {
35
// This thing seems to get called when we run the code.
36
//
37
*ppvInterface =
dynamic_cast<
IH5GroupSvc
*
>
(
this
);
38
}
else
{
39
// And this thing gets called when the code is being compiled
40
return
AthService::queryInterface(riid, ppvInterface);
41
}
42
addRef();
43
return
StatusCode::SUCCESS;
44
}
H5FileSvc::m_file_path
Gaudi::Property< std::string > m_file_path
Definition:
H5FileSvc.h:30
IH5GroupSvc
Definition:
IH5GroupSvc.h:23
TrigDefs::Group
Group
Properties of a chain group.
Definition:
GroupProperties.h:13
H5FileSvc::m_file
std::unique_ptr< H5::H5File > m_file
Definition:
H5FileSvc.h:29
IH5GroupSvc::interfaceID
static const InterfaceID & interfaceID()
Definition:
IH5GroupSvc.h:30
H5FileSvc::H5FileSvc
H5FileSvc(const std::string &name, ISvcLocator *pSvcLocator)
Definition:
H5FileSvc.cxx:7
H5FileSvc.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition:
PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
AthService
Definition:
AthService.h:32
H5FileSvc::~H5FileSvc
~H5FileSvc()
H5FileSvc::group
H5::Group * group() override
Definition:
H5FileSvc.cxx:22
name
std::string name
Definition:
Control/AthContainers/Root/debug.cxx:195
H5FileSvc::queryInterface
StatusCode queryInterface(const InterfaceID &riid, void **ppvInterface) override
Definition:
H5FileSvc.cxx:31
H5FileSvc::initialize
StatusCode initialize() override
Definition:
H5FileSvc.cxx:14
Generated on Tue Jul 2 2024 21:16:28 for ATLAS Offline Software by
1.8.18