mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-28 19:58:53 +00: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:
parent
64e04eb38c
commit
d98c0da41b
2 changed files with 31 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue