-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathmeter_id.h
More file actions
42 lines (30 loc) · 1.08 KB
/
meter_id.h
File metadata and controls
42 lines (30 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#pragma once
#include <string>
#include <map>
#include <regex>
#include <functional>
#include <unordered_map>
namespace spectator {
class MeterId
{
public:
MeterId(const std::string& name, const std::unordered_map<std::string, std::string>& tags = {});
const std::string& GetName() const noexcept { return m_name; };
const std::string& GetSpectatordId() const noexcept { return m_spectatord_id; }
const std::unordered_map<std::string, std::string>& GetTags() const noexcept { return m_tags; };
MeterId WithTag(const std::string& key, const std::string& value) const;
MeterId WithTags(const std::unordered_map<std::string, std::string>& additional_tags) const;
MeterId WithStat(const std::string& stat) const;
bool operator==(const MeterId& other) const;
std::string to_string() const;
private:
std::string m_name;
std::unordered_map<std::string, std::string> m_tags;
std::string m_spectatord_id;
};
} // namespace spectator
template <>
struct std::hash<spectator::MeterId>
{
size_t operator()(const spectator::MeterId& id) const;
};