voxelTerrain
 All Classes Functions Variables Typedefs Enumerations Pages
updater.hpp
1 #ifndef BLUB_ASYNC_UPDATER_HPP
2 #define BLUB_ASYNC_UPDATER_HPP
3 
4 #include "blub/core/globals.hpp"
5 #include "blub/core/signal.hpp"
6 #include "blub/async/dispatcher.hpp"
7 
8 #include <boost/chrono/system_clocks.hpp>
9 
10 
11 namespace blub
12 {
13 namespace async
14 {
15 
16 
17  class updater : public dispatcher
18  {
19  public:
20  updater(const blub::string& threadName);
21  virtual ~updater();
22 
23  void stop();
24 
26  t_sigFrameListener* signalFrame();
27 
28  void run(const real &frames = 60.0, const bool &threaded = false); // change from frames to millis-wait
29 
30  protected:
31  bool runOneFrame(const real& delta);
32  void frame();
33 
34  private:
35  const blub::string m_threadName;
36 
37  t_sigFrameListener m_sigFrame;
38 
39  boost::thread *m_thread;
40  deadlineTimer *m_frameDeadline;
41 
42  boost::chrono::system_clock::time_point m_start;
43 
44  real m_frames;
45  bool m_stop;
46  };
47 
48 
49 }
50 }
51 
52 
53 #endif // BLUB_ASYNC_UPDATER_HPP
Definition: deadlineTimer.hpp:16
Definition: string.hpp:22
Definition: dispatcher.hpp:29
Definition: updater.hpp:17
Definition: deadlineTimer.hpp:10