The Gaudi Framework
master (37c0b60a)
MetaDataSvc.cpp
Go to the documentation of this file.
1
/***********************************************************************************\
2
* (c) Copyright 1998-2024 CERN for the benefit of the LHCb and ATLAS collaborations *
3
* *
4
* This software is distributed under the terms of the Apache version 2 licence, *
5
* copied verbatim in the file "LICENSE". *
6
* *
7
* In applying this licence, CERN does not waive the privileges and immunities *
8
* granted to it by virtue of its status as an Intergovernmental Organization *
9
* or submit itself to any jurisdiction. *
10
\***********************************************************************************/
11
/*
12
* MetaDataSvc.cpp
13
*
14
* Created on: Mar 24, 2015
15
* Author: Ana Trisovic
16
*/
17
18
// Framework include files
19
#include <
Gaudi/Interfaces/IOptionsSvc.h
>
20
#include <
GaudiKernel/IAlgManager.h
>
21
#include <
GaudiKernel/IAlgorithm.h
>
22
#include <
GaudiKernel/IProperty.h
>
23
#include <
GaudiKernel/IService.h
>
24
#include <
GaudiKernel/ISvcLocator.h
>
25
#include <
GaudiKernel/IToolSvc.h
>
26
27
#include "
MetaDataSvc.h
"
28
29
using
Gaudi::MetaDataSvc
;
30
31
DECLARE_COMPONENT
(
MetaDataSvc
)
32
33
StatusCode
MetaDataSvc
::
start
() {
34
if
( msgLevel(
MSG::DEBUG
) ) debug() <<
"started"
<<
endmsg
;
35
return
collectData();
36
}
37
38
std::map<std::string, std::string>
MetaDataSvc::getMetaDataMap()
const
{
return
m_metadata
; }
39
40
StatusCode
MetaDataSvc::collectData
() {
41
42
// save options for all clients
43
for
(
const
auto
& p :
serviceLocator
()->getOptsSvc().items() ) {
m_metadata
[std::get<0>( p )] = std::get<1>( p ); }
44
45
if
(
msgLevel
(
MSG::DEBUG
) ) {
46
debug() <<
"Metadata collected:\n"
;
47
for
(
const
auto
& item :
m_metadata
) { debug() << item.first <<
':'
<< item.second <<
'\n'
; }
48
debug() <<
endmsg
;
49
}
50
51
return
StatusCode::SUCCESS
;
52
}
MSG::DEBUG
@ DEBUG
Definition:
IMessageSvc.h:25
IAlgManager.h
IService.h
Gaudi::MetaDataSvc::collectData
StatusCode collectData()
Definition:
MetaDataSvc.cpp:40
Gaudi::MetaDataSvc::m_metadata
std::map< std::string, std::string > m_metadata
Definition:
MetaDataSvc.h:40
IOTest.start
start
Definition:
IOTest.py:110
CommonMessaging< implements< IService, IProperty, IStateful > >::msgLevel
MSG::Level msgLevel() const
get the cached level (originally extracted from the embedded MsgStream)
Definition:
CommonMessaging.h:148
Gaudi::MetaDataSvc
Definition:
MetaDataSvc.h:25
IToolSvc.h
StatusCode
Definition:
StatusCode.h:65
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition:
MsgStream.h:202
std::map< std::string, std::string >
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition:
StatusCode.h:100
DECLARE_COMPONENT
#define DECLARE_COMPONENT(type)
Definition:
PluginServiceV1.h:46
IProperty.h
IAlgorithm.h
ISvcLocator.h
IOptionsSvc.h
MetaDataSvc.h
Service::serviceLocator
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator
Definition:
Service.cpp:335
GaudiSvc
src
MetaDataSvc
MetaDataSvc.cpp
Generated on Thu Dec 19 2024 15:35:05 for The Gaudi Framework by
1.8.18