ATLAS Offline Software
Loading...
Searching...
No Matches
SubgroupSvc.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4#include "SubgroupSvc.h"
5#include "H5Cpp.h"
6
7SubgroupSvc::SubgroupSvc(const std::string& name,
8 ISvcLocator* pSvcLocator):
9 base_class(name, pSvcLocator)
10{
11}
12
14
16 if (m_subgroup.value().empty()) {
17 ATH_MSG_ERROR("subgroup name is empty");
18 return StatusCode::FAILURE;
19 }
20 ATH_CHECK(m_parent.retrieve());
21 H5::Group* parent = m_parent->group();
22 if (parent->nameExists(m_subgroup)) {
23 if (m_mustBeNew) {
24 ATH_MSG_ERROR("subgroup '" << m_subgroup.value()
25 << "' already exists");
26 return StatusCode::FAILURE;
27 }
28 m_group = std::make_unique<H5::Group>(
29 parent->openGroup(m_subgroup));
30 } else {
31 m_group = std::make_unique<H5::Group>(
32 parent->createGroup(m_subgroup));
33 }
34 return StatusCode::SUCCESS;
35}
36
37H5::Group* SubgroupSvc::group() {
38 return m_group.get();
39}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
SubgroupSvc(const std::string &name, ISvcLocator *pSvcLocator)
Gaudi::Property< bool > m_mustBeNew
Definition SubgroupSvc.h:31
Gaudi::Property< std::string > m_subgroup
Definition SubgroupSvc.h:29
virtual StatusCode initialize() override
ServiceHandle< IH5GroupSvc > m_parent
Definition SubgroupSvc.h:27
virtual H5::Group * group() override
std::unique_ptr< H5::Group > m_group
Definition SubgroupSvc.h:33