The Gaudi Framework master (934d2c3c)
Loading...
Searching...
No Matches
EventSlot.h
Go to the documentation of this file.
1/***********************************************************************************\
2* (c) Copyright 1998-2026 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// Local includes
14#include "AlgsExecutionStates.h"
15
16// Framework includes
18
19// STL includes
20#include <memory>
21#include <string>
22#include <tuple>
23#include <unordered_map>
24#include <utility>
25#include <vector>
26
28struct EventSlot {
30 EventSlot( unsigned int numberOfAlgorithms, unsigned int numberOfControlFlowNodes, SmartIF<IMessageSvc> MS )
31 : algsStates( numberOfAlgorithms, MS ), controlFlowState( numberOfControlFlowNodes, -1 ) {}
32
34 EventSlot( const EventSlot& ) = delete;
36 EventSlot& operator=( const EventSlot& ) = delete;
38 EventSlot( EventSlot&& ) = default;
40 EventSlot& operator=( EventSlot&& ) = default;
41
43 EventSlot( EventSlot& original, std::unique_ptr<EventContext> theeventContext, const std::string& nodeName )
44 : eventContext( std::move( theeventContext ) )
45 , algsStates( original.algsStates )
47 , entryPoint( nodeName )
48 , parentSlot( &original ) {
50 }
51
53 void reset( EventContext* theeventContext ) {
54 eventContext.reset( theeventContext );
57 complete = false;
59 parentSlot = nullptr;
62 }
63
65 void addSubSlot( std::unique_ptr<EventContext> viewContext, const std::string& nodeName ) {
66 unsigned int lastIndex = allSubSlots.size();
67
68 const auto search = subSlotsByNode.find( nodeName );
69 if ( search != subSlotsByNode.end() )
70 search->second.push_back( lastIndex );
71 else
73 std::forward_as_tuple( 1, lastIndex ) );
74
75 // Make new slot and nest it into the top slot
76 viewContext->setSubSlot( lastIndex );
77 allSubSlots.emplace_back( *this, std::move( viewContext ), nodeName );
78 }
79
82 void disableSubSlots( const std::string& nodeName ) {
84 }
85
93 bool complete = false;
94
96
98 std::string entryPoint;
105};
constexpr tuple< _Elements &&... > forward_as_tuple(_Elements &&... __args) noexcept
constexpr std::remove_reference< _Tp >::type && move(_Tp &&__t) noexcept
constexpr piecewise_construct_t piecewise_construct
constexpr _OI move(_II __first, _II __last, _OI __result)
constexpr _ForwardIterator search(_ForwardIterator __first, _ForwardIterator __last, const _Searcher &__searcher)
void clear() noexcept
constexpr void assign(_InputIterator __first, _InputIterator __last)
constexpr void clear() noexcept
constexpr size_type size() const noexcept
constexpr void reset(pointer __p=pointer()) noexcept
iterator end() noexcept
std::pair< iterator, bool > emplace(_Args &&... __args)
void clear() noexcept
iterator find(const key_type &__x)
The AlgsExecutionStates encodes the state machine for the execution of algorithms within a single eve...
This class represents an entry point to all the event specific data.
Small smart pointer class with automatic reference counting for IInterface.
Definition SmartIF.h:28
STL namespace.
std::unique_ptr< EventContext > eventContext
Cache for the eventContext.
Definition EventSlot.h:87
std::vector< EventSlot > allSubSlots
Actual sub-slot instances.
Definition EventSlot.h:104
EventSlot(EventSlot &original, std::unique_ptr< EventContext > theeventContext, const std::string &nodeName)
Construct a (sub)slot, nested to 'original' parent slot, with CF states copied from the parent.
Definition EventSlot.h:43
EventSlot * parentSlot
Pointer to parent slot (null for top level).
Definition EventSlot.h:100
EventSlot(unsigned int numberOfAlgorithms, unsigned int numberOfControlFlowNodes, SmartIF< IMessageSvc > MS)
Construct a slot.
Definition EventSlot.h:30
bool complete
Flags completion of the event.
Definition EventSlot.h:93
std::string entryPoint
Event Views bookkeeping (TODO: optimize view bookkeeping).
Definition EventSlot.h:98
void addSubSlot(std::unique_ptr< EventContext > viewContext, const std::string &nodeName)
Add a subslot to the slot (this constructs a new slot and registers it with the parent one).
Definition EventSlot.h:65
EventSlot & operator=(EventSlot &&)=default
Move assignment.
std::unordered_map< std::string, std::vector< unsigned int > > subSlotsByNode
Listing of sub-slots by the node (name) they are attached to.
Definition EventSlot.h:102
void reset(EventContext *theeventContext)
Reset all resources in order to reuse the slot (thread-unsafe).
Definition EventSlot.h:53
AlgsExecutionStates algsStates
Vector of algorithms states.
Definition EventSlot.h:89
void disableSubSlots(const std::string &nodeName)
Disable event views for a given CF view node by registering an empty container Contact B.
Definition EventSlot.h:82
EventSlot(EventSlot &&)=default
Move constructor.
std::vector< int > controlFlowState
State of the control flow.
Definition EventSlot.h:91
EventSlot & operator=(const EventSlot &)=delete
Assignment operator.
EventSlot(const EventSlot &)=delete
Copy constructor.