Go to the documentation of this file.
32 class SectorBuffer :
public std::unique_ptr<uint8_t[]>
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};
size_t size() const
Definition: SectorBuffer.h:105
uint32_t sectors() const
Definition: SectorBuffer.h:110
T & as()
Definition: SectorBuffer.h:95
Definition: FileDevice.h:25
bool operator==(const SectorBuffer &other) const
Definition: SectorBuffer.h:125
void fill(uint8_t value)
Definition: SectorBuffer.h:120
SectorBuffer()
Definition: SectorBuffer.h:86
void clear()
Definition: SectorBuffer.h:115