Template Class DiskWriter

Class Documentation

template<class T>
class DiskWriter

appends to a file through a buffer of one block, B items of the memory; the last partial block is written by close() or by the destructor

Public Functions

explicit DiskWriter(DiskFile<T> &f)
Pre:

B items of memory are free, and the size of f a multiple of B

DiskWriter(const DiskWriter&) = delete
DiskWriter &operator=(const DiskWriter&) = delete
~DiskWriter()
void push(const T &x)

appends x, writing the buffer when it is full

Pre:

the writer is not closed

void close(void)

writes the partial block, if any; no push() after it