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

Detects the presence of a new event or data product. More...

#include "ChangeTrackers.h"

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

Classes

struct  LocalState_t
 

Public Member Functions

 DataProductChangeTracker_t ()=default
 Default constructor: no current data product. More...
 
 DataProductChangeTracker_t (art::Event const &evt, art::InputTag const &label)
 Constructor: specifies current event and data product label. More...
 
 DataProductChangeTracker_t (art::EventID const &evt_id, art::InputTag const &label)
 Constructor: specifies current event ID and data product label. More...
 
 operator std::string () const
 Returns a string representation of event and data product label. More...
 
State query

Returns the current input label

art::InputTag const & inputLabel () const
 Returns whether we are in the same event (the rest could differ) More...
 
bool sameEvent (DataProductChangeTracker_t const &as) const
 Returns whether we are in the same event (the rest could differ) More...
 
bool same (DataProductChangeTracker_t const &as) const
 Returns whether we have same data product as in "as". More...
 
bool isValid () const
 Returns whether there is a current event and data product. More...
 
bool operator== (DataProductChangeTracker_t const &as) const
 Returns whether the event and input label are the same as in "as". More...
 
bool operator!= (DataProductChangeTracker_t const &than) const
 Returns whether the event or input label are different than in "than". More...
 
State change

Forget the current data product

void clear ()
 Set a new event and data product label as current. More...
 
void set (art::Event const &evt, art::InputTag const &label)
 Set a new event and data product label as current. More...
 
bool update (DataProductChangeTracker_t const &new_prod)
 Update to a new data product, return true if it has changed. More...
 

Private Member Functions

void SetInputLabel (art::InputTag const &label)
 
art::EventID const & eventID () const
 Returns the current event ID (it might be made public...) 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 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 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...
 

Private Attributes

LocalState_t state
 

Detailed Description

Detects the presence of a new event or data product.


The state of this class describes the current data product input as the event it belongs to (by its ID) and the input tag.

Definition at line 109 of file ChangeTrackers.h.

Constructor & Destructor Documentation

util::DataProductChangeTracker_t::DataProductChangeTracker_t ( )
default

Default constructor: no current data product.

util::DataProductChangeTracker_t::DataProductChangeTracker_t ( art::Event const &  evt,
art::InputTag const &  label 
)
inline

Constructor: specifies current event and data product label.

Definition at line 115 of file ChangeTrackers.h.

116  : EventChangeTracker_t(evt), state{label}
117  {}
EventChangeTracker_t()=default
Default constructor: no current event, next event is a new one.
TCEvent evt
Definition: DataStructs.cxx:8
util::DataProductChangeTracker_t::DataProductChangeTracker_t ( art::EventID const &  evt_id,
art::InputTag const &  label 
)
inline

Constructor: specifies current event ID and data product label.

Definition at line 120 of file ChangeTrackers.h.

121  : EventChangeTracker_t(evt_id), state{label}
122  {}
EventChangeTracker_t()=default
Default constructor: no current event, next event is a new one.

Member Function Documentation

void util::DataProductChangeTracker_t::clear ( )
inline

Set a new event and data product label as current.

Definition at line 157 of file ChangeTrackers.h.

References util::EventChangeTracker_t::clear().

Referenced by util::PlaneDataChangeTracker_t::clear(), and evd::TWQProjectionView::OnNewEvent().

158  {
161  }
void clear()
Sets the current event ID.
void SetInputLabel(art::InputTag const &label)
art::EventID const& util::EventChangeTracker_t::eventID ( ) const
inlineprotectedinherited

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 util::EventChangeTracker_t::state.

Referenced by util::EventChangeTracker_t::isValid(), util::EventChangeTracker_t::operator std::string(), and util::EventChangeTracker_t::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)
art::InputTag const& util::DataProductChangeTracker_t::inputLabel ( ) const
inline
bool util::DataProductChangeTracker_t::isValid ( ) const
inline

Returns whether there is a current event and data product.

Definition at line 142 of file ChangeTrackers.h.

References util::EventChangeTracker_t::isValid().

Referenced by util::PlaneDataChangeTracker_t::isValid(), and evd::TWQProjectionView::OnNewEvent().

143  {
144  return EventChangeTracker_t::isValid() && !inputLabel().label().empty();
145  }
bool isValid() const
Returns whether there is a current event.
std::string const & label() const noexcept
Definition: InputTag.cc:79
art::InputTag const & inputLabel() const
Returns whether we are in the same event (the rest could differ)
util::DataProductChangeTracker_t::operator std::string ( ) const
inline

Returns a string representation of event and data product label.

Definition at line 181 of file ChangeTrackers.h.

