openMSX
StateChange.hh
Go to the documentation of this file.
1 #ifndef STATECHANGE_HH
2 #define STATECHANGE_HH
3 
4 #include "EmuTime.hh"
5 #include "serialize_meta.hh"
6 
7 namespace openmsx {
8 
14 {
15 public:
16  virtual ~StateChange() {} // must be polymorhpic
17 
18  EmuTime::param getTime() const
19  {
20  return time;
21  }
22 
23  template<typename Archive>
24  void serialize(Archive& ar, unsigned /*version*/)
25  {
26  ar.serialize("time", time);
27  }
28 
29 protected:
30  StateChange() : time(EmuTime::zero) {} // for serialize
31  explicit StateChange(EmuTime::param time_)
32  : time(time_)
33  {
34  }
35 
36 private:
37  EmuTime time;
38 };
39 REGISTER_BASE_CLASS(StateChange, "StateChange");
40 
41 } // namespace openmsx
42 
43 #endif
REGISTER_BASE_CLASS(Connector, "Connector")
EmuTime::param getTime() const
Definition: StateChange.hh:18
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5
Base class for all external MSX state changing events.
Definition: StateChange.hh:13
void serialize(Archive &ar, unsigned)
Definition: StateChange.hh:24
StateChange(EmuTime::param time_)
Definition: StateChange.hh:31
virtual ~StateChange()
Definition: StateChange.hh:16