openMSX
FinishFrameEvent.hh
Go to the documentation of this file.
1 #ifndef FINISHFRAMEEVENT_HH
2 #define FINISHFRAMEEVENT_HH
3 
4 #include "Event.hh"
5 #include "TclObject.hh"
6 #include "checked_cast.hh"
7 #include <tuple>
8 
9 namespace openmsx {
10 
22 class FinishFrameEvent final : public Event
23 {
24 public:
25  FinishFrameEvent(int thisSource_, int selectedSource_,
26  bool skipped_)
28  , thisSource(thisSource_), selectedSource(selectedSource_)
29  , skipped(skipped_)
30  {
31  }
32 
33  int getSource() const { return thisSource; }
34  int getSelectedSource() const { return selectedSource; }
35  bool isSkipped() const { return skipped; }
36  bool needRender() const { return !skipped && (thisSource == selectedSource); }
37 
38  TclObject toTclList() const override
39  {
40  return makeTclList("finishframe",
41  int(thisSource),
42  int(selectedSource),
43  skipped);
44  }
45  bool lessImpl(const Event& other) const override
46  {
47  auto& e = checked_cast<const FinishFrameEvent&>(other);
48  return std::tuple( getSource(), getSelectedSource(), isSkipped()) <
49  std::tuple(e.getSource(), e.getSelectedSource(), e.isSkipped());
50  }
51 
52 private:
53  const int thisSource;
54  const int selectedSource;
55  const bool skipped;
56 };
57 
58 } // namespace openmsx
59 
60 #endif
openmsx::Event
Definition: Event.hh:84
openmsx::FinishFrameEvent::needRender
bool needRender() const
Definition: FinishFrameEvent.hh:36
TclObject.hh
openmsx::FinishFrameEvent::getSource
int getSource() const
Definition: FinishFrameEvent.hh:33
openmsx::FinishFrameEvent::FinishFrameEvent
FinishFrameEvent(int thisSource_, int selectedSource_, bool skipped_)
Definition: FinishFrameEvent.hh:25
openmsx::FinishFrameEvent
This event is send when a device (v99x8, v9990, video9000, laserdisc) reaches the end of a frame.
Definition: FinishFrameEvent.hh:23
openmsx::FinishFrameEvent::lessImpl
bool lessImpl(const Event &other) const override
Definition: FinishFrameEvent.hh:45
checked_cast.hh
openmsx::FinishFrameEvent::isSkipped
bool isSkipped() const
Definition: FinishFrameEvent.hh:35
openmsx::makeTclList
TclObject makeTclList(Args &&... args)
Definition: TclObject.hh:280
Event.hh
openmsx::TclObject
Definition: TclObject.hh:22
openmsx::FinishFrameEvent::toTclList
TclObject toTclList() const override
Similar to toString(), but retains the structure of the event.
Definition: FinishFrameEvent.hh:38
openmsx::FinishFrameEvent::getSelectedSource
int getSelectedSource() const
Definition: FinishFrameEvent.hh:34
openmsx::OPENMSX_FINISH_FRAME_EVENT
@ OPENMSX_FINISH_FRAME_EVENT
Sent when VDP (V99x8 or V9990) reaches the end of a frame.
Definition: Event.hh:39
openmsx
This file implemented 3 utility functions:
Definition: Autofire.cc:5