39 SectorBuffer(
size_t sectorSize,
size_t sectorCount) : mSectorCount(sectorCount), mSize(sectorSize * sectorCount)
41 reset(
new uint8_t[mSize]);
44 template <
typename T> T&
as()
46 return *
reinterpret_cast<T*
>(get());
49 template <
typename T>
const T&
as()
const
51 return *
reinterpret_cast<const T*
>(get());
71 std::fill_n(get(), mSize, value);
76 return *
this && other && mSize == other.mSize && memcmp(get(), other.get(), mSize) == 0;
80 size_t mSectorCount{0};
Buffer for working with disk sectors.
Definition: SectorBuffer.h:33
uint32_t sectors() const
Definition: SectorBuffer.h:59
T & as()
Definition: SectorBuffer.h:44
bool operator==(const SectorBuffer &other) const
Definition: SectorBuffer.h:74
SectorBuffer(size_t sectorSize, size_t sectorCount)
Definition: SectorBuffer.h:39
size_t size() const
Definition: SectorBuffer.h:54
SectorBuffer()
Definition: SectorBuffer.h:35
void clear()
Definition: SectorBuffer.h:64
const T & as() const
Definition: SectorBuffer.h:49
void fill(uint8_t value)
Definition: SectorBuffer.h:69
Definition: FileDevice.h:26