6#include "FireWeather.h"
12string simplify_fuel_name(
const string_view fuel);
57 [[nodiscard]] set<const FuelType*>
usedFuels()
const;
63 [[nodiscard]]
const FuelType*
byName(
const string_view name)
const;
73 static const array<const FuelType*, NUMBER_OF_FUELS>
Fuels;
79 shared_ptr<FuelLookupImpl>
impl_{
nullptr};
86[[nodiscard]]
constexpr const FuelType* fuel_by_code(
const FuelCodeSize& code)
95[[nodiscard]]
constexpr const FuelType* check_fuel(
const Cell& cell)
97 return fuel_by_code(cell.fuelCode());
104[[nodiscard]]
constexpr bool is_null_fuel(
const FuelType* fuel)
113[[nodiscard]]
constexpr bool is_null_fuel(
const Cell& cell)
115 return is_null_fuel(fuel_by_code(cell.fuelCode()));
120 using LazyPath::LazyPath;
124 if (
nullptr == fuel_lookup_)
126 fuel_lookup_ = std::make_unique<FuelLookup>(canonical());
127 logging::check_fatal(
nullptr == fuel_lookup_,
"Fuel lookup table has not been loaded");
129 return *fuel_lookup_;
133 LazyPath::operator=(rhs);
134 fuel_lookup_ =
nullptr;
139 LazyPath::operator=(rhs);
140 fuel_lookup_ = std::move(rhs.fuel_lookup_);
141 rhs.fuel_lookup_ =
nullptr;
146 LazyPath::operator=(path);
147 fuel_lookup_ =
nullptr;
152 mutable unique_ptr<FuelLookup> fuel_lookup_{
nullptr};
Provides ability to look up a fuel type based on name or code.
Definition FuelLookup.h:17
const FuelType * byName(const string_view name) const
Look up a FuelType based on the given name.
Definition FuelLookup.cpp:642
FuelLookup(const char *filename)
Construct by reading from a file.
Definition FuelLookup.cpp:647
FuelSize fuelToCode(const FuelType *fuel) const
Look up the original code for the given FuelType.
Definition FuelLookup.cpp:633
const FuelType * operator()(FuelSize value, FuelSize nodata) const
Look up a FuelType ba1ed on the given code.
Definition FuelLookup.cpp:637
static const array< const FuelType *, NUMBER_OF_FUELS > Fuels
Array of all FuelTypes available to be used in simulations.
Definition FuelLookup.h:73
const FuelType * codeToFuel(FuelSize value, FuelSize nodata) const
Look up a FuelType based on the given code.
Definition FuelLookup.cpp:628
set< const FuelType * > usedFuels() const
Retrieve set of FuelTypes that are used in the lookup table.
Definition FuelLookup.cpp:641
const FuelType * bySimplifiedName(const string_view name) const
Look up a FuelType based on the given simplified name.
Definition FuelLookup.cpp:643
shared_ptr< FuelLookupImpl > impl_
Implementation class for FuelLookup.
Definition FuelLookup.h:79
void listFuels() const
List all fuels and their codes.
Definition FuelLookup.cpp:632
An FBP fuel type.
Definition FuelType.h:42
static constexpr FuelCodeSize safeCode(const FuelType *fuel)
Convert FuelType to its code, or 0 if nullptr.
Definition FuelType.h:53
Definition FuelLookup.h:118