openMSX
MSXCliComm.cc
Go to the documentation of this file.
1 #include "MSXCliComm.hh"
2 #include "GlobalCliComm.hh"
3 #include "MSXMotherBoard.hh"
4 
5 namespace openmsx {
6 
8  : motherBoard(motherBoard_)
9  , cliComm(cliComm_)
10 {
11 }
12 
13 void MSXCliComm::log(LogLevel level, std::string_view message)
14 {
15  cliComm.log(level, message);
16 }
17 
18 void MSXCliComm::update(UpdateType type, std::string_view name, std::string_view value)
19 {
20  assert(type < NUM_UPDATES);
21  if (auto [it, inserted] = prevValues[type].try_emplace(name, value);
22  !inserted) { // was already present ..
23  if (it->second == value) {
24  return; // .. with the same value
25  } else {
26  it->second = value; // .. but with a different value
27  }
28  }
29  cliComm.updateHelper(type, motherBoard.getMachineID(), name, value);
30 }
31 
32 } // namespace openmsx
void log(LogLevel level, std::string_view message) override
void log(LogLevel level, std::string_view message) override
Definition: MSXCliComm.cc:13
void update(UpdateType type, std::string_view name, std::string_view value) override
Definition: MSXCliComm.cc:18
MSXCliComm(MSXMotherBoard &motherBoard, GlobalCliComm &cliComm)
Definition: MSXCliComm.cc:7
std::string_view getMachineID() const
This file implemented 3 utility functions:
Definition: Autofire.cc:9