The Gaudi Framework  master (d98a2936)
ITimelineSvc.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2025 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/IService.h>
14 
15 #include <string>
16 
17 class EventContext;
18 struct TimelineEvent;
19 
20 class GAUDI_API ITimelineSvc : virtual public IService {
21 
22 public:
25 
27  class TimelineRecorder final {
28  public:
29  TimelineRecorder() = default;
30  TimelineRecorder( TimelineEvent& record, std::string alg, const EventContext& ctx );
31 
32  TimelineRecorder( const TimelineRecorder& ) = delete;
34  TimelineRecorder( TimelineRecorder&& other ) : m_record{ std::exchange( other.m_record, nullptr ) } {}
35 
37  m_record = std::exchange( other.m_record, nullptr );
38  return *this;
39  }
40 
42 
43  private:
44  TimelineEvent* m_record = nullptr;
45  };
46 
47  virtual TimelineRecorder getRecorder( std::string alg, const EventContext& ctx ) = 0;
48  // Augment a partially pre-filled TimelineEvent object with matching info
49  virtual bool getTimelineEvent( TimelineEvent& ) const = 0;
50  virtual bool isEnabled() const = 0;
51 };
IService
Definition: IService.h:26
ITimelineSvc::getTimelineEvent
virtual bool getTimelineEvent(TimelineEvent &) const =0
ITimelineSvc::TimelineRecorder::TimelineRecorder
TimelineRecorder(TimelineRecorder &&other)
Definition: ITimelineSvc.h:34
IService.h
ITimelineSvc::isEnabled
virtual bool isEnabled() const =0
ManySmallAlgs.alg
alg
Definition: ManySmallAlgs.py:81
TimelineEvent
Definition: TimelineEvent.h:16
GaudiPython.Pythonizations.ctx
ctx
Definition: Pythonizations.py:578
ITimelineSvc
Definition: ITimelineSvc.h:20
ITimelineSvc::DeclareInterfaceID
DeclareInterfaceID(ITimelineSvc, 2, 0)
InterfaceID.
ITimelineSvc::TimelineRecorder
RAII helper to record timeline events.
Definition: ITimelineSvc.h:27
ITimelineSvc::getRecorder
virtual TimelineRecorder getRecorder(std::string alg, const EventContext &ctx)=0
ITimelineSvc::TimelineRecorder::TimelineRecorder
TimelineRecorder(const TimelineRecorder &)=delete
ITimelineSvc::TimelineRecorder::TimelineRecorder
TimelineRecorder()=default
ITimelineSvc::TimelineRecorder::operator=
TimelineRecorder & operator=(TimelineRecorder &&other)
Definition: ITimelineSvc.h:36
EventContext
Definition: EventContext.h:34
ITimelineSvc::TimelineRecorder::operator=
TimelineRecorder & operator=(const TimelineRecorder &)=delete
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:49