blob: 91e6d4d3b8504194aa9ee3f648cb8240ca682463 (
plain) (
blame)
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
|
#pragma once
#include <stddef.h>
#include <cstdint>
#include <utility>
#include <atomic>
#include <vector>
#include <base/types.h>
#include <base/strong_typedef.h>
#include <mutex>
#include <unordered_map>
namespace CurrentStatusInfo
{
using Status = StrongTypedef<size_t, struct StatusTag>;
using Key = std::string;
const char * getName(Status event);
const char * getDocumentation(Status event);
const std::vector<std::pair<String, Int8>> & getAllPossibleValues(Status event);
extern std::unordered_map<String, Int8> values[];
extern std::mutex locks[];
Status end();
inline void set(Status status, Key key, Int8 value)
{
std::lock_guard lock(locks[status]);
values[status][key] = value;
}
inline void unset(Status status, Key key)
{
std::lock_guard lock(locks[status]);
values[status].erase(key);
}
}
|