All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
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
 
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 ()
 
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)
 
- Private Member Functions inherited from util::EventChangeTracker_t
 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...
 
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...
 
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...
 
art::EventID const & eventID () const
 Returns the current event ID (it might be made public...) 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 116 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 124 of file ChangeTrackers.h.

124  :
126  {}
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 130 of file ChangeTrackers.h.

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

Member Function Documentation

void util::DataProductChangeTracker_t::clear ( )
inline

Definition at line 168 of file ChangeTrackers.h.

169  { EventChangeTracker_t::clear(); SetInputLabel(art::InputTag()); }
void SetInputLabel(art::InputTag const &label)
art::InputTag const& util::DataProductChangeTracker_t::inputLabel ( ) const
inline

Definition at line 138 of file ChangeTrackers.h.

bool util::DataProductChangeTracker_t::isValid ( ) const
inline

Returns whether there is a current event and data product.

Definition at line 149 of file ChangeTrackers.h.

150  {
151  return
152  EventChangeTracker_t::isValid() && !inputLabel().label().empty();
153  }
bool isValid() const
Returns whether there is a current event.
art::InputTag const & inputLabel() const
util::DataProductChangeTracker_t::operator std::string ( ) const
inline

Returns a string representation of event and data product label.

Definition at line 186 of file ChangeTrackers.h.

187  {
188  return EventChangeTracker_t::operator std::string()
189  + " I{" + inputLabel().encode() + "}";
190  }
art::InputTag const & inputLabel() const
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 160 of file ChangeTrackers.h.

161  { return !same(than); }
bool same(DataProductChangeTracker_t const &as) const
Returns whether we have same data product as in &quot;as&quot;.
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 156 of file ChangeTrackers.h.

157  { return same(as); }
bool same(DataProductChangeTracker_t const &as) const
Returns whether we have same data product as in &quot;as&quot;.
bool util::DataProductChangeTracker_t::same ( DataProductChangeTracker_t const &  as) const
inline

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

Definition at line 145 of file ChangeTrackers.h.

146  { return sameEvent(as) && (inputLabel() == as.inputLabel()); }
art::InputTag const & inputLabel() const
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 141 of file ChangeTrackers.h.

142  { return EventChangeTracker_t::same(as); }
bool same(EventChangeTracker_t const &as) const
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 172 of file ChangeTrackers.h.

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

Definition at line 199 of file ChangeTrackers.h.

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 176 of file ChangeTrackers.h.

177  {
178  if (same(new_prod)) return false;
179  *this = new_prod;
180  return true;
181  }
bool same(DataProductChangeTracker_t const &as) const
Returns whether we have same data product as in &quot;as&quot;.

Member Data Documentation

LocalState_t util::DataProductChangeTracker_t::state
private

Definition at line 197 of file ChangeTrackers.h.


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