EventSchedulingState.h
Go to the documentation of this file.
1 #ifndef GAUDIHIVE_EVENTSCHEDULINGSTATE_H
2 #define GAUDIHIVE_EVENTSCHEDULINGSTATE_H
3 
4 
5 #include "tbb/concurrent_vector.h"
6 #include "boost/dynamic_bitset.hpp"
7 
8 #include <atomic>
9 
10 // typedef for the event and algo state
11 typedef boost::dynamic_bitset<> state_type;
12 
13 
15  public:
16  EventSchedulingState(const unsigned int& n_algos,const unsigned int& n_products);
18 
19  void algoFinished();
20  void algoStarts(unsigned int& index);
21  bool hasStarted(unsigned int& index) const;
22  bool hasFinished() const {return (m_algosFinished == m_numberOfAlgos);}
23  const state_type& state() const {return m_eventState;}
24  void update_state(unsigned int& product_index);
25 
26  private:
28  std::atomic_uint m_algosInFlight;
30  std::atomic_uint m_algosFinished;
32  unsigned int m_numberOfAlgos;
36  tbb::concurrent_vector<bool> m_algosStarted;
37 };
38 
39 
40 #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)