2020-03-16 10:32:23 +00:00
|
|
|
#include <Common/StatusInfo.h>
|
2021-04-21 13:45:13 +00:00
|
|
|
#include <Common/ExternalLoaderStatus.h>
|
2020-03-11 15:30:02 +00:00
|
|
|
|
|
|
|
/// Available status. Add something here as you wish.
|
|
|
|
#define APPLY_FOR_STATUS(M) \
|
2020-03-16 13:35:22 +00:00
|
|
|
M(DictionaryStatus, "Dictionary Status.", DB::getStatusEnumAllPossibleValues()) \
|
2020-03-11 15:30:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
namespace CurrentStatusInfo
|
|
|
|
{
|
2023-04-01 09:55:31 +00:00
|
|
|
#define M(NAME, DOCUMENTATION, ENUM) extern const Status NAME = Status(__COUNTER__);
|
2020-03-11 15:30:02 +00:00
|
|
|
APPLY_FOR_STATUS(M)
|
|
|
|
#undef M
|
2023-04-01 09:55:31 +00:00
|
|
|
constexpr Status END = Status(__COUNTER__);
|
2020-03-11 15:30:02 +00:00
|
|
|
|
|
|
|
std::mutex locks[END] {};
|
2020-03-12 12:09:15 +00:00
|
|
|
std::unordered_map<String, Int8> values[END] {};
|
2020-03-11 15:30:02 +00:00
|
|
|
|
2020-03-12 12:29:28 +00:00
|
|
|
const char * getName(Status event)
|
2020-03-11 15:30:02 +00:00
|
|
|
{
|
|
|
|
static const char * strings[] =
|
|
|
|
{
|
|
|
|
#define M(NAME, DOCUMENTATION, ENUM) #NAME,
|
|
|
|
APPLY_FOR_STATUS(M)
|
|
|
|
#undef M
|
|
|
|
};
|
|
|
|
|
|
|
|
return strings[event];
|
|
|
|
}
|
|
|
|
|
2020-03-12 12:29:28 +00:00
|
|
|
const char * getDocumentation(Status event)
|
2020-03-11 15:30:02 +00:00
|
|
|
{
|
|
|
|
static const char * strings[] =
|
|
|
|
{
|
2020-03-16 12:40:34 +00:00
|
|
|
#define M(NAME, DOCUMENTATION, ENUM) #DOCUMENTATION,
|
2020-03-11 15:30:02 +00:00
|
|
|
APPLY_FOR_STATUS(M)
|
|
|
|
#undef M
|
|
|
|
};
|
|
|
|
|
|
|
|
return strings[event];
|
|
|
|
}
|
|
|
|
|
2020-03-12 12:29:28 +00:00
|
|
|
const std::vector<std::pair<String, Int8>> & getAllPossibleValues(Status event)
|
2020-03-11 15:30:02 +00:00
|
|
|
{
|
|
|
|
static const std::vector<std::pair<String, Int8>> enum_values [] =
|
|
|
|
{
|
2020-03-16 13:35:22 +00:00
|
|
|
#define M(NAME, DOCUMENTATION, ENUM) ENUM,
|
2020-03-11 15:30:02 +00:00
|
|
|
APPLY_FOR_STATUS(M)
|
|
|
|
#undef M
|
|
|
|
};
|
|
|
|
return enum_values[event];
|
|
|
|
}
|
|
|
|
|
2020-03-12 12:29:28 +00:00
|
|
|
Status end() { return END; }
|
2020-03-11 15:30:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#undef APPLY_FOR_STATUS
|