The Gaudi Framework  v41r0 (bdbe7744)
Loading...
Searching...
No Matches
Algorithm.h
Go to the documentation of this file.
1/***********************************************************************************\
2* (c) Copyright 1998-2019 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#include <Gaudi/Algorithm.h>
14
15namespace Gaudi {
16 namespace details {
17#pragma GCC diagnostic push
18#pragma GCC diagnostic ignored "-Woverloaded-virtual"
20 public:
21 LegacyAlgorithmAdapter( std::string name, ISvcLocator* svcloc, std::string version = PACKAGE_VERSION )
22 : Gaudi::Algorithm( std::move( name ), svcloc, std::move( version ) ) {
23 // default cardinality for non-reentrant algorithms
24 setProperty( "Cardinality", 1 ).ignore();
25 }
26
27 virtual StatusCode execute() = 0;
28
30
32 bool isExecuted() const;
33
35 void setExecuted( bool state ) const;
36
38 bool filterPassed() const;
39
41 void setFilterPassed( bool state ) const;
42
43 protected:
44 bool isReEntrant() const override { return false; }
45
46 private:
47 StatusCode execute( const EventContext& ) const override final {
48 return const_cast<LegacyAlgorithmAdapter*>( this )->execute();
49 }
50 };
51#pragma GCC diagnostic pop
52 } // namespace details
53} // namespace Gaudi
54
55#pragma GCC diagnostic push
56#pragma GCC diagnostic ignored "-Woverloaded-virtual"
59public:
61 // this is to explicitly hide the other signature of `execute`
62 StatusCode execute() override = 0;
63};
64#pragma GCC diagnostic pop
#define PACKAGE_VERSION
Definition Algorithm.h:55
Alias for backward compatibility.
Definition Algorithm.h:58
StatusCode execute() override=0
This class represents an entry point to all the event specific data.
Base class from which all concrete algorithm classes should be derived.
Definition Algorithm.h:87
Algorithm(std::string name, ISvcLocator *svcloc, std::string version=PACKAGE_VERSION)
Constructor.
Definition Algorithm.h:98
const std::string & version() const override
const std::string & name() const override
The identifying name of the algorithm object.
StatusCode execute(const EventContext &) const override final
Definition Algorithm.h:47
bool isExecuted() const
Has this algorithm been executed since the last reset?
void setExecuted(bool state) const
Set the executed flag to the specified state.
LegacyAlgorithmAdapter(std::string name, ISvcLocator *svcloc, std::string version=PACKAGE_VERSION)
Definition Algorithm.h:21
bool isReEntrant() const override
Definition Algorithm.h:44
bool filterPassed() const
Did this algorithm pass or fail its filter criterion for the last event?
void setFilterPassed(bool state) const
Set the filter passed flag to the specified state.
const EventContext & getContext() const
Definition Algorithm.h:29
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition ISvcLocator.h:42
This class is used for returning status codes from appropriate routines.
Definition StatusCode.h:64
void ignore() const
Allow discarding a StatusCode without warning.
Definition StatusCode.h:128
GAUDI_API const EventContext & currentContext()
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
Definition __init__.py:1
STL namespace.