1
0
mirror of https://github.com/TomHarte/CLK.git synced 2026-04-21 17:16:44 +00:00

Reduce type redundancy.

This commit is contained in:
Thomas Harte
2025-09-04 17:29:34 -04:00
parent 8cad5ac7e9
commit 53057aff5d
2 changed files with 6 additions and 4 deletions
+2 -2
View File
@@ -30,7 +30,7 @@ void Parser::install_track(const Storage::Disk::Track::Address &address) {
return;
}
std::map<int, Storage::Encodings::MFM::Sector> sectors_by_id;
SectorByIDMap sectors_by_id;
if(density_) {
append(parse_track(*track, *density_), sectors_by_id);
} else {
@@ -49,7 +49,7 @@ SectorMap Parser::parse_track(const Storage::Disk::Track &track, Density density
density);
}
void Parser::append(const SectorMap &source, std::map<int, Sector> &destination) {
void Parser::append(const SectorMap &source, SectorByIDMap &destination) {
for(const auto &sector : source) {
destination.emplace(sector.second.address.sector, std::move(sector.second));
}
+4 -2
View File
@@ -51,15 +51,17 @@ private:
std::shared_ptr<Storage::Disk::Disk> disk_;
std::optional<Density> density_;
using SectorByIDMap = std::unordered_map<int, Sector>;
void install_track(const Storage::Disk::Track::Address &address);
static SectorMap parse_track(const Storage::Disk::Track &track, Density density);
static void append(const SectorMap &source, std::map<int, Sector> &destination);
static void append(const SectorMap &source, SectorByIDMap &destination);
// Maps from a track address, i.e. head and position, to a map from
// sector IDs to sectors.
std::map<
Storage::Disk::Track::Address,
std::map<int, Storage::Encodings::MFM::Sector>
SectorByIDMap
> sectors_by_address_by_track_;
};