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 cliComm.updateHelper(type, motherBoard.getMachineID(), name, value);
24}
25
26void MSXCliComm::updateFiltered(UpdateType type, std::string_view name, std::string_view value)
27{
28 if (auto [it, inserted] = prevValues[type].try_emplace(name, value);
29 !inserted) { // was already present ..
30 if (it->second == value) {
31 return; // .. with the same value
32 } else {
33 it->second = value; // .. but with a different value
34 }
35 }
36 cliComm.updateHelper(type, motherBoard.getMachineID(), name, value);
37}
38
40{
41 suppressMessages = enable;
42}
43
44
45} // 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:26
void update(UpdateType type, std::string_view name, std::string_view value) override
Definition MSXCliComm.cc:21
void setSuppressMessages(bool enable)
Definition MSXCliComm.cc:39
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