Classes | Public Member Functions | Protected Member Functions | Private Attributes | List of all members
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::DataProductChangeTracker_t util::PlaneDataChangeTracker_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...
 
 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
 
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...
 
bool same (EventChangeTracker_t const &as) const
 
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 ()
 
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...
 
void clear ()
 
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...
 
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 28 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 34 of file ChangeTrackers.h.

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

Constructor: current event as specified by the event ID.

Definition at line 37 of file ChangeTrackers.h.

37 : state{evt_id} {}
LocalState_t state
local state of the tracker (may inherit some more)
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 38 of file ChangeTrackers.h.

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

Constructor: current event as specified by the event ID.

Definition at line 41 of file ChangeTrackers.h.

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

Member Function Documentation

void util::EventChangeTracker_t::clear ( )
inline

Definition at line 59 of file ChangeTrackers.h.

59 { set(art::EventID()); }
void util::EventChangeTracker_t::clear ( )
inline

Definition at line 63 of file ChangeTrackers.h.

63 { 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 87 of file ChangeTrackers.h.

87 { 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)
art::EventID const& util::EventChangeTracker_t::eventID ( ) const
inlineprotected

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

Definition at line 91 of file ChangeTrackers.h.

91 { 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 46 of file ChangeTrackers.h.

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

Returns whether there is a current event.

Definition at line 50 of file ChangeTrackers.h.

50 { 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 77 of file ChangeTrackers.h.

78  {
79  return "R:" + std::to_string(eventID().run())
80  + " 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...)
std::string to_string(ModuleType const mt)
Definition: ModuleType.h:34
util::EventChangeTracker_t::operator std::string ( ) const
inline

Returns a string representing the current state.

Definition at line 81 of file ChangeTrackers.h.

82  {
83  return "R:" + std::to_string(eventID().run())
84  + " S:" + std::to_string(eventID().subRun())
85  + " E:" + std::to_string(eventID().event());
86  }
art::EventID const & eventID() const
Returns the current event ID (it might be made public...)
std::string to_string(ModuleType const mt)
Definition: ModuleType.h:34
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 52 of file ChangeTrackers.h.

53  { return !same(than); }
bool same(EventChangeTracker_t const &as) const
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 56 of file ChangeTrackers.h.

57  { return !same(than); }
bool same(EventChangeTracker_t const &as) const
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 49 of file ChangeTrackers.h.

49 { return same(as); }
static constexpr double as
Definition: Units.h:101
bool same(EventChangeTracker_t const &as) const
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 53 of file ChangeTrackers.h.

53 { return same(as); }
static constexpr double as
Definition: Units.h:101
bool same(EventChangeTracker_t const &as) const
bool util::EventChangeTracker_t::same ( EventChangeTracker_t const &  as) const
inline

Definition at line 42 of file ChangeTrackers.h.

43  { return as.eventID() == eventID(); }
art::EventID const & eventID() const
Returns the current event ID (it might be made public...)
static constexpr double as
Definition: Units.h:101
bool util::EventChangeTracker_t::same ( EventChangeTracker_t const &  as) const
inline

Definition at line 46 of file ChangeTrackers.h.

47  { return as.eventID() == eventID(); }
art::EventID const & eventID() const
Returns the current event ID (it might be made public...)
static constexpr double as
Definition: Units.h:101
void util::EventChangeTracker_t::set ( art::EventID const &  evt_id)
inline

Sets the current event ID.

Definition at line 62 of file ChangeTrackers.h.

62 { 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 65 of file ChangeTrackers.h.

65 { set(evt.id()); }
TCEvent evt
Definition: DataStructs.cxx:7
void util::EventChangeTracker_t::set ( art::EventID const &  evt_id)
inline

Sets the current event ID.

Definition at line 66 of file ChangeTrackers.h.

66 { 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 69 of file ChangeTrackers.h.

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

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

Definition at line 68 of file ChangeTrackers.h.

69  {
70  if (same(trk)) return false;
71  *this = trk;
72  return true;
73  }
bool same(EventChangeTracker_t const &as) const
bool util::EventChangeTracker_t::update ( EventChangeTracker_t const &  trk)
inline

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

Definition at line 72 of file ChangeTrackers.h.

73  {
74  if (same(trk)) return false;
75  *this = trk;
76  return true;
77  }
bool same(EventChangeTracker_t const &as) const

Member Data Documentation

LocalState_t util::EventChangeTracker_t::state
private

local state of the tracker (may inherit some more)

Definition at line 95 of file ChangeTrackers.h.


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