LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
util::EventChangeTracker_t Class Reference

Detects the presence of a new event. More...

#include "ChangeTrackers.h"

Inheritance diagram for util::EventChangeTracker_t:
util::DataProductChangeTracker_t util::PlaneDataChangeTracker_t

Classes

struct  LocalState_t
 

Public Member Functions

 EventChangeTracker_t ()=default
 Default constructor: no current event, next event is a new one. More...
 
 EventChangeTracker_t (art::Event const &evt)
 Constructor: current event as specified. More...
 
 EventChangeTracker_t (art::EventID const &evt_id)
 Constructor: current event as specified by the event ID. More...
 
 operator std::string () const
 Returns a string representing the current state. More...
 
State query

Returns whether this tracker is in the same state as another

bool same (EventChangeTracker_t const &as) const
 Returns whether this tracker is in the same state as another. More...
 
bool isValid () const
 Returns whether there is a current event. More...
 
bool operator== (EventChangeTracker_t const &as) const
 Returns whether this tracker is in the same state as another. More...
 
bool operator!= (EventChangeTracker_t const &than) const
 Returns whether this tracker is in a different state than another. More...
 
State change

Forgets the current event

void clear ()
 Sets the current event ID. More...
 
void set (art::EventID const &evt_id)
 Sets the current event ID. More...
 
void set (art::Event const &evt)
 Sets the current event ID from the given event. More...
 
bool update (EventChangeTracker_t const &trk)
 Sets the current event, and returns true if it is changed. More...
 

Protected Member Functions

art::EventID const & eventID () const
 Returns the current event ID (it might be made public...) More...
 

Private Attributes

LocalState_t state
 local state of the tracker (may inherit some more) More...
 

Detailed Description

Detects the presence of a new event.


The state of this class describes the current event by its ID.

Definition at line 31 of file ChangeTrackers.h.

Constructor & Destructor Documentation

util::EventChangeTracker_t::EventChangeTracker_t ( )
default

Default constructor: no current event, next event is a new one.

util::EventChangeTracker_t::EventChangeTracker_t ( art::Event const &  evt)
inline

Constructor: current event as specified.

Definition at line 37 of file ChangeTrackers.h.

References art::Event::id().

37 : state{evt.id()} {}
LocalState_t state
local state of the tracker (may inherit some more)
TCEvent evt
Definition: DataStructs.cxx:8
util::EventChangeTracker_t::EventChangeTracker_t ( art::EventID const &  evt_id)
inline

Constructor: current event as specified by the event ID.

Definition at line 40 of file ChangeTrackers.h.

40 : state{evt_id} {}
LocalState_t state
local state of the tracker (may inherit some more)

Member Function Documentation

void util::EventChangeTracker_t::clear ( )
inline

Sets the current event ID.

Definition at line 60 of file ChangeTrackers.h.

Referenced by util::DataProductChangeTracker_t::clear().

60 { set(art::EventID()); }
art::EventID const& util::EventChangeTracker_t::eventID ( ) const
inlineprotected

Returns the current event ID (it might be made public...)

Definition at line 86 of file ChangeTrackers.h.

References util::EventChangeTracker_t::LocalState_t::event_id, and state.

Referenced by isValid(), operator std::string(), and same().

86 { return state.event_id; }
art::EventID event_id
ID of the current event.
LocalState_t state
local state of the tracker (may inherit some more)
bool util::EventChangeTracker_t::isValid ( ) const
inline

Returns whether there is a current event.

Definition at line 48 of file ChangeTrackers.h.

References eventID().

Referenced by util::DataProductChangeTracker_t::isValid().

48 { return eventID() != art::EventID(); }
art::EventID const & eventID() const
Returns the current event ID (it might be made public...)
util::EventChangeTracker_t::operator std::string ( ) const
inline

Returns a string representing the current state.

Definition at line 78 of file ChangeTrackers.h.

References eventID(), and util::to_string().

79  {
80  return "R:" + std::to_string(eventID().run()) + " S:" + std::to_string(eventID().subRun()) +
81  " E:" + std::to_string(eventID().event());
82  }
art::EventID const & eventID() const
Returns the current event ID (it might be made public...)
decltype(auto) constexpr to_string(T &&obj)
ADL-aware version of std::to_string.
Event finding and building.
bool util::EventChangeTracker_t::operator!= ( EventChangeTracker_t const &  than) const
inline

Returns whether this tracker is in a different state than another.

Definition at line 54 of file ChangeTrackers.h.

References same().

54 { return !same(than); }
bool same(EventChangeTracker_t const &as) const
Returns whether this tracker is in the same state as another.
bool util::EventChangeTracker_t::operator== ( EventChangeTracker_t const &  as) const
inline

Returns whether this tracker is in the same state as another.

Definition at line 51 of file ChangeTrackers.h.

References same().

51 { return same(as); }
bool same(EventChangeTracker_t const &as) const
Returns whether this tracker is in the same state as another.
bool util::EventChangeTracker_t::same ( EventChangeTracker_t const &  as) const
inline

Returns whether this tracker is in the same state as another.

Definition at line 45 of file ChangeTrackers.h.

References eventID().

Referenced by operator!=(), util::DataProductChangeTracker_t::operator!=(), util::PlaneDataChangeTracker_t::operator!=(), operator==(), util::DataProductChangeTracker_t::operator==(), util::PlaneDataChangeTracker_t::operator==(), util::DataProductChangeTracker_t::sameEvent(), update(), util::DataProductChangeTracker_t::update(), and util::PlaneDataChangeTracker_t::update().

45 { return as.eventID() == eventID(); }
art::EventID const & eventID() const
Returns the current event ID (it might be made public...)
void util::EventChangeTracker_t::set ( art::EventID const &  evt_id)
inline

Sets the current event ID.

Definition at line 63 of file ChangeTrackers.h.

References util::EventChangeTracker_t::LocalState_t::event_id, and state.

Referenced by util::DataProductChangeTracker_t::set().

63 { state.event_id = evt_id; }
art::EventID event_id
ID of the current event.
LocalState_t state
local state of the tracker (may inherit some more)
void util::EventChangeTracker_t::set ( art::Event const &  evt)
inline

Sets the current event ID from the given event.

Definition at line 66 of file ChangeTrackers.h.

References tca::evt.

66 { set(evt.id()); }
TCEvent evt
Definition: DataStructs.cxx:8
bool util::EventChangeTracker_t::update ( EventChangeTracker_t const &  trk)
inline

Sets the current event, and returns true if it is changed.

Definition at line 69 of file ChangeTrackers.h.

References same().

70  {
71  if (same(trk)) return false;
72  *this = trk;
73  return true;
74  }
bool same(EventChangeTracker_t const &as) const
Returns whether this tracker is in the same state as another.

Member Data Documentation

LocalState_t util::EventChangeTracker_t::state
private

local state of the tracker (may inherit some more)

Definition at line 93 of file ChangeTrackers.h.

Referenced by eventID(), util::DataProductChangeTracker_t::inputLabel(), util::PlaneDataChangeTracker_t::planeID(), and set().


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