ATLAS Offline Software
Loading...
Searching...
No Matches
AthToolSupport/AsgTools/AsgTools/SlotSpecificObj.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration.
3 */
4
11
12#ifndef ASGTOOLS_SLOTSPECIFICOBJ_H
13#define ASGTOOLS_SLOTSPECIFICOBJ_H
14
15#ifndef XAOD_STANDALONE
17#else
18
19#include <array>
20#include <string>
21
22class EventContext;
23
24namespace SG {
25
35template <class T>
37{
38public:
39 SlotSpecificObj() = default;
40 SlotSpecificObj (size_t /*nslots*/) : SlotSpecificObj() {}
41
43 T* get (const EventContext&) { return get(); }
44 T* get() { return &m_slots[0]; }
45 const T* get (const EventContext&) const { return get(); }
46 const T* get() const { return &m_slots[0]; }
48
50 T& operator* () { return *get(); }
51 const T& operator* () const { return *get(); }
52 T* operator-> () { return get(); }
53 const T* operator-> () const { return get(); }
55
57 typedef typename std::array<T,1>::iterator iterator;
58 typedef typename std::array<T,1>::const_iterator const_iterator;
59 typedef typename std::array<T,1>::value_type value_type;
60
61 iterator begin() { return m_slots.begin(); }
62 const_iterator begin() const { return m_slots.begin(); }
63 iterator end() { return m_slots.end(); }
64 const_iterator end() const { return m_slots.end(); }
66
67private:
69 std::array<T,1> m_slots{};
70};
71
72} // namespace SG
73
74#endif // XAOD_STANDALONE
75#endif // ASGTOOLS_SLOTSPECIFICOBJ_H
Maintain a set of objects, one per slot.
Maintain a set of objects, one per slot.
T & operator*()
Dereference the pointer.
iterator end()
End iterator.
SlotSpecificObj()
Constructor.
T * get()
Return pointer to the object for the current slot.
iterator begin()
Begin iterator.
T * operator->()
Dereference the pointer.
std::vector< T > m_slots
Set of per-slot objects.
std::vector< T >::const_iterator const_iterator
Forward declaration.
unsigned long long T