appends to a RecordFile through a buffer of records, the file opened only to write the buffer
More...
#include <ADS/external/RecordFile.h>
|
| | RecordWriter (RecordFile< T > &file, std::size_t buffer=RecordFile< T >::defaultBuffer) |
| | the writer at the end of file (which must outlive it), with a buffer of buffer records
|
| | RecordWriter (RecordWriter &&) noexcept=default |
| | the writer moved, its buffer with it
|
| | RecordWriter (const RecordWriter &)=delete |
| | no copy, since the records of the buffer would be written twice
|
| RecordWriter & | operator= (const RecordWriter &)=delete |
| | no copy, since the records of the buffer would be written twice
|
| | ~RecordWriter () |
| | flush(), an error of the file system being dropped: a program that must see it calls flush() before
|
| void | push (const T &x) |
| | appends \( x \), writing the buffer when it is full
|
| void | flush (void) |
| | the records of the buffer written to the file
|
| std::size_t | pending (void) const |
| | the records in the buffer, not yet in the file
|
| RecordFile< T > & | file (void) const |
| | the file written
|
template<class T>
requires std::is_trivially_copyable_v< T >
class ADS::RecordWriter< T >
appends to a RecordFile through a buffer of records, the file opened only to write the buffer
◆ RecordWriter() [1/3]
the writer at the end of file (which must outlive it), with a buffer of buffer records
- Precondition
- buffer \( \ge 1 \)
◆ RecordWriter() [2/3]
the writer moved, its buffer with it
◆ RecordWriter() [3/3]
no copy, since the records of the buffer would be written twice
◆ ~RecordWriter()
flush(), an error of the file system being dropped: a program that must see it calls flush() before
◆ file()
◆ flush()
the records of the buffer written to the file
- Postcondition
- pending() is 0
◆ operator=()
no copy, since the records of the buffer would be written twice
◆ pending()
the records in the buffer, not yet in the file
◆ push()
appends \( x \), writing the buffer when it is full
In pseudocode, \( b \) the records of a full buffer:
\[\class{pseudocode}{\begin{array}{r@{\quad}l}
1 & \textbf{procedure}\ \mathrm{push}( x ) \cr
2 & \quad \text{append } x \text{ to the buffer} \cr
3 & \quad \textbf{if}\ \text{the buffer holds } b \text{ records}
\ \textbf{then}\ \mathrm{flush}()\quad \triangleright\ \text{open }
\text{the file, append the buffer, close the file}
\end{array}}
\]
The documentation for this class was generated from the following file: