#include <fileringbuffer.h>
Public Member Functions | |
| ~FileRingBuffer () | |
| virtual bool | IsOpen (void) const |
| Returns true if open for either reading or writing. | |
| virtual long long | GetReadPosition (void) const |
| Returns how far into the file we have read. | |
| virtual long long | GetRealFileSize (void) const |
| Returns the size of the file we are reading/writing, or -1 if the query fails. | |
| virtual bool | OpenFile (const QString &lfilename, uint retry_ms=kDefaultOpenTimeout) |
| Opens a file for reading. | |
| virtual bool | ReOpen (QString newFilename="") |
| virtual long long | Seek (long long pos, int whence, bool has_lock) |
| Seeks to a particular position in the file. | |
Protected Member Functions | |
| FileRingBuffer (const QString &lfilename, bool write, bool readahead, int timeout_ms) | |
| virtual int | safe_read (void *data, uint sz) |
| int | safe_read (int fd, void *data, uint sz) |
| Reads data from the file-descriptor. | |
| int | safe_read (RemoteFile *rf, void *data, uint sz) |
| Reads data from the RemoteFile. | |
Friends | |
| class | RingBuffer |
Definition at line 3 of file fileringbuffer.h.
| FileRingBuffer::~FileRingBuffer | ( | ) |
Definition at line 86 of file fileringbuffer.cpp.
| FileRingBuffer::FileRingBuffer | ( | const QString & | lfilename, | |
| bool | write, | |||
| bool | readahead, | |||
| int | timeout_ms | |||
| ) | [protected] |
Definition at line 42 of file fileringbuffer.cpp.
| bool FileRingBuffer::IsOpen | ( | void | ) | const [virtual] |
Returns true if open for either reading or writing.
Implements RingBuffer.
Definition at line 399 of file fileringbuffer.cpp.
| long long FileRingBuffer::GetReadPosition | ( | void | ) | const [virtual] |
Returns how far into the file we have read.
Implements RingBuffer.
Definition at line 511 of file fileringbuffer.cpp.
| long long FileRingBuffer::GetRealFileSize | ( | void | ) | const [virtual] |
Returns the size of the file we are reading/writing, or -1 if the query fails.
Reimplemented from RingBuffer.
Definition at line 519 of file fileringbuffer.cpp.
| bool FileRingBuffer::OpenFile | ( | const QString & | lfilename, | |
| uint | retry_ms = kDefaultOpenTimeout | |||
| ) | [virtual] |
Opens a file for reading.
| lfilename | Name of file to read | |
| retry_ms | How many ms to retry reading the file after the first try before giving up. |
Implements RingBuffer.
Definition at line 187 of file fileringbuffer.cpp.
Referenced by FileRingBuffer().
| bool FileRingBuffer::ReOpen | ( | QString | newFilename = "" |
) | [virtual] |
Reimplemented from RingBuffer.
Definition at line 370 of file fileringbuffer.cpp.
| long long FileRingBuffer::Seek | ( | long long | pos, | |
| int | whence, | |||
| bool | has_lock | |||
| ) | [virtual] |
Seeks to a particular position in the file.
Implements RingBuffer.
Definition at line 531 of file fileringbuffer.cpp.
| virtual int FileRingBuffer::safe_read | ( | void * | data, | |
| uint | sz | |||
| ) | [inline, protected, virtual] |
Implements RingBuffer.
Definition at line 24 of file fileringbuffer.h.
| int FileRingBuffer::safe_read | ( | int | fd, | |
| void * | data, | |||
| uint | sz | |||
| ) | [protected] |
Reads data from the file-descriptor.
This will re-read the file forever until the end-of-file is reached or the buffer is full.
| fd | File descriptor to read from | |
| data | Pointer to where data will be written | |
| sz | Number of bytes to read |
Definition at line 418 of file fileringbuffer.cpp.
| int FileRingBuffer::safe_read | ( | RemoteFile * | rf, | |
| void * | data, | |||
| uint | sz | |||
| ) | [protected] |
Reads data from the RemoteFile.
| rf | RemoteFile to read from | |
| data | Pointer to where data will be written | |
| sz | Number of bytes to read |
Definition at line 489 of file fileringbuffer.cpp.
friend class RingBuffer [friend] |
Definition at line 5 of file fileringbuffer.h.
1.6.3