The Gaudi Framework
master (57817a18)
Toggle main menu visibility
Loading...
Searching...
No Matches
TestAlg.h
Go to the documentation of this file.
1
/***********************************************************************************\
2
* (c) Copyright 2023 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
#pragma once
12
13
#include <
GaudiKernel/Algorithm.h
>
14
#include <algorithm>
15
16
namespace
Gaudi::TestSuite
{
17
19
struct
TestAlg
:
::Algorithm
{
20
using
Algorithm::Algorithm
;
21
StatusCode
initialize
()
override
{
22
return
Algorithm::initialize
().
andThen
( [&]() {
23
if
(
m_propsPrint
&&
msgLevel
(
MSG::DEBUG
) ) {
24
auto
& log =
debug
();
25
auto
properties =
getProperties
();
26
log <<
"List of ALL properties of "
<<
System::typeinfoName
(
typeid
( *
this
) ) <<
"/"
<< this->
name
()
27
<<
" #properties = "
<< properties.size() <<
endmsg
;
28
std::sort( begin( properties ), end( properties ),
29
[](
const
auto
& a,
const
auto
& b ) {
return
a->name() < b->name(); } );
30
for
(
const
auto
&
property
: properties ) { log <<
"Property ['Name': Value] = "
<< *
property
<<
endmsg
; }
31
}
32
} );
33
}
34
Gaudi::Property<bool>
m_propsPrint
{
this
,
"PropertiesPrint"
,
false
,
35
"print the properties of the component at initialize"
};
36
};
37
}
// namespace Gaudi::TestSuite
Algorithm.h
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition
MsgStream.h:198
CommonMessagingBase::debug
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
Definition
CommonMessaging.h:118
CommonMessagingBase::msgLevel
MSG::Level msgLevel() const
get the cached level (originally extracted from the embedded MsgStream)
Definition
CommonMessaging.h:127
Gaudi::Algorithm::Algorithm
Algorithm(std::string name, ISvcLocator *svcloc, std::string version=PACKAGE_VERSION)
Constructor.
Definition
Algorithm.h:98
Gaudi::Algorithm::initialize
StatusCode initialize() override
the default (empty) implementation of IStateful::initialize() method
Definition
Algorithm.h:175
Gaudi::Algorithm::name
const std::string & name() const override
The identifying name of the algorithm object.
Definition
Algorithm.cpp:518
Gaudi::Property
Implementation of property with value of concrete type.
Definition
Property.h:35
PropertyHolder< CommonMessaging< implements< IAlgorithm, IDataHandleHolder, IProperty, IStateful > > >::property
Gaudi::Details::PropertyBase * property(std::string_view name) const
Definition
PropertyHolder.h:224
PropertyHolder< CommonMessaging< implements< IAlgorithm, IDataHandleHolder, IProperty, IStateful > > >::getProperties
const std::vector< Gaudi::Details::PropertyBase * > & getProperties() const override
Definition
PropertyHolder.h:210
StatusCode
This class is used for returning status codes from appropriate routines.
Definition
StatusCode.h:64
StatusCode::andThen
StatusCode andThen(F &&f, ARGS &&... args) const
Chain code blocks making the execution conditional a success result.
Definition
StatusCode.h:151
Gaudi::TestSuite
Definition
ConditionAccessorHolder.h:21
MSG::DEBUG
@ DEBUG
Definition
IMessageSvc.h:22
System::typeinfoName
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition
System.cpp:254
Gaudi::TestSuite::TestAlg
Simple algorithm useful as base class for tests.
Definition
TestAlg.h:19
Gaudi::TestSuite::TestAlg::Algorithm
Algorithm(std::string name, ISvcLocator *svcloc, std::string version=PACKAGE_VERSION)
Constructor.
Definition
Algorithm.h:98
Gaudi::TestSuite::TestAlg::m_propsPrint
Gaudi::Property< bool > m_propsPrint
Definition
TestAlg.h:34
Gaudi::TestSuite::TestAlg::initialize
StatusCode initialize() override
Definition
TestAlg.h:21
GaudiTestSuite
include
Gaudi
TestSuite
TestAlg.h
Generated on
for The Gaudi Framework by
1.17.0