182  {
183  return EventChangeTracker_t::operator std::string() + " I{" + inputLabel().encode() + "}";
184  }
std::string encode() const
Definition: InputTag.cc:97
art::InputTag const & inputLabel() const
Returns whether we are in the same event (the rest could differ)
bool util::EventChangeTracker_t::operator!= ( EventChangeTracker_t const &  than) const
inlineinherited

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

Definition at line 54 of file ChangeTrackers.h.

References util::EventChangeTracker_t::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::DataProductChangeTracker_t::operator!= ( DataProductChangeTracker_t const &  than) const
inline

Returns whether the event or input label are different than in "than".

Definition at line 151 of file ChangeTrackers.h.

References util::EventChangeTracker_t::same().

151 { return !same(than); }
bool same(DataProductChangeTracker_t const &as) const
Returns whether we have same data product as in "as".
bool util::EventChangeTracker_t::operator== ( EventChangeTracker_t const &  as) const
inlineinherited

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

Definition at line 51 of file ChangeTrackers.h.

References util::EventChangeTracker_t::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::DataProductChangeTracker_t::operator== ( DataProductChangeTracker_t const &  as) const
inline

Returns whether the event and input label are the same as in "as".

Definition at line 148 of file ChangeTrackers.h.

References util::EventChangeTracker_t::same().

148 { return same(as); }
bool same(DataProductChangeTracker_t const &as) const
Returns whether we have same data product as in "as".
bool util::EventChangeTracker_t::same ( EventChangeTracker_t const &  as) const
inlineinherited

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

Definition at line 45 of file ChangeTrackers.h.

References util::EventChangeTracker_t::eventID().

Referenced by util::EventChangeTracker_t::operator!=(), operator!=(), util::PlaneDataChangeTracker_t::operator!=(), util::EventChangeTracker_t::operator==(), operator==(), util::PlaneDataChangeTracker_t::operator==(), sameEvent(), util::EventChangeTracker_t::update(), 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...)
bool util::DataProductChangeTracker_t::same ( DataProductChangeTracker_t const &  as) const
inline

Returns whether we have same data product as in "as".

Definition at line 136 of file ChangeTrackers.h.

References inputLabel().

Referenced by util::PlaneDataChangeTracker_t::sameProduct().

137  {
138  return sameEvent(as) && (inputLabel() == as.inputLabel());
139  }
art::InputTag const & inputLabel() const
Returns whether we are in the same event (the rest could differ)
bool sameEvent(DataProductChangeTracker_t const &as) const
Returns whether we are in the same event (the rest could differ)
bool util::DataProductChangeTracker_t::sameEvent ( DataProductChangeTracker_t const &  as) const
inline

Returns whether we are in the same event (the rest could differ)

Definition at line 130 of file ChangeTrackers.h.

References util::EventChangeTracker_t::same().

131  {
132  return EventChangeTracker_t::same(as);
133  }
bool same(EventChangeTracker_t const &as) const
Returns whether this tracker is in the same state as another.
void util::EventChangeTracker_t::set ( art::EventID const &  evt_id)
inlineinherited

Sets the current event ID.

Definition at line 63 of file ChangeTrackers.h.

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

Referenced by 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)
inlineinherited

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
void util::DataProductChangeTracker_t::set ( art::Event const &  evt,
art::InputTag const &  label 
)
inline

Set a new event and data product label as current.

Definition at line 164 of file ChangeTrackers.h.

References util::EventChangeTracker_t::set().

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

165  {
167  SetInputLabel(label);
168  }
void set(art::EventID const &evt_id)
Sets the current event ID.
void SetInputLabel(art::InputTag const &label)
TCEvent evt
Definition: DataStructs.cxx:8
void util::DataProductChangeTracker_t::SetInputLabel ( art::InputTag const &  label)
inlineprivate
bool util::EventChangeTracker_t::update ( EventChangeTracker_t const &  trk)
inlineinherited

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

Definition at line 69 of file ChangeTrackers.h.

References util::EventChangeTracker_t::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.
bool util::DataProductChangeTracker_t::update ( DataProductChangeTracker_t const &  new_prod)
inline

Update to a new data product, return true if it has changed.

Definition at line 171 of file ChangeTrackers.h.

References util::EventChangeTracker_t::same().

Referenced by evd::TWQProjectionView::OnNewEvent().

172  {
173  if (same(new_prod)) return false;
174  *this = new_prod;
175  return true;
176  }
bool same(DataProductChangeTracker_t const &as) const
Returns whether we have same data product as in "as".

Member Data Documentation

LocalState_t util::DataProductChangeTracker_t::state
private

Definition at line 191 of file ChangeTrackers.h.


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