mirror of
https://github.com/davidgiven/fluxengine.git
synced 2025-10-31 11:17:01 -07:00
Split the Layout class.
This commit is contained in:
@@ -110,7 +110,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
std::unique_ptr<Fluxmap> encode(std::shared_ptr<const Layout>& layout,
|
std::unique_ptr<Fluxmap> encode(std::shared_ptr<const Track>& layout,
|
||||||
const std::vector<std::shared_ptr<const Sector>>& sectors,
|
const std::vector<std::shared_ptr<const Sector>>& sectors,
|
||||||
const Image& image) override
|
const Image& image) override
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ private:
|
|||||||
const Apple2EncoderProto& _config;
|
const Apple2EncoderProto& _config;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
std::unique_ptr<Fluxmap> encode(std::shared_ptr<const Layout>& layout,
|
std::unique_ptr<Fluxmap> encode(std::shared_ptr<const Track>& layout,
|
||||||
const std::vector<std::shared_ptr<const Sector>>& sectors,
|
const std::vector<std::shared_ptr<const Sector>>& sectors,
|
||||||
const Image& image) override
|
const Image& image) override
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
std::unique_ptr<Fluxmap> encode(
|
std::unique_ptr<Fluxmap> encode(
|
||||||
std::shared_ptr<const Layout>& layout,
|
std::shared_ptr<const Track>& layout,
|
||||||
const std::vector<std::shared_ptr<const Sector>>& sectors,
|
const std::vector<std::shared_ptr<const Sector>>& sectors,
|
||||||
const Image& image) override
|
const Image& image) override
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
std::unique_ptr<Fluxmap> encode(std::shared_ptr<const Layout>& layout,
|
std::unique_ptr<Fluxmap> encode(std::shared_ptr<const Track>& layout,
|
||||||
const std::vector<std::shared_ptr<const Sector>>& sectors,
|
const std::vector<std::shared_ptr<const Sector>>& sectors,
|
||||||
const Image& image) override
|
const Image& image) override
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
std::unique_ptr<Fluxmap> encode(std::shared_ptr<const Layout>& layout,
|
std::unique_ptr<Fluxmap> encode(std::shared_ptr<const Track>& layout,
|
||||||
const std::vector<std::shared_ptr<const Sector>>& sectors,
|
const std::vector<std::shared_ptr<const Sector>>& sectors,
|
||||||
const Image& image) override
|
const Image& image) override
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -220,7 +220,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
std::unique_ptr<Fluxmap> encode(std::shared_ptr<const Layout>& layout,
|
std::unique_ptr<Fluxmap> encode(std::shared_ptr<const Track>& layout,
|
||||||
const std::vector<std::shared_ptr<const Sector>>& sectors,
|
const std::vector<std::shared_ptr<const Sector>>& sectors,
|
||||||
const Image& image) override
|
const Image& image) override
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<Fluxmap> encode(std::shared_ptr<const Layout>& layout,
|
std::unique_ptr<Fluxmap> encode(std::shared_ptr<const Track>& layout,
|
||||||
const std::vector<std::shared_ptr<const Sector>>& sectors,
|
const std::vector<std::shared_ptr<const Sector>>& sectors,
|
||||||
const Image& image) override
|
const Image& image) override
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<Fluxmap> encode(std::shared_ptr<const Layout>& layout,
|
std::unique_ptr<Fluxmap> encode(std::shared_ptr<const Track>& layout,
|
||||||
const std::vector<std::shared_ptr<const Sector>>& sectors,
|
const std::vector<std::shared_ptr<const Sector>>& sectors,
|
||||||
const Image& image) override
|
const Image& image) override
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
std::unique_ptr<Fluxmap> encode(std::shared_ptr<const Layout>& layout,
|
std::unique_ptr<Fluxmap> encode(std::shared_ptr<const Track>& layout,
|
||||||
const std::vector<std::shared_ptr<const Sector>>& sectors,
|
const std::vector<std::shared_ptr<const Sector>>& sectors,
|
||||||
const Image& image) override
|
const Image& image) override
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
std::unique_ptr<Fluxmap> encode(std::shared_ptr<const Layout>& layout,
|
std::unique_ptr<Fluxmap> encode(std::shared_ptr<const Track>& layout,
|
||||||
const std::vector<std::shared_ptr<const Sector>>& sectors,
|
const std::vector<std::shared_ptr<const Sector>>& sectors,
|
||||||
const Image& image) override
|
const Image& image) override
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ std::unique_ptr<Decoder> Decoder::create(const DecoderProto& config)
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<TrackDataFlux> Decoder::decodeToSectors(
|
std::shared_ptr<TrackDataFlux> Decoder::decodeToSectors(
|
||||||
std::shared_ptr<const Fluxmap> fluxmap, std::shared_ptr<const Layout>& layout)
|
std::shared_ptr<const Fluxmap> fluxmap, std::shared_ptr<const Track>& layout)
|
||||||
{
|
{
|
||||||
_trackdata = std::make_shared<TrackDataFlux>();
|
_trackdata = std::make_shared<TrackDataFlux>();
|
||||||
_trackdata->fluxmap = fluxmap;
|
_trackdata->fluxmap = fluxmap;
|
||||||
@@ -222,7 +222,7 @@ uint64_t Decoder::readRaw64()
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::set<LogicalLocation> Decoder::requiredSectors(
|
std::set<LogicalLocation> Decoder::requiredSectors(
|
||||||
std::shared_ptr<const Layout>& layout) const
|
std::shared_ptr<const Track>& layout) const
|
||||||
{
|
{
|
||||||
const auto trackLayout =
|
const auto trackLayout =
|
||||||
Layout::getLayoutOfTrackPhysical(layout->physicalTrack, layout->physicalSide);
|
Layout::getLayoutOfTrackPhysical(layout->physicalTrack, layout->physicalSide);
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ public:
|
|||||||
public:
|
public:
|
||||||
std::shared_ptr<TrackDataFlux> decodeToSectors(
|
std::shared_ptr<TrackDataFlux> decodeToSectors(
|
||||||
std::shared_ptr<const Fluxmap> fluxmap,
|
std::shared_ptr<const Fluxmap> fluxmap,
|
||||||
std::shared_ptr<const Layout>& location);
|
std::shared_ptr<const Track>& location);
|
||||||
|
|
||||||
void pushRecord(
|
void pushRecord(
|
||||||
const Fluxmap::Position& start, const Fluxmap::Position& end);
|
const Fluxmap::Position& start, const Fluxmap::Position& end);
|
||||||
@@ -90,7 +90,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual std::set<LogicalLocation> requiredSectors(
|
virtual std::set<LogicalLocation> requiredSectors(
|
||||||
std::shared_ptr<const Layout>& location) const;
|
std::shared_ptr<const Track>& location) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void beginTrack(){};
|
virtual void beginTrack(){};
|
||||||
|
|||||||
@@ -57,13 +57,13 @@ nanoseconds_t Encoder::calculatePhysicalClockPeriod(
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<const Sector> Encoder::getSector(
|
std::shared_ptr<const Sector> Encoder::getSector(
|
||||||
std::shared_ptr<const Layout>& layout, const Image& image, unsigned sectorId)
|
std::shared_ptr<const Track>& layout, const Image& image, unsigned sectorId)
|
||||||
{
|
{
|
||||||
return image.get(layout->logicalTrack, layout->logicalSide, sectorId);
|
return image.get(layout->logicalTrack, layout->logicalSide, sectorId);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::shared_ptr<const Sector>> Encoder::collectSectors(
|
std::vector<std::shared_ptr<const Sector>> Encoder::collectSectors(
|
||||||
std::shared_ptr<const Layout>& trackLayout, const Image& image)
|
std::shared_ptr<const Track>& trackLayout, const Image& image)
|
||||||
{
|
{
|
||||||
std::vector<std::shared_ptr<const Sector>> sectors;
|
std::vector<std::shared_ptr<const Sector>> sectors;
|
||||||
|
|
||||||
|
|||||||
@@ -17,12 +17,12 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
virtual std::shared_ptr<const Sector> getSector(
|
virtual std::shared_ptr<const Sector> getSector(
|
||||||
std::shared_ptr<const Layout>&, const Image& image, unsigned sectorId);
|
std::shared_ptr<const Track>&, const Image& image, unsigned sectorId);
|
||||||
|
|
||||||
virtual std::vector<std::shared_ptr<const Sector>> collectSectors(
|
virtual std::vector<std::shared_ptr<const Sector>> collectSectors(
|
||||||
std::shared_ptr<const Layout>&, const Image& image);
|
std::shared_ptr<const Track>&, const Image& image);
|
||||||
|
|
||||||
virtual std::unique_ptr<Fluxmap> encode(std::shared_ptr<const Layout>& layout,
|
virtual std::unique_ptr<Fluxmap> encode(std::shared_ptr<const Track>& layout,
|
||||||
const std::vector<std::shared_ptr<const Sector>>& sectors,
|
const std::vector<std::shared_ptr<const Sector>>& sectors,
|
||||||
const Image& image) = 0;
|
const Image& image) = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
class Fluxmap;
|
class Fluxmap;
|
||||||
class Sector;
|
class Sector;
|
||||||
class Image;
|
class Image;
|
||||||
class Layout;
|
class Track;
|
||||||
|
|
||||||
struct Record
|
struct Record
|
||||||
{
|
{
|
||||||
@@ -18,7 +18,7 @@ struct Record
|
|||||||
|
|
||||||
struct TrackDataFlux
|
struct TrackDataFlux
|
||||||
{
|
{
|
||||||
std::shared_ptr<const Layout> layout;
|
std::shared_ptr<const Track> layout;
|
||||||
std::shared_ptr<const Fluxmap> fluxmap;
|
std::shared_ptr<const Fluxmap> fluxmap;
|
||||||
std::vector<std::shared_ptr<const Record>> records;
|
std::vector<std::shared_ptr<const Record>> records;
|
||||||
std::vector<std::shared_ptr<const Sector>> sectors;
|
std::vector<std::shared_ptr<const Sector>> sectors;
|
||||||
@@ -26,7 +26,7 @@ struct TrackDataFlux
|
|||||||
|
|
||||||
struct TrackFlux
|
struct TrackFlux
|
||||||
{
|
{
|
||||||
std::shared_ptr<const Layout> layout;
|
std::shared_ptr<const Track> layout;
|
||||||
std::vector<std::shared_ptr<TrackDataFlux>> trackDatas;
|
std::vector<std::shared_ptr<TrackDataFlux>> trackDatas;
|
||||||
std::set<std::shared_ptr<const Sector>> sectors;
|
std::set<std::shared_ptr<const Sector>> sectors;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#include "lib/environment.h"
|
#include "lib/environment.h"
|
||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
|
|
||||||
static Local<std::map<std::pair<int, int>, std::shared_ptr<Layout>>>
|
static Local<std::map<std::pair<int, int>, std::shared_ptr<Track>>>
|
||||||
layoutCache;
|
layoutCache;
|
||||||
|
|
||||||
static unsigned getTrackStep()
|
static unsigned getTrackStep()
|
||||||
@@ -38,7 +38,7 @@ unsigned Layout::remapSideLogicalToPhysical(unsigned lside)
|
|||||||
return lside ^ config.layout().swap_sides();
|
return lside ^ config.layout().swap_sides();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::shared_ptr<const Layout>> Layout::computeLocations()
|
std::vector<std::shared_ptr<const Track>> Layout::computeLocations()
|
||||||
{
|
{
|
||||||
std::set<unsigned> tracks;
|
std::set<unsigned> tracks;
|
||||||
if (config.has_tracks())
|
if (config.has_tracks())
|
||||||
@@ -52,7 +52,7 @@ std::vector<std::shared_ptr<const Layout>> Layout::computeLocations()
|
|||||||
else
|
else
|
||||||
heads = iterate(0, config.layout().sides());
|
heads = iterate(0, config.layout().sides());
|
||||||
|
|
||||||
std::vector<std::shared_ptr<const Layout>> locations;
|
std::vector<std::shared_ptr<const Track>> locations;
|
||||||
for (unsigned logicalTrack : tracks)
|
for (unsigned logicalTrack : tracks)
|
||||||
{
|
{
|
||||||
for (unsigned logicalHead : heads)
|
for (unsigned logicalHead : heads)
|
||||||
@@ -125,13 +125,13 @@ std::vector<unsigned> Layout::expandSectorList(
|
|||||||
return sectors;
|
return sectors;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<const Layout> Layout::getLayoutOfTrack(
|
std::shared_ptr<const Track> Layout::getLayoutOfTrack(
|
||||||
unsigned logicalTrack, unsigned logicalSide)
|
unsigned logicalTrack, unsigned logicalSide)
|
||||||
{
|
{
|
||||||
auto& layout = (*layoutCache)[std::make_pair(logicalTrack, logicalSide)];
|
auto& layout = (*layoutCache)[std::make_pair(logicalTrack, logicalSide)];
|
||||||
if (!layout)
|
if (!layout)
|
||||||
{
|
{
|
||||||
layout = std::make_shared<Layout>();
|
layout = std::make_shared<Track>();
|
||||||
|
|
||||||
LayoutProto::LayoutdataProto layoutdata;
|
LayoutProto::LayoutdataProto layoutdata;
|
||||||
for (const auto& f : config.layout().layoutdata())
|
for (const auto& f : config.layout().layoutdata())
|
||||||
@@ -190,7 +190,7 @@ std::shared_ptr<const Layout> Layout::getLayoutOfTrack(
|
|||||||
return layout;
|
return layout;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<const Layout> Layout::getLayoutOfTrackPhysical(
|
std::shared_ptr<const Track> Layout::getLayoutOfTrackPhysical(
|
||||||
unsigned physicalTrack, unsigned physicalSide)
|
unsigned physicalTrack, unsigned physicalSide)
|
||||||
{
|
{
|
||||||
return getLayoutOfTrack(remapTrackPhysicalToLogical(physicalTrack),
|
return getLayoutOfTrack(remapTrackPhysicalToLogical(physicalTrack),
|
||||||
|
|||||||
25
lib/layout.h
25
lib/layout.h
@@ -4,17 +4,10 @@
|
|||||||
#include "lib/flux.h"
|
#include "lib/flux.h"
|
||||||
|
|
||||||
class SectorListProto;
|
class SectorListProto;
|
||||||
|
class Track;
|
||||||
|
|
||||||
class Layout
|
class Layout
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
Layout() {}
|
|
||||||
|
|
||||||
private:
|
|
||||||
/* Can't copy. */
|
|
||||||
Layout(const Layout&);
|
|
||||||
Layout& operator=(const Layout&);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/* Translates logical track numbering (the numbers actually written in the
|
/* Translates logical track numbering (the numbers actually written in the
|
||||||
* sector headers) to the track numbering on the actual drive, taking into
|
* sector headers) to the track numbering on the actual drive, taking into
|
||||||
@@ -32,7 +25,7 @@ public:
|
|||||||
/* Uses the layout and current track and heads settings to determine
|
/* Uses the layout and current track and heads settings to determine
|
||||||
* which Locations are going to be read from or written to. 8/
|
* which Locations are going to be read from or written to. 8/
|
||||||
*/
|
*/
|
||||||
static std::vector<std::shared_ptr<const Layout>> computeLocations();
|
static std::vector<std::shared_ptr<const Track>> computeLocations();
|
||||||
|
|
||||||
/* Returns a series of <track, side> pairs representing the filesystem
|
/* Returns a series of <track, side> pairs representing the filesystem
|
||||||
* ordering of the disk, in logical numbers. */
|
* ordering of the disk, in logical numbers. */
|
||||||
@@ -40,16 +33,26 @@ public:
|
|||||||
unsigned guessedTracks = 0, unsigned guessedSides = 0);
|
unsigned guessedTracks = 0, unsigned guessedSides = 0);
|
||||||
|
|
||||||
/* Returns the layout of a given track. */
|
/* Returns the layout of a given track. */
|
||||||
static std::shared_ptr<const Layout> getLayoutOfTrack(
|
static std::shared_ptr<const Track> getLayoutOfTrack(
|
||||||
unsigned logicalTrack, unsigned logicalHead);
|
unsigned logicalTrack, unsigned logicalHead);
|
||||||
|
|
||||||
/* Returns the layout of a given track via physical location. */
|
/* Returns the layout of a given track via physical location. */
|
||||||
static std::shared_ptr<const Layout> getLayoutOfTrackPhysical(
|
static std::shared_ptr<const Track> getLayoutOfTrackPhysical(
|
||||||
unsigned physicalTrack, unsigned physicalSide);
|
unsigned physicalTrack, unsigned physicalSide);
|
||||||
|
|
||||||
/* Expand a SectorList into the actual sector IDs. */
|
/* Expand a SectorList into the actual sector IDs. */
|
||||||
static std::vector<unsigned> expandSectorList(
|
static std::vector<unsigned> expandSectorList(
|
||||||
const SectorListProto& sectorsProto);
|
const SectorListProto& sectorsProto);
|
||||||
|
};
|
||||||
|
|
||||||
|
class Track {
|
||||||
|
public:
|
||||||
|
Track() {}
|
||||||
|
|
||||||
|
private:
|
||||||
|
/* Can't copy. */
|
||||||
|
Track(const Track&);
|
||||||
|
Track& operator=(const Track&);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
unsigned numTracks = 0;
|
unsigned numTracks = 0;
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ static std::set<std::shared_ptr<const Sector>> collectSectors(
|
|||||||
|
|
||||||
BadSectorsState combineRecordAndSectors(TrackFlux& trackFlux,
|
BadSectorsState combineRecordAndSectors(TrackFlux& trackFlux,
|
||||||
Decoder& decoder,
|
Decoder& decoder,
|
||||||
std::shared_ptr<const Layout>& layout)
|
std::shared_ptr<const Track>& layout)
|
||||||
{
|
{
|
||||||
std::set<std::shared_ptr<const Sector>> track_sectors;
|
std::set<std::shared_ptr<const Sector>> track_sectors;
|
||||||
|
|
||||||
@@ -182,7 +182,7 @@ BadSectorsState combineRecordAndSectors(TrackFlux& trackFlux,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReadResult readGroup(FluxSourceIteratorHolder& fluxSourceIteratorHolder,
|
ReadResult readGroup(FluxSourceIteratorHolder& fluxSourceIteratorHolder,
|
||||||
std::shared_ptr<const Layout>& layout,
|
std::shared_ptr<const Track>& layout,
|
||||||
TrackFlux& trackFlux,
|
TrackFlux& trackFlux,
|
||||||
Decoder& decoder)
|
Decoder& decoder)
|
||||||
{
|
{
|
||||||
@@ -224,9 +224,9 @@ ReadResult readGroup(FluxSourceIteratorHolder& fluxSourceIteratorHolder,
|
|||||||
|
|
||||||
void writeTracks(FluxSink& fluxSink,
|
void writeTracks(FluxSink& fluxSink,
|
||||||
std::function<std::unique_ptr<const Fluxmap>(
|
std::function<std::unique_ptr<const Fluxmap>(
|
||||||
std::shared_ptr<const Layout>& layout)> producer,
|
std::shared_ptr<const Track>& layout)> producer,
|
||||||
std::function<bool(std::shared_ptr<const Layout>& layout)> verifier,
|
std::function<bool(std::shared_ptr<const Track>& layout)> verifier,
|
||||||
std::vector<std::shared_ptr<const Layout>>& layouts)
|
std::vector<std::shared_ptr<const Track>>& layouts)
|
||||||
{
|
{
|
||||||
Logger() << BeginOperationLogMessage{"Encoding and writing to disk"};
|
Logger() << BeginOperationLogMessage{"Encoding and writing to disk"};
|
||||||
|
|
||||||
@@ -294,11 +294,11 @@ void writeTracks(FluxSink& fluxSink,
|
|||||||
void writeTracks(FluxSink& fluxSink,
|
void writeTracks(FluxSink& fluxSink,
|
||||||
Encoder& encoder,
|
Encoder& encoder,
|
||||||
const Image& image,
|
const Image& image,
|
||||||
std::vector<std::shared_ptr<const Layout>>& layouts)
|
std::vector<std::shared_ptr<const Track>>& layouts)
|
||||||
{
|
{
|
||||||
writeTracks(
|
writeTracks(
|
||||||
fluxSink,
|
fluxSink,
|
||||||
[&](std::shared_ptr<const Layout>& layout)
|
[&](std::shared_ptr<const Track>& layout)
|
||||||
{
|
{
|
||||||
auto sectors = encoder.collectSectors(layout, image);
|
auto sectors = encoder.collectSectors(layout, image);
|
||||||
return encoder.encode(layout, sectors, image);
|
return encoder.encode(layout, sectors, image);
|
||||||
@@ -315,16 +315,16 @@ void writeTracksAndVerify(FluxSink& fluxSink,
|
|||||||
FluxSource& fluxSource,
|
FluxSource& fluxSource,
|
||||||
Decoder& decoder,
|
Decoder& decoder,
|
||||||
const Image& image,
|
const Image& image,
|
||||||
std::vector<std::shared_ptr<const Layout>>& locations)
|
std::vector<std::shared_ptr<const Track>>& locations)
|
||||||
{
|
{
|
||||||
writeTracks(
|
writeTracks(
|
||||||
fluxSink,
|
fluxSink,
|
||||||
[&](std::shared_ptr<const Layout>& layout)
|
[&](std::shared_ptr<const Track>& layout)
|
||||||
{
|
{
|
||||||
auto sectors = encoder.collectSectors(layout, image);
|
auto sectors = encoder.collectSectors(layout, image);
|
||||||
return encoder.encode(layout, sectors, image);
|
return encoder.encode(layout, sectors, image);
|
||||||
},
|
},
|
||||||
[&](std::shared_ptr<const Layout>& layout)
|
[&](std::shared_ptr<const Track>& layout)
|
||||||
{
|
{
|
||||||
auto trackFlux = std::make_shared<TrackFlux>();
|
auto trackFlux = std::make_shared<TrackFlux>();
|
||||||
trackFlux->layout = layout;
|
trackFlux->layout = layout;
|
||||||
@@ -381,7 +381,7 @@ void writeDiskCommand(const Image& image,
|
|||||||
FluxSink& fluxSink,
|
FluxSink& fluxSink,
|
||||||
Decoder* decoder,
|
Decoder* decoder,
|
||||||
FluxSource* fluxSource,
|
FluxSource* fluxSource,
|
||||||
std::vector<std::shared_ptr<const Layout>>& locations)
|
std::vector<std::shared_ptr<const Track>>& locations)
|
||||||
{
|
{
|
||||||
if (fluxSource && decoder)
|
if (fluxSource && decoder)
|
||||||
writeTracksAndVerify(
|
writeTracksAndVerify(
|
||||||
@@ -405,7 +405,7 @@ void writeRawDiskCommand(FluxSource& fluxSource, FluxSink& fluxSink)
|
|||||||
auto locations = Layout::computeLocations();
|
auto locations = Layout::computeLocations();
|
||||||
writeTracks(
|
writeTracks(
|
||||||
fluxSink,
|
fluxSink,
|
||||||
[&](std::shared_ptr<const Layout>& layout)
|
[&](std::shared_ptr<const Track>& layout)
|
||||||
{
|
{
|
||||||
return fluxSource
|
return fluxSource
|
||||||
.readFlux(layout->physicalTrack, layout->physicalSide)
|
.readFlux(layout->physicalTrack, layout->physicalSide)
|
||||||
@@ -420,7 +420,7 @@ void writeRawDiskCommand(FluxSource& fluxSource, FluxSink& fluxSink)
|
|||||||
|
|
||||||
std::shared_ptr<TrackFlux> readAndDecodeTrack(FluxSource& fluxSource,
|
std::shared_ptr<TrackFlux> readAndDecodeTrack(FluxSource& fluxSource,
|
||||||
Decoder& decoder,
|
Decoder& decoder,
|
||||||
std::shared_ptr<const Layout>& layout)
|
std::shared_ptr<const Track>& layout)
|
||||||
{
|
{
|
||||||
auto trackFlux = std::make_shared<TrackFlux>();
|
auto trackFlux = std::make_shared<TrackFlux>();
|
||||||
trackFlux->layout = layout;
|
trackFlux->layout = layout;
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class Fluxmap;
|
|||||||
class Image;
|
class Image;
|
||||||
class ImageReader;
|
class ImageReader;
|
||||||
class ImageWriter;
|
class ImageWriter;
|
||||||
class Layout;
|
class Track;
|
||||||
class TrackFlux;
|
class TrackFlux;
|
||||||
|
|
||||||
extern void measureDiskRotation(
|
extern void measureDiskRotation(
|
||||||
@@ -19,15 +19,15 @@ extern void measureDiskRotation(
|
|||||||
|
|
||||||
extern void writeTracks(FluxSink& fluxSink,
|
extern void writeTracks(FluxSink& fluxSink,
|
||||||
const std::function<std::unique_ptr<const Fluxmap>(
|
const std::function<std::unique_ptr<const Fluxmap>(
|
||||||
std::shared_ptr<const Layout>& layout)> producer,
|
std::shared_ptr<const Track>& layout)> producer,
|
||||||
std::vector<std::shared_ptr<const Layout>>& locations);
|
std::vector<std::shared_ptr<const Track>>& locations);
|
||||||
|
|
||||||
extern void writeTracksAndVerify(FluxSink& fluxSink,
|
extern void writeTracksAndVerify(FluxSink& fluxSink,
|
||||||
Encoder& encoder,
|
Encoder& encoder,
|
||||||
FluxSource& fluxSource,
|
FluxSource& fluxSource,
|
||||||
Decoder& decoder,
|
Decoder& decoder,
|
||||||
const Image& image,
|
const Image& image,
|
||||||
std::vector<std::shared_ptr<const Layout>>& locations);
|
std::vector<std::shared_ptr<const Track>>& locations);
|
||||||
|
|
||||||
extern void fillBitmapTo(std::vector<bool>& bitmap,
|
extern void fillBitmapTo(std::vector<bool>& bitmap,
|
||||||
unsigned& cursor,
|
unsigned& cursor,
|
||||||
@@ -39,7 +39,7 @@ extern void writeDiskCommand(const Image& image,
|
|||||||
FluxSink& fluxSink,
|
FluxSink& fluxSink,
|
||||||
Decoder* decoder,
|
Decoder* decoder,
|
||||||
FluxSource* fluxSource,
|
FluxSource* fluxSource,
|
||||||
std::vector<std::shared_ptr<const Layout>>& locations);
|
std::vector<std::shared_ptr<const Track>>& locations);
|
||||||
|
|
||||||
extern void writeDiskCommand(const Image& image,
|
extern void writeDiskCommand(const Image& image,
|
||||||
Encoder& encoder,
|
Encoder& encoder,
|
||||||
@@ -51,7 +51,7 @@ extern void writeRawDiskCommand(FluxSource& fluxSource, FluxSink& fluxSink);
|
|||||||
|
|
||||||
extern std::shared_ptr<TrackFlux> readAndDecodeTrack(FluxSource& fluxSource,
|
extern std::shared_ptr<TrackFlux> readAndDecodeTrack(FluxSource& fluxSource,
|
||||||
Decoder& decoder,
|
Decoder& decoder,
|
||||||
std::shared_ptr<const Layout>& layout);
|
std::shared_ptr<const Track>& layout);
|
||||||
|
|
||||||
extern std::shared_ptr<const DiskFlux> readDiskCommand(
|
extern std::shared_ptr<const DiskFlux> readDiskCommand(
|
||||||
FluxSource& fluxsource, Decoder& decoder);
|
FluxSource& fluxsource, Decoder& decoder);
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ Sector::Sector(const LogicalLocation& location):
|
|||||||
physicalSide(Layout::remapSideLogicalToPhysical(location.logicalSide))
|
physicalSide(Layout::remapSideLogicalToPhysical(location.logicalSide))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
Sector::Sector(std::shared_ptr<const Layout>& layout, unsigned sectorId):
|
Sector::Sector(std::shared_ptr<const Track>& layout, unsigned sectorId):
|
||||||
LogicalLocation({ layout->logicalTrack, layout->logicalSide, sectorId }),
|
LogicalLocation({ layout->logicalTrack, layout->logicalSide, sectorId }),
|
||||||
physicalTrack(layout->physicalTrack),
|
physicalTrack(layout->physicalTrack),
|
||||||
physicalSide(layout->physicalSide)
|
physicalSide(layout->physicalSide)
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
#include "fluxmap.h"
|
#include "fluxmap.h"
|
||||||
|
|
||||||
class Record;
|
class Record;
|
||||||
class Layout;
|
class Track;
|
||||||
|
|
||||||
struct LogicalLocation
|
struct LogicalLocation
|
||||||
{
|
{
|
||||||
@@ -65,7 +65,7 @@ struct Sector : public LogicalLocation
|
|||||||
|
|
||||||
Sector() {}
|
Sector() {}
|
||||||
|
|
||||||
Sector(std::shared_ptr<const Layout>& layout, unsigned sectorId=0);
|
Sector(std::shared_ptr<const Track>& layout, unsigned sectorId=0);
|
||||||
|
|
||||||
Sector(const LogicalLocation& location);
|
Sector(const LogicalLocation& location);
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ public:
|
|||||||
|
|
||||||
void flushChanges() override
|
void flushChanges() override
|
||||||
{
|
{
|
||||||
std::vector<std::shared_ptr<const Layout>> locations;
|
std::vector<std::shared_ptr<const Track>> locations;
|
||||||
|
|
||||||
for (const auto& trackid : _changedTracks)
|
for (const auto& trackid : _changedTracks)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -434,7 +434,7 @@ void FluxViewerControl::ShowSectorMenu(std::shared_ptr<const Sector> sector)
|
|||||||
PopupMenu(&menu, _mouseX, _mouseY);
|
PopupMenu(&menu, _mouseX, _mouseY);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FluxViewerControl::ShowRecordMenu(std::shared_ptr<const ::Layout>& layout,
|
void FluxViewerControl::ShowRecordMenu(std::shared_ptr<const Track>& layout,
|
||||||
std::shared_ptr<const Record> record)
|
std::shared_ptr<const Record> record)
|
||||||
{
|
{
|
||||||
wxMenu menu;
|
wxMenu menu;
|
||||||
@@ -502,7 +502,7 @@ void FluxViewerControl::DisplayRawData(std::shared_ptr<const Sector> sector)
|
|||||||
TextViewerWindow::Create(this, title, s.str())->Show();
|
TextViewerWindow::Create(this, title, s.str())->Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FluxViewerControl::DisplayRawData(std::shared_ptr<const ::Layout>& layout,
|
void FluxViewerControl::DisplayRawData(std::shared_ptr<const Track>& layout,
|
||||||
std::shared_ptr<const Record> record)
|
std::shared_ptr<const Record> record)
|
||||||
{
|
{
|
||||||
std::stringstream s;
|
std::stringstream s;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ class wxScrollBar;
|
|||||||
class wxScrollEvent;
|
class wxScrollEvent;
|
||||||
class Sector;
|
class Sector;
|
||||||
class Record;
|
class Record;
|
||||||
class Layout;
|
class Track;
|
||||||
|
|
||||||
class FluxViewerControl : public wxWindow
|
class FluxViewerControl : public wxWindow
|
||||||
{
|
{
|
||||||
@@ -27,11 +27,11 @@ public:
|
|||||||
private:
|
private:
|
||||||
void UpdateScale();
|
void UpdateScale();
|
||||||
void ShowSectorMenu(std::shared_ptr<const Sector> sector);
|
void ShowSectorMenu(std::shared_ptr<const Sector> sector);
|
||||||
void ShowRecordMenu(std::shared_ptr<const ::Layout>& layout,
|
void ShowRecordMenu(std::shared_ptr<const Track>& layout,
|
||||||
std::shared_ptr<const Record> record);
|
std::shared_ptr<const Record> record);
|
||||||
void DisplayDecodedData(std::shared_ptr<const Sector> sector);
|
void DisplayDecodedData(std::shared_ptr<const Sector> sector);
|
||||||
void DisplayRawData(std::shared_ptr<const Sector> sector);
|
void DisplayRawData(std::shared_ptr<const Sector> sector);
|
||||||
void DisplayRawData(std::shared_ptr<const ::Layout>& layout,
|
void DisplayRawData(std::shared_ptr<const Track>& layout,
|
||||||
std::shared_ptr<const Record> record);
|
std::shared_ptr<const Record> record);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
Reference in New Issue
Block a user