Skip to content
Snippets Groups Projects
Commit 68ecbfc0 authored by Gerhard Raven's avatar Gerhard Raven
Browse files

inline one-line member functions

parent 1a6e3832
No related branches found
No related tags found
1 merge request!510Implement EventIDBase ordering in a generic way by specifying projections
......@@ -74,7 +74,7 @@ public:
number_type time_stamp_ns_offset = 0, number_type lumi_block = UNDEFNUM,
number_type bunch_crossing_id = 0 );
// Use default copy constructor.
virtual ~EventIDBase();
virtual ~EventIDBase() = default;
//@}
/// run number - 32 bit unsigned
......@@ -133,18 +133,18 @@ public:
void set_bunch_crossing_id( number_type bcid ) { m_bunch_crossing_id = bcid; }
/// Comparison operators
friend bool operator<( const EventIDBase& lhs, const EventIDBase& rhs );
friend bool operator>( const EventIDBase& lhs, const EventIDBase& rhs );
friend bool operator==( const EventIDBase& lhs, const EventIDBase& rhs );
friend bool operator!=( const EventIDBase& lhs, const EventIDBase& rhs );
friend bool operator<=( const EventIDBase& lhs, const EventIDBase& rhs );
friend bool operator>=( const EventIDBase& lhs, const EventIDBase& rhs );
friend bool operator<( const EventIDBase& lhs, const EventIDBase& rhs );
friend bool operator>( const EventIDBase& lhs, const EventIDBase& rhs ) { return rhs < lhs; }
friend bool operator!=( const EventIDBase& lhs, const EventIDBase& rhs ) { return !( lhs == rhs ); }
friend bool operator<=( const EventIDBase& lhs, const EventIDBase& rhs ) { return !( lhs > rhs ); }
friend bool operator>=( const EventIDBase& lhs, const EventIDBase& rhs ) { return !( lhs < rhs ); }
bool isRunEvent() const;
bool isTimeStamp() const;
bool isLumiEvent() const;
bool isRunLumi() const;
bool isValid() const;
bool isRunEvent() const { return m_type & RunEvent; }
bool isTimeStamp() const { return m_type & TimeStamp; }
bool isLumiEvent() const { return m_type & LumiEvent; }
bool isRunLumi() const { return m_type & RunLumi; }
bool isValid() const { return m_type != Invalid; }
/// Extraction operators
friend std::ostream& operator<<( std::ostream& os, const EventIDBase& rhs );
......@@ -178,10 +178,10 @@ private:
unsigned m_type{Invalid};
void setRE() { m_type = m_type | RunEvent; }
void setTS() { m_type = m_type | TimeStamp; }
void setLE() { m_type = m_type | LumiEvent; }
void setRL() { m_type = m_type | RunLumi; }
void setRE() { m_type |= RunEvent; }
void setTS() { m_type |= TimeStamp; }
void setLE() { m_type |= LumiEvent; }
void setRL() { m_type |= RunLumi; }
/// run number
number_type m_run_number{UNDEFNUM};
......@@ -223,10 +223,6 @@ inline bool operator==( const EventIDBase& lhs, const EventIDBase& rhs )
return ( lhs.m_run_number == rhs.m_run_number && lhs.m_event_number == rhs.m_event_number &&
lhs.m_lumi_block == rhs.m_lumi_block );
}
inline bool operator>( const EventIDBase& lhs, const EventIDBase& rhs ) { return rhs < lhs; }
inline bool operator!=( const EventIDBase& lhs, const EventIDBase& rhs ) { return !( lhs == rhs ); }
inline bool operator<=( const EventIDBase& lhs, const EventIDBase& rhs ) { return !( lhs > rhs ); }
inline bool operator>=( const EventIDBase& lhs, const EventIDBase& rhs ) { return !( lhs < rhs ); }
inline std::ostream& operator<<( std::ostream& os, const EventIDBase& rhs )
{
......
......@@ -23,34 +23,14 @@ EventIDBase::EventIDBase( number_type run_number, event_number_t event_number, n
, m_lumi_block( lumi_block )
, m_bunch_crossing_id( bunch_crossing_id )
{
if ( m_run_number != UNDEFNUM && m_event_number != UNDEFEVT ) {
setRE();
}
if ( m_run_number != UNDEFNUM && m_event_number != UNDEFEVT ) setRE();
if ( m_time_stamp != UNDEFNUM ) {
setTS();
if ( m_time_stamp_ns_offset == UNDEFNUM ) {
m_time_stamp_ns_offset = 0;
}
if ( m_time_stamp_ns_offset == UNDEFNUM ) m_time_stamp_ns_offset = 0;
}
if ( m_lumi_block != UNDEFNUM && m_event_number != UNDEFEVT ) {
setLE();
}
if ( m_lumi_block != UNDEFNUM && m_event_number != UNDEFEVT ) setLE();
if ( m_run_number != UNDEFNUM && m_lumi_block != UNDEFNUM ) {
setRL();
}
if ( m_run_number != UNDEFNUM && m_lumi_block != UNDEFNUM ) setRL();
}
EventIDBase::~EventIDBase() {}
bool EventIDBase::isRunEvent() const { return ( m_type & RunEvent ); }
bool EventIDBase::isTimeStamp() const { return ( m_type & TimeStamp ); }
bool EventIDBase::isLumiEvent() const { return ( m_type & LumiEvent ); }
bool EventIDBase::isRunLumi() const { return ( m_type & RunLumi ); }
bool EventIDBase::isValid() const { return ( m_type != Invalid ); }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment