mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-11-01 05:50:05 +00:00
Refactoring phenomena info to impact based warnings header
This commit is contained in:
parent
9182d170de
commit
829d8a3152
3 changed files with 44 additions and 31 deletions
|
|
@ -4,6 +4,7 @@
|
|||
#include <unordered_map>
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/unordered/unordered_flat_map.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
|
|
@ -12,6 +13,26 @@ namespace awips
|
|||
|
||||
static const std::string logPrefix_ = "scwx::awips::impact_based_warnings";
|
||||
|
||||
static const boost::unordered_flat_map<Phenomenon, PhenomenonInfo>
|
||||
phenomenaInfo_ {
|
||||
{Phenomenon::Marine, PhenomenonInfo {.hasTornadoPossibleTag_ {true}}},
|
||||
{Phenomenon::FlashFlood,
|
||||
PhenomenonInfo {.threatCategories_ {ThreatCategory::Base,
|
||||
ThreatCategory::Considerable,
|
||||
ThreatCategory::Catastrophic}}},
|
||||
{Phenomenon::SevereThunderstorm,
|
||||
PhenomenonInfo {.hasTornadoPossibleTag_ {true},
|
||||
.threatCategories_ {ThreatCategory::Base,
|
||||
ThreatCategory::Considerable,
|
||||
ThreatCategory::Destructive}}},
|
||||
{Phenomenon::SnowSquall, PhenomenonInfo {}},
|
||||
{Phenomenon::Tornado,
|
||||
PhenomenonInfo {.hasObservedTag_ {true},
|
||||
.threatCategories_ {ThreatCategory::Base,
|
||||
ThreatCategory::Considerable,
|
||||
ThreatCategory::Catastrophic}}},
|
||||
{Phenomenon::Unknown, PhenomenonInfo {}}};
|
||||
|
||||
static const std::unordered_map<ThreatCategory, std::string>
|
||||
threatCategoryName_ {{ThreatCategory::Base, "Base"},
|
||||
{ThreatCategory::Significant, "Significant"},
|
||||
|
|
@ -20,6 +41,16 @@ static const std::unordered_map<ThreatCategory, std::string>
|
|||
{ThreatCategory::Catastrophic, "Catastrophic"},
|
||||
{ThreatCategory::Unknown, "?"}};
|
||||
|
||||
const PhenomenonInfo& GetPhenomenonInfo(Phenomenon phenomenon)
|
||||
{
|
||||
auto it = phenomenaInfo_.find(phenomenon);
|
||||
if (it != phenomenaInfo_.cend())
|
||||
{
|
||||
return it->second;
|
||||
}
|
||||
return phenomenaInfo_.at(Phenomenon::Unknown);
|
||||
}
|
||||
|
||||
SCWX_GET_ENUM(ThreatCategory, GetThreatCategory, threatCategoryName_)
|
||||
|
||||
const std::string& GetThreatCategoryName(ThreatCategory threatCategory)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue