mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-22 22:00:39 -06:00
Common/Analytics: add basic support for vector serialization
Only supports u32 for now since that's the only thing we need.
This commit is contained in:
@ -95,6 +95,15 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
AnalyticsReportBuilder& AddData(const std::string& key, const std::vector<T>& value)
|
||||
{
|
||||
std::lock_guard<std::mutex> lk(m_lock);
|
||||
AppendSerializedValue(&m_report, key);
|
||||
AppendSerializedValueVector(&m_report, value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
std::string Get() const
|
||||
{
|
||||
std::lock_guard<std::mutex> lk(m_lock);
|
||||
@ -118,6 +127,8 @@ protected:
|
||||
static void AppendSerializedValue(std::string* report, s32 v);
|
||||
static void AppendSerializedValue(std::string* report, float v);
|
||||
|
||||
static void AppendSerializedValueVector(std::string* report, const std::vector<u32>& v);
|
||||
|
||||
// Should really be a std::shared_mutex, unfortunately that's C++17 only.
|
||||
mutable std::mutex m_lock;
|
||||
std::string m_report;
|
||||
|
Reference in New Issue
Block a user