8 #ifndef UTIL_CHANGETRACKERS_H 9 #define UTIL_CHANGETRACKERS_H 18 #include <type_traits> 53 {
return !
same(than); }
70 if (
same(trk))
return false;
100 template <
typename Stream>
101 decltype(
auto) operator<<
103 { out << std::string(trk); return std::forward<Stream>(out); }
143 {
return sameEvent(as) && (inputLabel() == as.
inputLabel()); }
158 {
return !
same(than); }
175 if (
same(new_prod))
return false;
185 return EventChangeTracker_t::operator
std::string()
186 +
" I{" + inputLabel().encode() +
"}";
202 template <
typename Stream>
203 decltype(
auto)
operator<<
205 { out << std::string(trk); return std::forward<Stream>(out); }
210 #endif // UTIL_CHANGETRACKERS_H EventChangeTracker_t(art::Event const &evt)
Constructor: current event as specified.
void set(art::EventID const &evt_id)
Sets the current event ID.
art::EventID event_id
ID of the current event.
bool isValid() const
Returns whether there is a current event.
Namespace for general, non-LArSoft-specific utilities.
art::EventID const & eventID() const
Returns the current event ID (it might be made public...)
Detects the presence of a new event or data product.
Detects the presence of a new event.
art::InputTag const & inputLabel() const
static constexpr double as
bool update(EventChangeTracker_t const &trk)
Sets the current event, and returns true if it is changed.
void SetInputLabel(art::InputTag const &label)
bool operator!=(EventChangeTracker_t const &than) const
Returns whether this tracker is in a different state than another.
EventChangeTracker_t()=default
Default constructor: no current event, next event is a new one.
art::InputTag input_label
LocalState_t state
local state of the tracker (may inherit some more)
EventChangeTracker_t(art::EventID const &evt_id)
Constructor: current event as specified by the event ID.
bool same(EventChangeTracker_t const &as) const
bool same(DataProductChangeTracker_t const &as) const
Returns whether we have same data product as in "as".
bool update(DataProductChangeTracker_t const &new_prod)
Update to a new data product, return true if it has changed.
std::string to_string(ModuleType const mt)
bool isValid() const
Returns whether there is a current event and data product.
bool sameEvent(DataProductChangeTracker_t const &as) const
Returns whether we are in the same event (the rest could differ)
bool operator==(EventChangeTracker_t const &as) const
Returns whether this tracker is in the same state as another.