|
wavelength 1.0.0
|
Double-buffered reader with one asynchronous read of a file always in flight. More...
#include <lazyfilestream.h>
Public Member Functions | |
| LazyFileStream (const String &filename, int nBufferSize) | |
| Open a file, allocate the buffers, and start the first read. | |
| ~LazyFileStream () | |
| Close the file and free the buffers. | |
| bool | Eof () const |
| Report whether the last read reached the end of the file. | |
| bool | ReadDone () |
| Report whether the read in flight is complete, recording how many bytes arrived. | |
| char * | GetData (int *pnPosition, int *pnBytesAvailable) |
| Take the buffer of the completed read, and start the next read unless the file ended. | |
| LazyFileStream (const String &filename, int bufferSize) | |
| Open a file, allocate the buffers, and start the first read. | |
| ~LazyFileStream () | |
| Close the file and free the buffers. | |
| bool | Eof () const |
| Report whether the last read reached the end of the file. | |
| bool | ReadDone () |
| Report whether the read in flight is complete, recording how many bytes arrived. | |
| char * | GetData (int *position, int *bytesAvailable) |
| Take the buffer of the completed read, and start the next read unless the file ended. | |
Double-buffered reader with one asynchronous read of a file always in flight.
The class has no RTTI, and its name comes from the allocation tag of its buffers. The object is 0x20 bytes. While the caller consumes one buffer, the next read fills the other.
The class has no RTTI, and its name comes from its source file. The object is 0x20 bytes. While the caller consumes one buffer, the next read fills the other.
| LazyFileStream::LazyFileStream | ( | const String & | filename, |
| int | nBufferSize ) |
Open a file, allocate the buffers, and start the first read.
| filename | The path of the file. |
| nBufferSize | The size of each buffer in bytes. |
| LazyFileStream::~LazyFileStream | ( | ) |
Close the file and free the buffers.
| LazyFileStream::LazyFileStream | ( | const String & | filename, |
| int | bufferSize ) |
Open a file, allocate the buffers, and start the first read.
| filename | The path of the file. |
| bufferSize | The size of each buffer in bytes. |
| LazyFileStream::~LazyFileStream | ( | ) |
Close the file and free the buffers.
| bool LazyFileStream::Eof | ( | ) | const |
Report whether the last read reached the end of the file.
| bool LazyFileStream::ReadDone | ( | ) |
Report whether the read in flight is complete, recording how many bytes arrived.
| char * LazyFileStream::GetData | ( | int * | pnPosition, |
| int * | pnBytesAvailable ) |
Take the buffer of the completed read, and start the next read unless the file ended.
| pnPosition | Receives the offset of the buffer's data in the file. |
| pnBytesAvailable | Receives the number of bytes in the buffer. |
| bool LazyFileStream::Eof | ( | ) | const |
Report whether the last read reached the end of the file.
| bool LazyFileStream::ReadDone | ( | ) |
Report whether the read in flight is complete, recording how many bytes arrived.
| char * LazyFileStream::GetData | ( | int * | position, |
| int * | bytesAvailable ) |
Take the buffer of the completed read, and start the next read unless the file ended.
| position | Receives the offset of the buffer's data in the file. |
| bytesAvailable | Receives the number of bytes in the buffer. |