| 60 | } |
| 61 | } |
| 62 | void openhd::append_int_param(std::vector<Setting>& ret, const std::string& ID, |
| 63 | int value, const std::function<bool(int)>& cb) { |
| 64 | auto cb2 = [cb](std::string param_id, |
| 65 | int value) { // NOLINT(*-unnecessary-value-param) |
| 66 | const auto before = std::chrono::steady_clock::now(); |
| 67 | const bool ret = cb(value); |
| 68 | const auto delta = std::chrono::steady_clock::now() - before; |
| 69 | if (delta > std::chrono::seconds(1)) { |
| 70 | const auto duration_ms = |
| 71 | std::chrono::duration_cast<std::chrono::milliseconds>(delta).count(); |
| 72 | std::stringstream ss; |
| 73 | ss << "Changing " << param_id << " to " << value << " took " |
| 74 | << duration_ms << "ms"; |
| 75 | std::cerr << ss.str() << std::endl; |
| 76 | } |
| 77 | return ret; |
| 78 | }; |
| 79 | ret.push_back(Setting{ID, openhd::IntSetting{value, cb2}}); |
| 80 | } |
| 81 | |
| 82 | openhd::Setting openhd::create_read_only_string(const std::string& id, |
| 83 | std::string value) { |