Template version of cache based on static array. More...
#include <OgreDataStream.h>
Public Member Functions | |
StaticCache () | |
Constructor. More... | |
size_t | avail () const |
Returns number of bytes available for reading in cache after rewinding. More... | |
size_t | cacheData (const void *buf, size_t count) |
Cache data pointed by 'buf'. More... | |
void | clear () |
Clear the cache. More... | |
bool | ff (size_t count) |
Step forward in cached stream by 'count' bytes. More... | |
size_t | read (void *buf, size_t count) |
Read data from cache to 'buf' (maximum 'count' bytes). More... | |
bool | rewind (size_t count) |
Step back in cached stream by 'count' bytes. More... | |
Protected Attributes | |
char | mBuffer [cacheSize] |
Static buffer. More... | |
size_t | mPos |
Current read position. More... | |
size_t | mValidBytes |
Number of bytes valid in cache (written from the beginning of static buffer) More... | |
Template version of cache based on static array.
'cacheSize' defines size of cache in bytes.
Definition at line 42 of file OgreDataStream.h.
|
inline |
Constructor.
Definition at line 55 of file OgreDataStream.h.
|
inline |
Returns number of bytes available for reading in cache after rewinding.
Definition at line 136 of file OgreDataStream.h.
Referenced by Ogre::StaticCache< 16 *OGRE_STREAM_TEMP_SIZE >::cacheData(), Ogre::StaticCache< 16 *OGRE_STREAM_TEMP_SIZE >::ff(), and Ogre::StaticCache< 16 *OGRE_STREAM_TEMP_SIZE >::read().
|
inline |
Cache data pointed by 'buf'.
If 'count' is greater than cache size, we cache only last bytes. Returns number of bytes written to cache.
Definition at line 63 of file OgreDataStream.h.
|
inline |
Clear the cache.
Definition at line 142 of file OgreDataStream.h.
Referenced by Ogre::StaticCache< 16 *OGRE_STREAM_TEMP_SIZE >::ff(), and Ogre::StaticCache< 16 *OGRE_STREAM_TEMP_SIZE >::rewind().
|
inline |
Step forward in cached stream by 'count' bytes.
Returns 'true' if cache contains resulting position.
Definition at line 121 of file OgreDataStream.h.
|
inline |
Read data from cache to 'buf' (maximum 'count' bytes).
Returns number of bytes read from cache.
Definition at line 97 of file OgreDataStream.h.
|
inline |
Step back in cached stream by 'count' bytes.
Returns 'true' if cache contains resulting position.
Definition at line 107 of file OgreDataStream.h.
|
protected |
Static buffer.
Definition at line 46 of file OgreDataStream.h.
Referenced by Ogre::StaticCache< 16 *OGRE_STREAM_TEMP_SIZE >::cacheData(), and Ogre::StaticCache< 16 *OGRE_STREAM_TEMP_SIZE >::read().
|
protected |
Current read position.
Definition at line 51 of file OgreDataStream.h.
Referenced by Ogre::StaticCache< 16 *OGRE_STREAM_TEMP_SIZE >::avail(), Ogre::StaticCache< 16 *OGRE_STREAM_TEMP_SIZE >::cacheData(), Ogre::StaticCache< 16 *OGRE_STREAM_TEMP_SIZE >::clear(), Ogre::StaticCache< 16 *OGRE_STREAM_TEMP_SIZE >::ff(), Ogre::StaticCache< 16 *OGRE_STREAM_TEMP_SIZE >::read(), Ogre::StaticCache< 16 *OGRE_STREAM_TEMP_SIZE >::rewind(), and Ogre::StaticCache< 16 *OGRE_STREAM_TEMP_SIZE >::StaticCache().
|
protected |
Number of bytes valid in cache (written from the beginning of static buffer)
Definition at line 49 of file OgreDataStream.h.
Referenced by Ogre::StaticCache< 16 *OGRE_STREAM_TEMP_SIZE >::avail(), Ogre::StaticCache< 16 *OGRE_STREAM_TEMP_SIZE >::cacheData(), Ogre::StaticCache< 16 *OGRE_STREAM_TEMP_SIZE >::clear(), and Ogre::StaticCache< 16 *OGRE_STREAM_TEMP_SIZE >::StaticCache().