ATLAS Offline Software
Loading...
Searching...
No Matches
IOVEntryT.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef ATHENAKERNEL_IOVENTRYT_H
6#define ATHENAKERNEL_IOVENTRYT_H
7
8/*****************************************************************************
9 *
10 * IOVEntryT.h
11 * IOVSvc
12 *
13 * Author: Charles Leggett
14 *
15 * Validity range object that manages start and stop times, holding link
16 * to templated object.
17 *
18 *****************************************************************************/
19
21#include "GaudiKernel/EventIDRange.h"
22#include <format>
23#include <iostream>
24#include <set>
25
26template <typename T>
27
28class IOVEntryT {
29public:
30
31 // Ordered by increasing start times
33 public:
34 bool operator() ( const IOVEntryT<T> &p1, const IOVEntryT<T> &p2 ) const {
35 return p1.range().start() > p2.range().start();
36 }
37 bool operator() ( const IOVEntryT<T> *p1, const IOVEntryT<T> *p2 ) const {
38 return p1->range().start() > p2->range().start();
39 }
40 };
41
42 // Order by decreasing stop times
44 public:
45 bool operator() ( const IOVEntryT<T> &p1, const IOVEntryT<T> &p2 ) const {
46 return p1.range().stop() < p2.range().stop();
47 }
48 bool operator() ( const IOVEntryT<T> *p1, const IOVEntryT<T> *p2 ) const {
49 return p1->range().stop() < p2->range().stop();
50 }
51 };
52
54 IOVEntryT( T *obj, const EventIDRange& range):
55 m_objPtr(obj), m_range(range){}
56
57 ~IOVEntryT() = default;
58
59 const EventIDRange& range() const { return m_range; }
60 void setRange( const EventIDRange& range) { m_range=range; }
61
62 T* objPtr ATLAS_NOT_CONST_THREAD_SAFE () const { return m_objPtr; }
63 void setPtr( T* ptr ) { m_objPtr = ptr; }
64
65 friend std::ostream& operator<< (std::ostream& os, const IOVEntryT<T>& rhs) {
66 os << rhs.range() << " " << rhs.m_objPtr;
67 return os;
68 }
69
70private:
71 T* m_objPtr {};
72 EventIDRange m_range {};
73};
74
75
76namespace std {
77
79template <class T>
80struct formatter<IOVEntryT<T> >
81 : public formatter<string_view>
82{
83 template <class FmtContext>
84 FmtContext::iterator format (const IOVEntryT<T>& io, FmtContext& ctx) const
85 {
86 std::ostringstream ss;
87 ss << io;
88 return formatter<string_view>::format (ss.str(), ctx);
89 }
90};
91
92} // namespace std
93
94
95template <typename T>
97public:
98 bool operator() ( const IOVEntryT<T> &p1, const IOVEntryT<T> &p2 ) const {
99 return p1.range().start() > p2.range().start();
100 }
101};
102
103// // Order by obj pointer
104// class IOVEntryTProxyCritereon {
105// public:
106// bool operator() ( const IOVEntryT &p1, const IOVEntryT &p2) const {
107// return p1.proxy() < p2.proxy();
108// }
109// bool operator() ( const IOVEntryT *p1, const IOVEntryT *p2) const {
110// return p1->proxy() < p2->proxy();
111// }
112// };
113
114#endif
static Double_t ss
Define macros for attributes used to control the static checker.
bool operator()(const IOVEntryT< T > &p1, const IOVEntryT< T > &p2) const
Definition IOVEntryT.h:98
bool operator()(const IOVEntryT< T > &p1, const IOVEntryT< T > &p2) const
Definition IOVEntryT.h:34
bool operator()(const IOVEntryT< T > &p1, const IOVEntryT< T > &p2) const
Definition IOVEntryT.h:45
void setPtr(T *ptr)
Definition IOVEntryT.h:63
~IOVEntryT()=default
T *objPtr ATLAS_NOT_CONST_THREAD_SAFE() const
Definition IOVEntryT.h:62
EventIDRange m_range
Definition IOVEntryT.h:72
IOVEntryT(T *obj, const EventIDRange &range)
Definition IOVEntryT.h:54
T * m_objPtr
Definition IOVEntryT.h:71
const EventIDRange & range() const
Definition IOVEntryT.h:59
friend std::ostream & operator<<(std::ostream &os, const IOVEntryT< T > &rhs)
Definition IOVEntryT.h:65
void setRange(const EventIDRange &range)
Definition IOVEntryT.h:60
STL namespace.
FmtContext::iterator format(const IOVEntryT< T > &io, FmtContext &ctx) const
Definition IOVEntryT.h:84