The Gaudi Framework  master (ff829712)
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
14#include <algorithm>
15
16namespace Gaudi::TestSuite {
17
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
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition MsgStream.h:198
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
Algorithm(std::string name, ISvcLocator *svcloc, std::string version=PACKAGE_VERSION)
Constructor.
Definition Algorithm.h:98
StatusCode initialize() override
the default (empty) implementation of IStateful::initialize() method
Definition Algorithm.h:175
const std::string & name() const override
The identifying name of the algorithm object.
Implementation of property with value of concrete type.
Definition PropertyFwd.h:27
const std::vector< Gaudi::Details::PropertyBase * > & getProperties() const override
This class is used for returning status codes from appropriate routines.
Definition StatusCode.h:64
StatusCode andThen(F &&f, ARGS &&... args) const
Chain code blocks making the execution conditional a success result.
Definition StatusCode.h:163
@ DEBUG
Definition IMessageSvc.h:22
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition System.cpp:260
Simple algorithm useful as base class for tests.
Definition TestAlg.h:19
Algorithm(std::string name, ISvcLocator *svcloc, std::string version=PACKAGE_VERSION)
Constructor.
Definition Algorithm.h:98
Gaudi::Property< bool > m_propsPrint
Definition TestAlg.h:34
StatusCode initialize() override
Definition TestAlg.h:21