| 221 | |
| 222 | public: |
| 223 | std::unique_ptr<Fluxmap> encode(const LogicalTrackLayout& ltl, |
| 224 | const std::vector<std::shared_ptr<const Sector>>& sectors, |
| 225 | const Image& image) override |
| 226 | { |
| 227 | double clockRateUs = clockRateUsForTrack(ltl.logicalCylinder); |
| 228 | int bitsPerRevolution = 200000.0 / clockRateUs; |
| 229 | std::vector<bool> bits(bitsPerRevolution); |
| 230 | unsigned cursor = 0; |
| 231 | |
| 232 | fillBitmapTo(bits, |
| 233 | cursor, |
| 234 | _config.post_index_gap_us() / clockRateUs, |
| 235 | {true, false}); |
| 236 | lastBit = false; |
| 237 | |
| 238 | for (const auto& sector : sectors) |
| 239 | write_sector(bits, cursor, sector); |
| 240 | |
| 241 | if (cursor >= bits.size()) |
| 242 | error("track data overrun by {} bits", cursor - bits.size()); |
| 243 | fillBitmapTo(bits, cursor, bits.size(), {true, false}); |
| 244 | |
| 245 | std::unique_ptr<Fluxmap> fluxmap(new Fluxmap); |
| 246 | fluxmap->appendBits( |
| 247 | bits, calculatePhysicalClockPeriod(clockRateUs * 1e3, 200e6)); |
| 248 | return fluxmap; |
| 249 | } |
| 250 | |
| 251 | private: |
| 252 | const MacintoshEncoderProto& _config; |
nothing calls this directly
no test coverage detected