| 37 | |
| 38 | public: |
| 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 | |
| 63 | private: |
| 64 | uint8_t volume_id = 254; |
nothing calls this directly
no test coverage detected