ATLAS Offline Software
Loading...
Searching...
No Matches
IOVTime Class Reference

Basic time unit for IOVSvc. More...

#include <IOVTime.h>

Collaboration diagram for IOVTime:

Classes

class  SortByRunEvent
 Predicate. More...
class  SortByTimeStamp
 Predicate. More...

Public Member Functions

 IOVTime ()
 IOVTime (uint64_t timestamp)
 IOVTime (uint32_t run, uint32_t event)
 IOVTime (uint32_t run, uint32_t event, uint64_t timestamp)
 IOVTime (const EventIDBase &eid)
void setTimestamp (uint64_t timestamp) noexcept
void setRETime (uint64_t time) noexcept
void setRunEvent (uint32_t run, uint32_t event) noexcept
void reset () noexcept
uint32_t run () const noexcept
uint32_t event () const noexcept
uint64_t re_time () const noexcept
uint64_t timestamp () const noexcept
bool isValid () const noexcept
bool isTimestamp () const noexcept
bool isRunEvent () const noexcept
bool isBoth () const noexcept
 operator std::string () const
 operator EventIDBase () const

Static Public Attributes

static constexpr uint32_t MINRUN = std::numeric_limits<uint32_t>::min()
static constexpr uint32_t MAXRUN = (std::numeric_limits<uint32_t>::max() >> 1)
static constexpr uint32_t MINEVENT = std::numeric_limits<uint32_t>::min()
static constexpr uint32_t MAXEVENT = (std::numeric_limits<uint32_t>::max())
static constexpr uint64_t MAXRETIME =( ((uint64_t) IOVTime::MAXRUN << 32) + IOVTime::MAXEVENT )
static constexpr uint64_t UNDEFRETIME = std::numeric_limits<uint64_t>::max()
static constexpr uint64_t MINTIMESTAMP = std::numeric_limits<uint64_t>::min()
static constexpr uint64_t MAXTIMESTAMP = (std::numeric_limits<uint64_t>::max() >> 1)
static constexpr uint64_t UNDEFTIMESTAMP = std::numeric_limits<uint64_t>::max()

Private Types

enum  IOVTime_type { UNDEF = 0 , TIMESTAMP , RUN_EVT , BOTH }

Private Attributes

IOVTime_type m_status
uint64_t m_time
uint64_t m_timestamp

Friends

bool operator< (const IOVTime &lhs, const IOVTime &rhs)
bool operator> (const IOVTime &lhs, const IOVTime &rhs)
bool operator== (const IOVTime &lhs, const IOVTime &rhs)
bool operator!= (const IOVTime &lhs, const IOVTime &rhs)
bool operator>= (const IOVTime &lhs, const IOVTime &rhs)
bool operator<= (const IOVTime &lhs, const IOVTime &rhs)
std::ostream & operator<< (std::ostream &os, const IOVTime &rhs)
MsgStream & operator<< (MsgStream &os, const IOVTime &rhs)

Detailed Description

Basic time unit for IOVSvc.

Hold time as a combination of run and event numbers

Definition at line 33 of file IOVTime.h.

Member Enumeration Documentation

◆ IOVTime_type

enum IOVTime::IOVTime_type
private
Enumerator
UNDEF 
TIMESTAMP 
RUN_EVT 
BOTH 

Definition at line 36 of file IOVTime.h.

36 {
37 UNDEF = 0,
39 RUN_EVT,
40 BOTH
41 };
@ UNDEF
Definition IOVTime.h:37
@ TIMESTAMP
Definition IOVTime.h:38
@ BOTH
Definition IOVTime.h:40
@ RUN_EVT
Definition IOVTime.h:39

Constructor & Destructor Documentation

◆ IOVTime() [1/5]

IOVTime::IOVTime ( )
inline

Definition at line 91 of file IOVTime.h.

static constexpr uint64_t UNDEFTIMESTAMP
Definition IOVTime.h:59
static constexpr uint64_t UNDEFRETIME
Definition IOVTime.h:54
IOVTime_type m_status
Definition IOVTime.h:132
uint64_t m_time
Definition IOVTime.h:133
uint64_t m_timestamp
Definition IOVTime.h:134

◆ IOVTime() [2/5]

IOVTime::IOVTime ( uint64_t timestamp)
inlineexplicit

Definition at line 93 of file IOVTime.h.

uint64_t timestamp() const noexcept
Definition IOVTime.h:108

◆ IOVTime() [3/5]

IOVTime::IOVTime ( uint32_t run,
uint32_t event )
explicit

Definition at line 26 of file IOVTime.cxx.

26 :
29{
30 m_time = ( (uint64_t) run << 32) + event;
31}
uint32_t event() const noexcept
Definition IOVTime.h:106
uint32_t run() const noexcept
Definition IOVTime.h:105

◆ IOVTime() [4/5]

IOVTime::IOVTime ( uint32_t run,
uint32_t event,
uint64_t timestamp )
explicit

Definition at line 35 of file IOVTime.cxx.

36 :
38{
39 m_time = ( (uint64_t) run << 32) + event;
40}

◆ IOVTime() [5/5]

IOVTime::IOVTime ( const EventIDBase & eid)

Definition at line 44 of file IOVTime.cxx.

45{
46 m_time = 0;
47 m_timestamp = eid.time_stamp()*1000000000LL + eid.time_stamp_ns_offset();
48
49 if (eid.isRunEvent()) {
50 m_time = ( (uint64_t) eid.run_number() << 32) + eid.event_number();
51 if (eid.isTimeStamp()) {
53 } else {
55 }
56 } else if (eid.isLumiEvent()) {
57 m_time = ( (uint64_t) eid.lumi_block() << 32) + eid.event_number();
58 if (eid.isTimeStamp()) {
60 } else {
62 }
63 } else {
65 }
66
67}

Member Function Documentation

◆ event()

uint32_t IOVTime::event ( ) const
inlinenoexcept

Definition at line 106 of file IOVTime.h.

106{ return static_cast<uint32_t> (m_time & 0xFFFFFFFF); }
setEventNumber uint32_t

◆ isBoth()

bool IOVTime::isBoth ( ) const
inlinenoexcept

Definition at line 115 of file IOVTime.h.

115{ return (m_status == IOVTime::BOTH) ? 1 : 0; }

◆ isRunEvent()

bool IOVTime::isRunEvent ( ) const
inlinenoexcept

Definition at line 113 of file IOVTime.h.

113 { return (m_status == IOVTime::RUN_EVT ||
114 m_status == IOVTime::BOTH) ? 1 : 0; }

◆ isTimestamp()

bool IOVTime::isTimestamp ( ) const
inlinenoexcept

Definition at line 111 of file IOVTime.h.

111 { return (m_status == IOVTime::TIMESTAMP ||
112 m_status== IOVTime::BOTH) ? 1 : 0; }

◆ isValid()

bool IOVTime::isValid ( ) const
noexcept

Definition at line 117 of file IOVTime.cxx.

117 {
118
119 // Cannot have BOTH undefined
122 return 0 ;
123 }
124
125 // Check run/event to be < max
127 // event() can never be more than MAXEVENT, by construction.
128 if ( run() > IOVTime::MAXRUN /*|| event() > IOVTime::MAXEVENT*/ ) {
129 return 0;
130 }
131 }
132
133 // Check time < max
136 return 0;
137 }
138 }
139
142 // May have both timestamp and run/event set
143 // event() can never be more than MAXEVENT, by construction.
144 if ( run() > IOVTime::MAXRUN /*|| event() > IOVTime::MAXEVENT*/ ) {
145 return 0;
146 }
148 return 0;
149 }
150 }
151
152 return 1;
153
154}
static constexpr uint64_t MAXTIMESTAMP
Definition IOVTime.h:58
static constexpr uint32_t MAXRUN
Definition IOVTime.h:48

◆ operator EventIDBase()

IOVTime::operator EventIDBase ( ) const

Definition at line 170 of file IOVTime.cxx.

170 {
171 if (isBoth()) {
172 return EventIDBase(run(),EventIDBase::UNDEFEVT,
173 std::min(timestamp()/1000000000LL,(unsigned long long)(std::numeric_limits<unsigned int>::max()-1)),timestamp()%1000000000LL,
174 event());
175 } else if (isTimestamp()) {
176 return EventIDBase(EventIDBase::UNDEFNUM,EventIDBase::UNDEFEVT,
177 std::min(timestamp()/1000000000LL,(unsigned long long)(std::numeric_limits<unsigned int>::max()-1)),timestamp()%1000000000LL);
178 } else if (isRunEvent()) {
179 return EventIDBase(run(),EventIDBase::UNDEFEVT,
180 EventIDBase::UNDEFNUM,0,
181 event());
182 } else {
183 return EventIDBase();
184 }
185}
bool isBoth() const noexcept
Definition IOVTime.h:115
bool isTimestamp() const noexcept
Definition IOVTime.h:111
bool isRunEvent() const noexcept
Definition IOVTime.h:113

◆ operator std::string()

IOVTime::operator std::string ( ) const

Definition at line 156 of file IOVTime.cxx.

156 {
157 std::ostringstream os;
158 os << "[";
159 if (isRunEvent()) {
160 os << (m_time>>32) << "," << ( m_time & 0xFFFFFFFF );
161 }
162 if (isTimestamp()) {
163 if (isRunEvent()) os << ":";
164 os << m_timestamp;
165 }
166 os << "]";
167 return os.str();
168}

◆ re_time()

uint64_t IOVTime::re_time ( ) const
inlinenoexcept

Definition at line 107 of file IOVTime.h.

107{ return m_time; }

◆ reset()

void IOVTime::reset ( )
noexcept

Definition at line 108 of file IOVTime.cxx.

◆ run()

uint32_t IOVTime::run ( ) const
inlinenoexcept

Definition at line 105 of file IOVTime.h.

105{ return static_cast<uint32_t> (m_time>>32); }

◆ setRETime()

void IOVTime::setRETime ( uint64_t time)
noexcept

Definition at line 84 of file IOVTime.cxx.

84 {
85 if (isTimestamp()) {
87 } else {
89 }
90 m_time = time;
91}
time(flags, cells_name, *args, **kw)

◆ setRunEvent()

void IOVTime::setRunEvent ( uint32_t run,
uint32_t event )
noexcept

Definition at line 96 of file IOVTime.cxx.

96 {
97 if (isTimestamp()) {
99 } else {
101 }
102 m_time = ( (uint64_t) run << 32) + event;
103}

◆ setTimestamp()

void IOVTime::setTimestamp ( uint64_t timestamp)
noexcept

Definition at line 72 of file IOVTime.cxx.

72 {
73 if (isRunEvent()) {
75 } else {
77 }
79}

◆ timestamp()

uint64_t IOVTime::timestamp ( ) const
inlinenoexcept

Definition at line 108 of file IOVTime.h.

108{ return m_timestamp; }

◆ operator!=

bool operator!= ( const IOVTime & lhs,
const IOVTime & rhs )
friend

Definition at line 158 of file IOVTime.h.

158 {
159 return !(lhs == rhs) ;
160}

◆ operator<

bool operator< ( const IOVTime & lhs,
const IOVTime & rhs )
friend

Definition at line 137 of file IOVTime.h.

137 {
138 if (lhs.isTimestamp() && rhs.isTimestamp()) {
139 return lhs.m_timestamp < rhs.m_timestamp;
140 } else {
141 return lhs.m_time < rhs.m_time;
142 }
143}

◆ operator<< [1/2]

MsgStream & operator<< ( MsgStream & os,
const IOVTime & rhs )
friend

Definition at line 187 of file IOVTime.cxx.

187 {
188 os << (std::string) rhs;
189 return os;
190}

◆ operator<< [2/2]

std::ostream & operator<< ( std::ostream & os,
const IOVTime & rhs )
friend

Definition at line 192 of file IOVTime.cxx.

192 {
193 os << (std::string) rhs;
194 return os;
195}

◆ operator<=

bool operator<= ( const IOVTime & lhs,
const IOVTime & rhs )
friend

Definition at line 164 of file IOVTime.h.

164 {
165 return !( lhs > rhs );
166}

◆ operator==

bool operator== ( const IOVTime & lhs,
const IOVTime & rhs )
friend

Definition at line 151 of file IOVTime.h.

151 {
152 if (lhs.isTimestamp() && rhs.isTimestamp()) {
153 return lhs.m_timestamp == rhs.m_timestamp;
154 } else {
155 return lhs.m_time == rhs.m_time;
156 }
157}

◆ operator>

bool operator> ( const IOVTime & lhs,
const IOVTime & rhs )
friend

Definition at line 144 of file IOVTime.h.

144 {
145 if (lhs.isTimestamp() && rhs.isTimestamp()) {
146 return lhs.m_timestamp > rhs.m_timestamp;
147 } else {
148 return lhs.m_time > rhs.m_time;
149 }
150}

◆ operator>=

bool operator>= ( const IOVTime & lhs,
const IOVTime & rhs )
friend

Definition at line 161 of file IOVTime.h.

161 {
162 return !( lhs < rhs );
163}

Member Data Documentation

◆ m_status

IOVTime_type IOVTime::m_status
private

Definition at line 132 of file IOVTime.h.

◆ m_time

uint64_t IOVTime::m_time
private

Definition at line 133 of file IOVTime.h.

◆ m_timestamp

uint64_t IOVTime::m_timestamp
private

Definition at line 134 of file IOVTime.h.

◆ MAXEVENT

uint32_t IOVTime::MAXEVENT = (std::numeric_limits<uint32_t>::max())
staticconstexpr

Definition at line 51 of file IOVTime.h.

◆ MAXRETIME

uint64_t IOVTime::MAXRETIME =( ((uint64_t) IOVTime::MAXRUN << 32) + IOVTime::MAXEVENT )
staticconstexpr

Definition at line 53 of file IOVTime.h.

◆ MAXRUN

uint32_t IOVTime::MAXRUN = (std::numeric_limits<uint32_t>::max() >> 1)
staticconstexpr

Definition at line 48 of file IOVTime.h.

◆ MAXTIMESTAMP

uint64_t IOVTime::MAXTIMESTAMP = (std::numeric_limits<uint64_t>::max() >> 1)
staticconstexpr

Definition at line 58 of file IOVTime.h.

◆ MINEVENT

uint32_t IOVTime::MINEVENT = std::numeric_limits<uint32_t>::min()
staticconstexpr

Definition at line 50 of file IOVTime.h.

◆ MINRUN

uint32_t IOVTime::MINRUN = std::numeric_limits<uint32_t>::min()
staticconstexpr

Definition at line 44 of file IOVTime.h.

◆ MINTIMESTAMP

uint64_t IOVTime::MINTIMESTAMP = std::numeric_limits<uint64_t>::min()
staticconstexpr

Definition at line 56 of file IOVTime.h.

◆ UNDEFRETIME

uint64_t IOVTime::UNDEFRETIME = std::numeric_limits<uint64_t>::max()
staticconstexpr

Definition at line 54 of file IOVTime.h.

◆ UNDEFTIMESTAMP

uint64_t IOVTime::UNDEFTIMESTAMP = std::numeric_limits<uint64_t>::max()
staticconstexpr

Definition at line 59 of file IOVTime.h.


The documentation for this class was generated from the following files: