openMSX
AfterCommand.hh
Go to the documentation of this file.
1#ifndef AFTERCOMMAND_HH
2#define AFTERCOMMAND_HH
3
4#include "Command.hh"
5#include "EventListener.hh"
6#include "Event.hh"
7
8#include <concepts>
9#include <vector>
10
11namespace openmsx {
12
13class Reactor;
14class EventDistributor;
15class CommandController;
16
17class AfterCommand final : public Command, private EventListener
18{
19public:
20 using Index = uint32_t; // ObjectPool<T>::Index
21
22public:
23 AfterCommand(Reactor& reactor,
24 EventDistributor& eventDistributor,
25 CommandController& commandController);
27
28 void execute(std::span<const TclObject> tokens, TclObject& result) override;
29 [[nodiscard]] std::string help(std::span<const TclObject> tokens) const override;
30 void tabCompletion(std::vector<std::string>& tokens) const override;
31
32private:
33 void executeMatches(std::predicate<Index> auto pred);
34 void executeSimpleEvents(EventType type);
35 void afterSimpleEvent(std::span<const TclObject> tokens, TclObject& result, EventType type);
36 void afterInputEvent(Event event,
37 std::span<const TclObject> tokens, TclObject& result);
38 void afterTclTime (int ms,
39 std::span<const TclObject> tokens, TclObject& result);
40 void afterTime (std::span<const TclObject> tokens, TclObject& result);
41 void afterRealTime(std::span<const TclObject> tokens, TclObject& result);
42 void afterIdle (std::span<const TclObject> tokens, TclObject& result);
43 void afterInfo (std::span<const TclObject> tokens, TclObject& result) const;
44 void afterCancel (std::span<const TclObject> tokens, TclObject& result);
45
46 // EventListener
47 bool signalEvent(const Event& event) override;
48
49private:
50 std::vector<Index> afterCmds;
51 Reactor& reactor;
52 EventDistributor& eventDistributor;
53
54 friend class AfterCmd;
55 friend class AfterTimedCmd;
56 friend class AfterRealTimeCmd;
57};
58
59} // namespace openmsx
60
61#endif
void execute(std::span< const TclObject > tokens, TclObject &result) override
Execute this command.
std::string help(std::span< const TclObject > tokens) const override
Print help for this command.
void tabCompletion(std::vector< std::string > &tokens) const override
Attempt tab completion for this command.
Contains the main loop of openMSX.
Definition Reactor.hh:75
This file implemented 3 utility functions:
Definition Autofire.cc:11
EventType
Definition Event.hh:454
std::variant< KeyUpEvent, KeyDownEvent, MouseMotionEvent, MouseButtonUpEvent, MouseButtonDownEvent, MouseWheelEvent, JoystickAxisMotionEvent, JoystickHatEvent, JoystickButtonUpEvent, JoystickButtonDownEvent, OsdControlReleaseEvent, OsdControlPressEvent, WindowEvent, TextEvent, FileDropEvent, QuitEvent, FinishFrameEvent, CliCommandEvent, GroupEvent, BootEvent, FrameDrawnEvent, BreakEvent, SwitchRendererEvent, TakeReverseSnapshotEvent, AfterTimedEvent, MachineLoadedEvent, MachineActivatedEvent, MachineDeactivatedEvent, MidiInReaderEvent, MidiInWindowsEvent, MidiInCoreMidiEvent, MidiInCoreMidiVirtualEvent, MidiInALSAEvent, Rs232TesterEvent, Rs232NetEvent, ImGuiDelayedActionEvent, ImGuiActiveEvent > Event
Definition Event.hh:445