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() = default; // 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 };
40 
41 } // namespace openmsx
42 
43 #endif
openmsx::StateChange
Base class for all external MSX state changing events.
Definition: StateChange.hh:14
serialize_meta.hh
openmsx::REGISTER_BASE_CLASS
REGISTER_BASE_CLASS(Connector, "Connector")
openmsx::StateChange::serialize
void serialize(Archive &ar, unsigned)
Definition: StateChange.hh:24
openmsx::StateChange::StateChange
StateChange(EmuTime::param time_)
Definition: StateChange.hh:31
openmsx::StateChange::~StateChange
virtual ~StateChange()=default
EmuTime.hh
openmsx::StateChange::StateChange
StateChange()
Definition: StateChange.hh:30
openmsx
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5
openmsx::StateChange::getTime
EmuTime::param getTime() const
Definition: StateChange.hh:18