2 * Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration.
6 * @file AthenaKernel/SlotSpecificObj.icc
7 * @author scott snyder <snyder@bnl.gov>
9 * @brief Maintain a set of objects, one per slot.
19 * The number of slots will be found by calling @c getNSlots().
21template <class T, InvalidSlot S>
23SlotSpecificObj<T, S>::SlotSpecificObj()
24 : SlotSpecificObj (getNSlots())
30 * @brief Constructor, with number of slots specified explicitly.
31 * @param nslots The number of event slots.
33template <class T, InvalidSlot S>
35SlotSpecificObj<T, S>::SlotSpecificObj (size_t nslots)
36 : m_slots (S==InvalidSlot::Disabled ? nslots : nslots+1)
42 * @brief Return pointer to the object for slot given by @c ctx.
43 * @param ctx Event context giving the desired slot.
45template <class T, InvalidSlot S>
47T* SlotSpecificObj<T, S>::get (const EventContext& ctx)
49 if constexpr (S==InvalidSlot::Disabled) {
50 return &m_slots.at(ctx.slot());
53 return ctx.valid() ? &m_slots.at(ctx.slot()) : &m_slots.back();
59 * @brief Return pointer to the object for the current slot.
61 * The slot number is found by retrieving the global current context.
63template <class T, InvalidSlot S>
65T* SlotSpecificObj<T, S>::get()
67 return get (Gaudi::Hive::currentContext());
72 * @brief Return pointer to the object for slot given by @c ctx.
73 * @param ctx Event context giving the desired slot.
75template <class T, InvalidSlot S>
77const T* SlotSpecificObj<T, S>::get (const EventContext& ctx) const
79 if constexpr (S==InvalidSlot::Disabled) {
80 return &m_slots.at(ctx.slot());
83 return ctx.valid() ? &m_slots.at(ctx.slot()) : &m_slots.back();
89 * @brief Return pointer to the object for the current slot.
91 * The slot number is found by retrieving the global current context.
93template <class T, InvalidSlot S>
95const T* SlotSpecificObj<T, S>::get() const
97 return get (Gaudi::Hive::currentContext());
102 * @brief Dereference the pointer.
104 * The slot number is found by retrieving the global current context.
106template <class T, InvalidSlot S>
108T& SlotSpecificObj<T, S>::operator* ()
115 * @brief Dereference the pointer.
117 * The slot number is found by retrieving the global current context.
119template <class T, InvalidSlot S>
121const T& SlotSpecificObj<T, S>::operator* () const
128 * @brief Dereference the pointer.
130 * The slot number is found by retrieving the global current context.
132template <class T, InvalidSlot S>
134T* SlotSpecificObj<T, S>::operator-> ()
141 * @brief Dereference the pointer.
143 * The slot number is found by retrieving the global current context.
145template <class T, InvalidSlot S>
147const T* SlotSpecificObj<T, S>::operator-> () const
154 * @brief Begin iterator.
156template <class T, InvalidSlot S>
158typename SlotSpecificObj<T, S>::iterator SlotSpecificObj<T, S>::begin()
160 return m_slots.begin();
165 * @brief Const begin iterator.
167template <class T, InvalidSlot S>
169typename SlotSpecificObj<T, S>::const_iterator SlotSpecificObj<T, S>::begin() const
171 return m_slots.begin();
176 * @brief End iterator.
178template <class T, InvalidSlot S>
180typename SlotSpecificObj<T, S>::iterator SlotSpecificObj<T, S>::end()
182 return m_slots.end();
187 * @brief Const end iterator.
189template <class T, InvalidSlot S>
191typename SlotSpecificObj<T, S>::const_iterator SlotSpecificObj<T, S>::end() const
193 return m_slots.end();