Give mvt_value and serial_val a double-with-count concept

This commit is contained in:
Erica Fischer
2025-01-30 11:58:10 -08:00
parent b9b48f42c9
commit 9c299ba653
2 changed files with 28 additions and 1 deletions
+14
View File
@@ -70,6 +70,20 @@ struct serial_val {
type = mvt_string;
s = val;
}
size_t get_count() const {
size_t found = s.find('\0');
if (found == std::string::npos) {
return 0;
} else {
return atoll(s.c_str() + found + 1);
}
}
void set_double_accum(double v, size_t c) {
type = mvt_double;
s = milo::dtoa_milo(v) + '\0' + std::to_string(c);
}
};
struct key_pool {