| static const std::unordered_map<std::string, Fru> supportedFrus = |
| {"ETHERNET", Fru::ETHERNET} |
| void write(const std::string& type, |
| // Get the enum corresponding to type, and call |
| // appropriate write FRU method. |
| std::transform(fru.begin(), fru.end(), fru.begin(), |
| [](unsigned char c) { return std::toupper(c); }); |
| auto iterator = supportedFrus.find(fru); |
| if (supportedFrus.end() == iterator) |
| throw std::runtime_error("Unsupported FRU: " + std::move(fru)); |
| switch (iterator->second) |
| writeFru<Fru::BMC>(vpdStore, path); |
| writeFru<Fru::ETHERNET>(vpdStore, path); |