#include <CircularCache.h>
§ CCircularCache()
CCircularCache::CCircularCache |
( |
size_t |
front, |
|
|
size_t |
back |
|
) |
| |
§ ~CCircularCache()
CCircularCache::~CCircularCache |
( |
| ) |
|
|
override |
§ CachedDataEndPos()
int64_t CCircularCache::CachedDataEndPos |
( |
| ) |
|
|
overridevirtual |
§ CachedDataEndPosIfSeekTo()
int64_t CCircularCache::CachedDataEndPosIfSeekTo |
( |
int64_t |
iFilePosition | ) |
|
|
overridevirtual |
§ Close()
§ CreateNew()
§ GetMaxWriteSize()
size_t CCircularCache::GetMaxWriteSize |
( |
const size_t & |
iRequestSize | ) |
|
|
overridevirtual |
§ IsCachedPosition()
bool CCircularCache::IsCachedPosition |
( |
int64_t |
iFilePosition | ) |
|
|
overridevirtual |
§ Open()
int CCircularCache::Open |
( |
| ) |
|
|
overridevirtual |
§ ReadFromCache()
int CCircularCache::ReadFromCache |
( |
char * |
buf, |
|
|
size_t |
len |
|
) |
| |
|
overridevirtual |
Reads data from cache. Will only read up till the buffer wrap point. So multiple calls may be needed to empty the whole cache
Implements XFILE::CCacheStrategy.
§ Reset()
bool CCircularCache::Reset |
( |
int64_t |
iSourcePosition, |
|
|
bool |
clearAnyway = true |
|
) |
| |
|
overridevirtual |
Reset cache position.
- Parameters
-
iSourcePosition | position to reset to |
clearAnyway | whether to perform a full reset regardless of in cached range already |
- Returns
- Whether a full reset was performed, or not (e.g. only cache swap)
- See also
- CCacheStrategy
Implements XFILE::CCacheStrategy.
§ Seek()
int64_t CCircularCache::Seek |
( |
int64_t |
pos | ) |
|
|
overridevirtual |
§ WaitForData()
int64_t CCircularCache::WaitForData |
( |
unsigned int |
minimum, |
|
|
unsigned int |
iMillis |
|
) |
| |
|
overridevirtual |
§ WriteToCache()
int CCircularCache::WriteToCache |
( |
const char * |
buf, |
|
|
size_t |
len |
|
) |
| |
|
overridevirtual |
Function will write to m_buf at m_end % m_size location it will write at maximum m_size, but it will only write as much it can without wrapping around in the buffer
It will always leave m_size_back of the backbuffer intact but if the back buffer is less than that, that space is usable to write.
If back buffer is filled to an larger extent than m_size_back, it will allow it to be overwritten until only m_size_back data remains.
The following always apply:
- m_end <= m_cur <= m_end
- m_end - m_beg <= m_size
Multiple calls may be needed to fill buffer completely.
Implements XFILE::CCacheStrategy.
§ m_beg
int64_t XFILE::CCircularCache::m_beg |
|
protected |
index in file (not buffer) of beginning of valid data
§ m_buf
uint8_t* XFILE::CCircularCache::m_buf |
|
protected |
§ m_cur
int64_t XFILE::CCircularCache::m_cur |
|
protected |
current reading index in file
§ m_end
int64_t XFILE::CCircularCache::m_end |
|
protected |
index in file (not buffer) of end of valid data
§ m_size
size_t XFILE::CCircularCache::m_size |
|
protected |
size of data buffer used (m_buf)
§ m_size_back
size_t XFILE::CCircularCache::m_size_back |
|
protected |
guaranteed size of back buffer (actual size can be smaller, or larger if front buffer doesn't need it)
§ m_sync
§ m_written
CEvent XFILE::CCircularCache::m_written |
|
protected |
The documentation for this class was generated from the following files: