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)
15{
16 if (!suppressMessages)
17 {
18 cliComm.log(level, message);
19 }
20}
21
22void MSXCliComm::update(UpdateType type, std::string_view name, std::string_view value)
23{
24 assert(type < NUM_UPDATES);
25 cliComm.updateHelper(type, motherBoard.getMachineID(), name, value);
26}
27
28void MSXCliComm::updateFiltered(UpdateType type, std::string_view name, std::string_view value)
29{
30 assert(type < NUM_UPDATES);
31 if (auto [it, inserted] = prevValues[type].try_emplace(name, value);
32 !inserted) { // was already present ..
33 if (it->second == value) {
34 return; // .. with the same value
35 } else {
36 it->second = value; // .. but with a different value
37 }
38 }
39 cliComm.updateHelper(type, motherBoard.getMachineID(), name, value);
40}
41
43{
44 suppressMessages = enable;
45}
46
47
48} // namespace openmsx
void log(LogLevel level, std::string_view message) override
void log(LogLevel level, std::string_view message) override
Definition: MSXCliComm.cc:14
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:28
void update(UpdateType type, std::string_view name, std::string_view value) override
Definition: MSXCliComm.cc:22
void setSuppressMessages(bool enable)
Definition: MSXCliComm.cc:42
MSXCliComm(MSXMotherBoard &motherBoard, GlobalCliComm &cliComm)
Definition: MSXCliComm.cc:8
std::string_view getMachineID() const
This file implemented 3 utility functions:
Definition: Autofire.cc:9