The Gaudi Framework  master (37c0b60a)
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 {
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;
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
MSG::DEBUG
@ DEBUG
Definition: IMessageSvc.h:25
Gaudi.Configuration.log
log
Definition: Configuration.py:28
StatusCode::andThen
StatusCode andThen(F &&f, ARGS &&... args) const
Chain code blocks making the execution conditional a success result.
Definition: StatusCode.h:163
Gaudi::Algorithm::name
const std::string & name() const override
The identifying name of the algorithm object.
Definition: Algorithm.cpp:526
Gaudi::Algorithm::initialize
StatusCode initialize() override
the default (empty) implementation of IStateful::initialize() method
Definition: Algorithm.h:178
Gaudi::TestSuite::TestAlg
Simple algorithm useful as base class for tests.
Definition: TestAlg.h:19
Algorithm.h
Gaudi::TestSuite::TestAlg::initialize
StatusCode initialize() override
Definition: TestAlg.h:21
Gaudi::TestSuite::TestAlg::m_propsPrint
Gaudi::Property< bool > m_propsPrint
Definition: TestAlg.h:34
System::typeinfoName
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:315
std::sort
T sort(T... args)
CommonMessaging< implements< IAlgorithm, IDataHandleHolder, IProperty, IStateful > >::msgLevel
MSG::Level msgLevel() const
get the cached level (originally extracted from the embedded MsgStream)
Definition: CommonMessaging.h:148
PropertyHolder< CommonMessaging< implements< IAlgorithm, IDataHandleHolder, IProperty, IStateful > > >::property
Gaudi::Details::PropertyBase * property(std::string_view name) const
\fixme property and bindPropertiesTo should be protected
Definition: PropertyHolder.h:238
PropertyHolder< CommonMessaging< implements< IAlgorithm, IDataHandleHolder, IProperty, IStateful > > >::getProperties
const std::vector< Gaudi::Details::PropertyBase * > & getProperties() const override
get all properties
Definition: PropertyHolder.h:222
Gaudi::Utils::begin
AttribStringParser::Iterator begin(const AttribStringParser &parser)
Definition: AttribStringParser.h:136
StatusCode
Definition: StatusCode.h:65
Gaudi::Algorithm
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:90
Gaudi::TestSuite
Definition: ConditionAccessorHolder.h:21
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:202
gaudiComponentHelp.properties
properties
Definition: gaudiComponentHelp.py:68
IOTest.end
end
Definition: IOTest.py:125
Gaudi::Algorithm::Algorithm
Algorithm(std::string name, ISvcLocator *svcloc, std::string version=PACKAGE_VERSION)
Constructor.
Definition: Algorithm.h:101
Gaudi::Property< bool >