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:
@@ -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 §or : source) {
|
||||
destination.emplace(sector.second.address.sector, std::move(sector.second));
|
||||
}
|
||||
|
||||
@@ -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_;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user