39 SectorBuffer(
size_t sectorSize,
size_t sectorCount) : mSectorCount(sectorCount), mSize(sectorSize * sectorCount)
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};
SectorBuffer()
Definition: SectorBuffer.h:35
size_t size() const
Definition: SectorBuffer.h:54
uint32_t sectors() const
Definition: SectorBuffer.h:59
T & as()
Definition: SectorBuffer.h:44
void clear()
Definition: SectorBuffer.h:64
const T & as() const
Definition: SectorBuffer.h:49
bool operator==(const SectorBuffer &other) const
Definition: SectorBuffer.h:74
Buffer for working with disk sectors.
Definition: SectorBuffer.h:32
SectorBuffer(size_t sectorSize, size_t sectorCount)
Definition: SectorBuffer.h:39
void fill(uint8_t value)
Definition: SectorBuffer.h:69
Definition: FileDevice.h:25