Files
fluxengine/lib/sectorset.cc
David Given b158692a3a Radically simplify RawRecord and Sector. It all works, and the results are
better, but I've disabled a bunch of decoders for now.
2019-04-18 21:47:34 +02:00

40 lines
874 B
C++

#include "globals.h"
#include "image.h"
#include "sector.h"
#include "sectorset.h"
Sector*& SectorSet::get(int track, int head, int sector)
{
key_t key(track, head, sector);
return _data[key];
}
Sector* SectorSet::get(int track, int head, int sector) const
{
key_t key(track, head, sector);
auto i = _data.find(key);
if (i == _data.end())
return NULL;
return i->second;
}
void SectorSet::calculateSize(int& numTracks, int& numHeads, int& numSectors,
int& sectorSize) const
{
numTracks = numHeads = numSectors = sectorSize = 0;
for (auto& i : _data)
{
auto& sector = i.second;
if (sector)
{
numTracks = std::max(numTracks, sector->logicalTrack+1);
numHeads = std::max(numHeads, sector->logicalSide+1);
numSectors = std::max(numSectors, sector->logicalSector+1);
sectorSize = std::max(sectorSize, (int)sector->data.size());
}
}
}