MCPcopy Create free account
hub / github.com/davidgiven/fluxengine / encode

Method encode

arch/apple2/encoder.cc:39–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37
38public:
39 std::unique_ptr<Fluxmap> encode(const LogicalTrackLayout& ltl,
40 const std::vector<std::shared_ptr<const Sector>>& sectors,
41 const Image& image) override
42 {
43 int bitsPerRevolution =
44 (_config.rotational_period_ms() * 1e3) / _config.clock_period_us();
45
46 std::vector<bool> bits(bitsPerRevolution);
47 unsigned cursor = 0;
48
49 for (const auto& sector : sectors)
50 writeSector(bits, cursor, *sector);
51
52 if (cursor >= bits.size())
53 error("track data overrun by {} bits", cursor - bits.size());
54 fillBitmapTo(bits, cursor, bits.size(), {true, false});
55
56 std::unique_ptr<Fluxmap> fluxmap(new Fluxmap);
57 fluxmap->appendBits(bits,
58 calculatePhysicalClockPeriod(_config.clock_period_us() * 1e3,
59 _config.rotational_period_ms() * 1e6));
60 return fluxmap;
61 }
62
63private:
64 uint8_t volume_id = 254;

Callers

nothing calls this directly

Calls 3

errorFunction · 0.85
fillBitmapToFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected