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, string_view message)
14 {
15  cliComm.log(level, message);
16 }
17 
19 {
20  assert(type < NUM_UPDATES);
21  if (auto v = lookup(prevValues[type], name)) {
22  if (*v == value) {
23  return;
24  }
25  *v = value.str();
26  } else {
27  prevValues[type].emplace_noDuplicateCheck(name.str(), value.str());
28  }
29  cliComm.updateHelper(type, motherBoard.getMachineID(), name, value);
30 }
31 
32 } // namespace openmsx
void log(LogLevel level, string_view message) override
const Value * lookup(const hash_map< Key, Value, Hasher, Equal > &map, const Key2 &key)
Definition: hash_map.hh:91
void update(UpdateType type, string_view name, string_view value) override
Definition: MSXCliComm.cc:18
void log(LogLevel level, string_view message) override
Definition: MSXCliComm.cc:13
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5
MSXCliComm(MSXMotherBoard &motherBoard, GlobalCliComm &cliComm)
Definition: MSXCliComm.cc:7
This class implements a (close approximation) of the std::string_view class.
Definition: string_view.hh:16
std::string str() const
Definition: string_view.cc:12
iterator emplace_noDuplicateCheck(Args &&... args)
Definition: hash_set.hh:487
string_view getMachineID() const