ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches
ADS::DiskWriter< T > Class Template Reference

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 More...

#include <ADS/external/TwoLevelMemory.h>

Public member functions

 DiskWriter (DiskFile< T > &f)
 the writer at the end of f, its buffer taken from the memory of f
 DiskWriter (const DiskWriter &)=delete
 no copy, since the buffer is leased from the memory
DiskWriter & operator= (const DiskWriter &)=delete
 no copy, since the buffer is leased from the memory
 ~DiskWriter ()
 close(), if not closed yet
void push (const T &x)
 appends \( x \), writing the buffer when it is full
void close (void)
 writes the partial block, if any; no push() after it

Detailed description

template<class T>
class ADS::DiskWriter< T >

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

Constructor and destructor documentation

◆ DiskWriter() [1/2]

template<class T>
ADS::DiskWriter< T >::DiskWriter ( DiskFile< T > & f)
explicit

the writer at the end of f, its buffer taken from the memory of f

Precondition
\( B \) items of memory are free, and the size of f a multiple of \( B \)

◆ DiskWriter() [2/2]

template<class T>
ADS::DiskWriter< T >::DiskWriter ( const DiskWriter< T > & )
delete

no copy, since the buffer is leased from the memory

◆ ~DiskWriter()

template<class T>
ADS::DiskWriter< T >::~DiskWriter ( )

close(), if not closed yet

Member function documentation

◆ close()

template<class T>
void ADS::DiskWriter< T >::close ( void )

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

◆ operator=()

template<class T>
DiskWriter & ADS::DiskWriter< T >::operator= ( const DiskWriter< T > & )
delete

no copy, since the buffer is leased from the memory

◆ push()

template<class T>
void ADS::DiskWriter< T >::push ( const T & x)

appends \( x \), writing the buffer when it is full

Precondition
the writer is not closed

The documentation for this class was generated from the following file: