openMSX
MSXCliComm.cc
Go to the documentation of this file.
1#include "MSXCliComm.hh"
2#include "GlobalCliComm.hh"
3#include "MSXMotherBoard.hh"
5
6namespace openmsx {
7
9 : motherBoard(motherBoard_)
10 , cliComm(cliComm_)
11{
12}
13
14void MSXCliComm::log(LogLevel level, std::string_view message, float fraction)
15{
16 if (!suppressMessages) {
17 cliComm.log(level, message, fraction);
18 }
19}
20
21void MSXCliComm::update(UpdateType type, std::string_view name, std::string_view value)
22{
23 assert(type < NUM_UPDATES);
24 cliComm.updateHelper(type, motherBoard.getMachineID(), name, value);
25}
26
27void MSXCliComm::updateFiltered(UpdateType type, std::string_view name, std::string_view value)
28{
29 assert(type < NUM_UPDATES);
30 if (auto [it, inserted] = prevValues[type].try_emplace(name, value);
31 !inserted) { // was already present ..
32 if (it->second == value) {
33 return; // .. with the same value
34 } else {
35 it->second = value; // .. but with a different value
36 }
37 }
38 cliComm.updateHelper(type, motherBoard.getMachineID(), name, value);
39}
40
42{
43 suppressMessages = enable;
44}
45
46
47} // namespace openmsx
void log(LogLevel level, std::string_view message, float fraction) override
Log a message with a certain priority level.
void updateFiltered(UpdateType type, std::string_view name, std::string_view value) override
Same as update(), but checks that the value for type-name is the same as in the previous call.
Definition MSXCliComm.cc:27
void update(UpdateType type, std::string_view name, std::string_view value) override
Definition MSXCliComm.cc:21
void setSuppressMessages(bool enable)
Definition MSXCliComm.cc:41
void log(LogLevel level, std::string_view message, float fraction) override
Log a message with a certain priority level.
Definition MSXCliComm.cc:14
MSXCliComm(MSXMotherBoard &motherBoard, GlobalCliComm &cliComm)
Definition MSXCliComm.cc:8
std::string_view getMachineID() const
This file implemented 3 utility functions:
Definition Autofire.cc:11