Template Class DiskReader

Class Documentation

template<class T>
class DiskReader

reads a file through a buffer of one block, B items of the memory

Public Functions

explicit DiskReader(const DiskFile<T> &f)

the buffer is taken from the memory of f

Pre:

B items of memory are free

DiskReader(const DiskReader&) = delete
DiskReader &operator=(const DiskReader&) = delete
bool hasNext(void) const

the items not yet scanned

const T &peek(void)

the next item of the scan, its block read if not in the buffer

Pre:

hasNext()

T next(void)

the next item of the scan, and the scan moves past it

Pre:

hasNext()

std::size_t position(void) const

the place of the scan

const T &at(std::size_t i)

the item i, its block read if not in the buffer; the scan goes on from i + 1

Pre:

i < the size of the file