Skip to content

Commit 48d3bc5

Browse files
authored
Merge pull request #586 from davidgiven/cleanup
Lots of cleanup stuff I've been putting off
2 parents 65a43b6 + 6b7e81d commit 48d3bc5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+299
-584
lines changed

arch/aeslanier/aeslanier.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
#define AESLANIER_SECTOR_LENGTH 256
66
#define AESLANIER_RECORD_SIZE (AESLANIER_SECTOR_LENGTH + 5)
77

8-
extern std::unique_ptr<AbstractDecoder> createAesLanierDecoder(const DecoderProto& config);
8+
extern std::unique_ptr<Decoder> createAesLanierDecoder(const DecoderProto& config);
99

1010
#endif

arch/aeslanier/decoder.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ static Bytes reverse_bits(const Bytes& input)
2323
return output;
2424
}
2525

26-
class AesLanierDecoder : public AbstractDecoder
26+
class AesLanierDecoder : public Decoder
2727
{
2828
public:
2929
AesLanierDecoder(const DecoderProto& config):
30-
AbstractDecoder(config)
30+
Decoder(config)
3131
{}
3232

3333
nanoseconds_t advanceToNextRecord() override
@@ -68,9 +68,9 @@ class AesLanierDecoder : public AbstractDecoder
6868
}
6969
};
7070

71-
std::unique_ptr<AbstractDecoder> createAesLanierDecoder(const DecoderProto& config)
71+
std::unique_ptr<Decoder> createAesLanierDecoder(const DecoderProto& config)
7272
{
73-
return std::unique_ptr<AbstractDecoder>(new AesLanierDecoder(config));
73+
return std::unique_ptr<Decoder>(new AesLanierDecoder(config));
7474
}
7575

7676

arch/agat/agat.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
#define AGAT_SECTOR_SIZE 256
55

6-
extern std::unique_ptr<AbstractDecoder> createAgatDecoder(const DecoderProto& config);
6+
extern std::unique_ptr<Decoder> createAgatDecoder(const DecoderProto& config);
77

88
extern uint8_t agatChecksum(const Bytes& bytes);
99

arch/agat/decoder.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ static const FluxMatchers ALL_PATTERNS = {
4444
&DATA_PATTERN
4545
};
4646

47-
class AgatDecoder : public AbstractDecoder
47+
class AgatDecoder : public Decoder
4848
{
4949
public:
5050
AgatDecoder(const DecoderProto& config):
51-
AbstractDecoder(config)
51+
Decoder(config)
5252
{}
5353

5454
nanoseconds_t advanceToNextRecord() override
@@ -88,9 +88,9 @@ class AgatDecoder : public AbstractDecoder
8888
}
8989
};
9090

91-
std::unique_ptr<AbstractDecoder> createAgatDecoder(const DecoderProto& config)
91+
std::unique_ptr<Decoder> createAgatDecoder(const DecoderProto& config)
9292
{
93-
return std::unique_ptr<AbstractDecoder>(new AgatDecoder(config));
93+
return std::unique_ptr<Decoder>(new AgatDecoder(config));
9494
}
9595

9696

arch/amiga/amiga.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
#define AMIGA_SECTORS_PER_TRACK 11
1010
#define AMIGA_RECORD_SIZE 0x21c
1111

12-
extern std::unique_ptr<AbstractDecoder> createAmigaDecoder(const DecoderProto& config);
13-
extern std::unique_ptr<AbstractEncoder> createAmigaEncoder(const EncoderProto& config);
12+
extern std::unique_ptr<Decoder> createAmigaDecoder(const DecoderProto& config);
13+
extern std::unique_ptr<Encoder> createAmigaEncoder(const EncoderProto& config);
1414

1515
extern uint32_t amigaChecksum(const Bytes& bytes);
1616
extern Bytes amigaInterleave(const Bytes& input);

arch/amiga/decoder.cc

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@
2121

2222
static const FluxPattern SECTOR_PATTERN(48, AMIGA_SECTOR_RECORD);
2323

24-
class AmigaDecoder : public AbstractDecoder
24+
class AmigaDecoder : public Decoder
2525
{
2626
public:
2727
AmigaDecoder(const DecoderProto& config):
28-
AbstractDecoder(config),
28+
Decoder(config),
2929
_config(config.amiga())
3030
{}
3131

@@ -68,19 +68,13 @@ class AmigaDecoder : public AbstractDecoder
6868
_sector->status = (gotdatachecksum == wanteddatachecksum) ? Sector::OK : Sector::BAD_CHECKSUM;
6969
}
7070

71-
std::set<unsigned> requiredSectors(const Location&) const override
72-
{
73-
static std::set<unsigned> sectors = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
74-
return sectors;
75-
}
76-
7771
private:
7872
const AmigaDecoderProto& _config;
7973
nanoseconds_t _clock;
8074
};
8175

82-
std::unique_ptr<AbstractDecoder> createAmigaDecoder(const DecoderProto& config)
76+
std::unique_ptr<Decoder> createAmigaDecoder(const DecoderProto& config)
8377
{
84-
return std::unique_ptr<AbstractDecoder>(new AmigaDecoder(config));
78+
return std::unique_ptr<Decoder>(new AmigaDecoder(config));
8579
}
8680

arch/amiga/encoder.cc

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -100,37 +100,16 @@ static void write_sector(std::vector<bool>& bits,
100100
write_interleaved_bytes(data);
101101
}
102102

103-
class AmigaEncoder : public AbstractEncoder
103+
class AmigaEncoder : public Encoder
104104
{
105105
public:
106106
AmigaEncoder(const EncoderProto& config):
107-
AbstractEncoder(config),
107+
Encoder(config),
108108
_config(config.amiga())
109109
{
110110
}
111111

112112
public:
113-
std::vector<std::shared_ptr<const Sector>> collectSectors(
114-
const Location& location, const Image& image) override
115-
{
116-
std::vector<std::shared_ptr<const Sector>> sectors;
117-
118-
if ((location.logicalTrack >= 0) &&
119-
(location.logicalTrack < AMIGA_TRACKS_PER_DISK))
120-
{
121-
for (int sectorId = 0; sectorId < AMIGA_SECTORS_PER_TRACK;
122-
sectorId++)
123-
{
124-
const auto& sector =
125-
image.get(location.logicalTrack, location.head, sectorId);
126-
if (sector)
127-
sectors.push_back(sector);
128-
}
129-
}
130-
131-
return sectors;
132-
}
133-
134113
std::unique_ptr<Fluxmap> encode(const Location& location,
135114
const std::vector<std::shared_ptr<const Sector>>& sectors,
136115
const Image& image) override
@@ -164,7 +143,7 @@ class AmigaEncoder : public AbstractEncoder
164143
const AmigaEncoderProto& _config;
165144
};
166145

167-
std::unique_ptr<AbstractEncoder> createAmigaEncoder(const EncoderProto& config)
146+
std::unique_ptr<Encoder> createAmigaEncoder(const EncoderProto& config)
168147
{
169-
return std::unique_ptr<AbstractEncoder>(new AmigaEncoder(config));
148+
return std::unique_ptr<Encoder>(new AmigaEncoder(config));
170149
}

arch/apple2/apple2.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313

1414
#define APPLE2_SECTORS 16
1515

16-
extern std::unique_ptr<AbstractDecoder> createApple2Decoder(const DecoderProto& config);
17-
extern std::unique_ptr<AbstractEncoder> createApple2Encoder(const EncoderProto& config);
16+
extern std::unique_ptr<Decoder> createApple2Decoder(const DecoderProto& config);
17+
extern std::unique_ptr<Encoder> createApple2Encoder(const EncoderProto& config);
1818

1919
#endif
2020

arch/apple2/decoder.cc

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,11 @@ static uint8_t combine(uint16_t word)
6464
return word & (word >> 7);
6565
}
6666

67-
class Apple2Decoder : public AbstractDecoder
67+
class Apple2Decoder : public Decoder
6868
{
6969
public:
7070
Apple2Decoder(const DecoderProto& config):
71-
AbstractDecoder(config)
71+
Decoder(config)
7272
{}
7373

7474
nanoseconds_t advanceToNextRecord() override
@@ -144,19 +144,11 @@ class Apple2Decoder : public AbstractDecoder
144144
_sector->status = Sector::BAD_CHECKSUM;
145145
_sector->data = decode_crazy_data(&bytes[0], _sector->status);
146146
}
147-
148-
std::set<unsigned> requiredSectors(const Location& location) const override
149-
{
150-
std::set<unsigned> sectors;
151-
for (int sectorId = 0; sectorId < APPLE2_SECTORS; sectorId++)
152-
sectors.insert(sectorId);
153-
return sectors;
154-
}
155147
};
156148

157-
std::unique_ptr<AbstractDecoder> createApple2Decoder(const DecoderProto& config)
149+
std::unique_ptr<Decoder> createApple2Decoder(const DecoderProto& config)
158150
{
159-
return std::unique_ptr<AbstractDecoder>(new Apple2Decoder(config));
151+
return std::unique_ptr<Decoder>(new Apple2Decoder(config));
160152
}
161153

162154

arch/apple2/encoder.cc

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ static int encode_data_gcr(uint8_t data)
2323
return -1;
2424
}
2525

26-
class Apple2Encoder : public AbstractEncoder
26+
class Apple2Encoder : public Encoder
2727
{
2828
public:
2929
Apple2Encoder(const EncoderProto& config):
30-
AbstractEncoder(config),
30+
Encoder(config),
3131
_config(config.apple2())
3232
{
3333
}
@@ -36,24 +36,6 @@ class Apple2Encoder : public AbstractEncoder
3636
const Apple2EncoderProto& _config;
3737

3838
public:
39-
std::vector<std::shared_ptr<const Sector>> collectSectors(
40-
const Location& location, const Image& image) override
41-
{
42-
std::vector<std::shared_ptr<const Sector>> sectors;
43-
if (location.head == 0)
44-
{
45-
for (int sectorId = 0; sectorId < APPLE2_SECTORS; sectorId++)
46-
{
47-
const auto& sector =
48-
image.get(location.logicalTrack, 0, sectorId);
49-
if (sector)
50-
sectors.push_back(sector);
51-
}
52-
}
53-
54-
return sectors;
55-
}
56-
5739
std::unique_ptr<Fluxmap> encode(const Location& location,
5840
const std::vector<std::shared_ptr<const Sector>>& sectors,
5941
const Image& image) override
@@ -203,7 +185,7 @@ class Apple2Encoder : public AbstractEncoder
203185
}
204186
};
205187

206-
std::unique_ptr<AbstractEncoder> createApple2Encoder(const EncoderProto& config)
188+
std::unique_ptr<Encoder> createApple2Encoder(const EncoderProto& config)
207189
{
208-
return std::unique_ptr<AbstractEncoder>(new Apple2Encoder(config));
190+
return std::unique_ptr<Encoder>(new Apple2Encoder(config));
209191
}

0 commit comments

Comments
 (0)