Renaming PhenomenonInfo to ImpactBasedWarningInfo

This commit is contained in:
Dan Paulat 2024-09-16 21:05:07 -05:00
parent 829d8a3152
commit 38a2831779
3 changed files with 31 additions and 26 deletions

View file

@ -20,14 +20,14 @@ enum class ThreatCategory : int
Unknown
};
struct PhenomenonInfo
struct ImpactBasedWarningInfo
{
bool hasObservedTag_ {false};
bool hasTornadoPossibleTag_ {false};
std::vector<ThreatCategory> threatCategories_ {ThreatCategory::Base};
};
const PhenomenonInfo& GetPhenomenonInfo(Phenomenon phenomenon);
const ImpactBasedWarningInfo& GetImpactBasedWarningInfo(Phenomenon phenomenon);
ThreatCategory GetThreatCategory(const std::string& name);
const std::string& GetThreatCategoryName(ThreatCategory threatCategory);

View file

@ -13,25 +13,29 @@ 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}}},
static const boost::unordered_flat_map<Phenomenon, ImpactBasedWarningInfo>
impactBasedWarningInfo_ {
{Phenomenon::Marine,
ImpactBasedWarningInfo {.hasTornadoPossibleTag_ {true}}},
{Phenomenon::FlashFlood,
PhenomenonInfo {.threatCategories_ {ThreatCategory::Base,
ThreatCategory::Considerable,
ThreatCategory::Catastrophic}}},
ImpactBasedWarningInfo {
.threatCategories_ {ThreatCategory::Base,
ThreatCategory::Considerable,
ThreatCategory::Catastrophic}}},
{Phenomenon::SevereThunderstorm,
PhenomenonInfo {.hasTornadoPossibleTag_ {true},
.threatCategories_ {ThreatCategory::Base,
ThreatCategory::Considerable,
ThreatCategory::Destructive}}},
{Phenomenon::SnowSquall, PhenomenonInfo {}},
ImpactBasedWarningInfo {
.hasTornadoPossibleTag_ {true},
.threatCategories_ {ThreatCategory::Base,
ThreatCategory::Considerable,
ThreatCategory::Destructive}}},
{Phenomenon::SnowSquall, ImpactBasedWarningInfo {}},
{Phenomenon::Tornado,
PhenomenonInfo {.hasObservedTag_ {true},
.threatCategories_ {ThreatCategory::Base,
ThreatCategory::Considerable,
ThreatCategory::Catastrophic}}},
{Phenomenon::Unknown, PhenomenonInfo {}}};
ImpactBasedWarningInfo {
.hasObservedTag_ {true},
.threatCategories_ {ThreatCategory::Base,
ThreatCategory::Considerable,
ThreatCategory::Catastrophic}}},
{Phenomenon::Unknown, ImpactBasedWarningInfo {}}};
static const std::unordered_map<ThreatCategory, std::string>
threatCategoryName_ {{ThreatCategory::Base, "Base"},
@ -41,14 +45,14 @@ static const std::unordered_map<ThreatCategory, std::string>
{ThreatCategory::Catastrophic, "Catastrophic"},
{ThreatCategory::Unknown, "?"}};
const PhenomenonInfo& GetPhenomenonInfo(Phenomenon phenomenon)
const ImpactBasedWarningInfo& GetImpactBasedWarningInfo(Phenomenon phenomenon)
{
auto it = phenomenaInfo_.find(phenomenon);
if (it != phenomenaInfo_.cend())
auto it = impactBasedWarningInfo_.find(phenomenon);
if (it != impactBasedWarningInfo_.cend())
{
return it->second;
}
return phenomenaInfo_.at(Phenomenon::Unknown);
return impactBasedWarningInfo_.at(Phenomenon::Unknown);
}
SCWX_GET_ENUM(ThreatCategory, GetThreatCategory, threatCategoryName_)