openMSX
Alarm.hh
Go to the documentation of this file.
1 #ifndef ALARM_HH
2 #define ALARM_HH
3 
4 #include "noncopyable.hh"
5 #include <cstdint>
6 
7 namespace openmsx {
8 
9 class AlarmManager;
10 
11 class Alarm : private noncopyable
12 {
13 public:
19  void schedule(unsigned period);
20 
24  void cancel();
25 
28  bool pending() const;
29 
30 protected:
31  Alarm();
32  virtual ~Alarm();
33 
39  void prepareDelete();
40 
41 private:
49  virtual bool alarm() = 0;
50 
51  AlarmManager& manager;
52  int64_t time;
53  unsigned period;
54  bool active;
55  bool destructing; // only for debugging
56 
57  friend class AlarmManager;
58 };
59 
60 } // namespace openmsx
61 
62 #endif
void cancel()
Cancel a previous schedule() request.
Definition: Alarm.cc:226
bool pending() const
Is there a pending alarm?
Definition: Alarm.cc:231
void prepareDelete()
Concrete subclasses MUST call this method in their destructor.
Definition: Alarm.cc:214
virtual ~Alarm()
Definition: Alarm.cc:209
void schedule(unsigned period)
Arrange for the alarm() method to be called after some time.
Definition: Alarm.cc:221
Based on boost::noncopyable, see boost documentation: http://www.boost.org/libs/utility.
Definition: noncopyable.hh:12