The Gaudi Framework  v29r0 (ff2e7097)
EventSchedulingState.h
Go to the documentation of this file.
1 #ifndef GAUDIHIVE_EVENTSCHEDULINGSTATE_H
2 #define GAUDIHIVE_EVENTSCHEDULINGSTATE_H
3 
4 #include "boost/dynamic_bitset.hpp"
5 #include "tbb/concurrent_vector.h"
6 
7 #include <atomic>
8 
9 // typedef for the event and algo state
10 typedef boost::dynamic_bitset<> state_type;
11 
13 {
14 public:
15  EventSchedulingState( const unsigned int& n_algos, const unsigned int& n_products );
17 
18  void algoFinished();
19  void algoStarts( unsigned int& index );
20  bool hasStarted( unsigned int& index ) const;
21  bool hasFinished() const { return ( m_algosFinished == m_numberOfAlgos ); }
22  const state_type& state() const { return m_eventState; }
23  void update_state( unsigned int& product_index );
24 
25 private:
27  std::atomic_uint m_algosInFlight;
29  std::atomic_uint m_algosFinished;
31  unsigned int m_numberOfAlgos;
35  tbb::concurrent_vector<bool> m_algosStarted;
36 };
37 
38 #endif // GAUDIHIVE_EVENTSCHEDULINGSTATE_H
void update_state(unsigned int &product_index)
void algoStarts(unsigned int &index)
unsigned int m_numberOfAlgos
Total number of algos.
std::atomic_uint m_algosInFlight
Number of algos in flight.
bool hasStarted(unsigned int &index) const
tbb::concurrent_vector< bool > m_algosStarted
Register of algorithms started.
const state_type & state() const
boost::dynamic_bitset state_type
std::atomic_uint m_algosFinished
Number of finished algos.
state_type m_eventState
Event state recording which products are there.
EventSchedulingState(const unsigned int &n_algos, const unsigned int &n_products)