Class DiskIO
Defined in File disk_io.hpp
Class Documentation
-
class DiskIO
Class used to read from or write into files or Unix fifos. Used in tests when hardware is emulated in software.
Public Functions
-
DiskIO(const std::string &filename, size_t block_size, std::string_view op, bool is_fifo)
DiskIO constructor.
- Parameters:
filename -- file or fifo to open.
block_size -- felix block size.
op -- read or write.
is_fifo -- true if fifo, file otherwise.
-
~DiskIO()
-
size_t block_read(void *to_read, size_t max_blocks)
read blocks from file/fifo.
- Parameters:
to_read -- read from stream to this destination.
max_blocks -- to read.
- Returns:
number of blocks read.
-
size_t block_write(const void *to_write, size_t max_blocks)
write blocks into file/fifo.
- Parameters:
to_write -- write this data into the output stream.
max_blocks -- to write.
- Returns:
number of blocks written.
-
size_t byte_read(void *to_read, size_t bytes)
read bytes from file/fifo.
- Parameters:
to_read -- read from file/fifo to this destination.
bytes -- maximum number of bytes to read.
- Returns:
number of bytes read.
-
size_t byte_write(void *to_write, size_t bytes)
write bytes to file/fifo.
- Parameters:
to_write -- write this data into the fifo/file.
bytes -- maximum number of bytes to write.
- Returns:
number of bytes written.
-
bool is_eof()
- Returns:
if the end-of-file has been reached.
-
int reset_position()
- Returns:
go back to the start of file.
-
DiskIO(const std::string &filename, size_t block_size, std::string_view op, bool is_fifo)