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#include <concepts>
8#include <vector>
9
10namespace openmsx {
11
12class Reactor;
13class EventDistributor;
14class CommandController;
15
16class AfterCommand final : public Command, private EventListener
17{
18public:
19 using Index = uint32_t; // ObjectPool<T>::Index
20
21public:
22 AfterCommand(Reactor& reactor,
23 EventDistributor& eventDistributor,
24 CommandController& commandController);
26
27 void execute(std::span<const TclObject> tokens, TclObject& result) override;
28 [[nodiscard]] std::string help(std::span<const TclObject> tokens) const override;
29 void tabCompletion(std::vector<std::string>& tokens) const override;
30
31private:
32 void executeMatches(std::predicate<Index> auto pred);
33 void executeSimpleEvents(EventType type);
34 void afterSimpleEvent(std::span<const TclObject> tokens, TclObject& result, EventType type);
35 void afterInputEvent(const Event& event,
36 std::span<const TclObject> tokens, TclObject& result);
37 void afterTclTime (int ms,
38 std::span<const TclObject> tokens, TclObject& result);
39 void afterTime (std::span<const TclObject> tokens, TclObject& result);
40 void afterRealTime(std::span<const TclObject> tokens, TclObject& result);
41 void afterIdle (std::span<const TclObject> tokens, TclObject& result);
42 void afterInfo (std::span<const TclObject> tokens, TclObject& result);
43 void afterCancel (std::span<const TclObject> tokens, TclObject& result);
44
45 // EventListener
46 int signalEvent(const Event& event) override;
47
48private:
49 std::vector<Index> afterCmds;
50 Reactor& reactor;
51 EventDistributor& eventDistributor;
52
53 friend class AfterCmd;
54 friend class AfterTimedCmd;
55 friend class AfterRealTimeCmd;
56};
57
58} // namespace openmsx
59
60#endif
AfterCommand(Reactor &reactor, EventDistributor &eventDistributor, CommandController &commandController)
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:68
This file implemented 3 utility functions:
Definition: Autofire.cc:9
EventType
Definition: Event.hh:508