Track StreamInput bytes written

This commit is contained in:
Jared Boone 2016-04-06 10:29:16 -07:00
parent 8e14d2f4e8
commit 56e448d355

View File

@ -47,11 +47,18 @@ public:
} }
size_t write(const void* const data, const size_t length) { size_t write(const void* const data, const size_t length) {
return fifo.in(reinterpret_cast<const uint8_t*>(data), length); const auto written = fifo.in(reinterpret_cast<const uint8_t*>(data), length);
bytes_written += written;
return written;
}
uint64_t written() const {
return bytes_written;
} }
private: private:
const size_t K; const size_t K;
uint64_t bytes_written = 0;
std::unique_ptr<uint8_t[]> data; std::unique_ptr<uint8_t[]> data;
FIFO<uint8_t> fifo; FIFO<uint8_t> fifo;
}; };