Template version of cache based on static array. More...
#include <OgreDataStream.h>
Public Member Functions | |
StaticCache () | |
Constructor. | |
size_t | cacheData (const void *buf, size_t count) |
Cache data pointed by 'buf'. | |
size_t | read (void *buf, size_t count) |
Read data from cache to 'buf' (maximum 'count' bytes). | |
bool | rewind (size_t count) |
Step back in cached stream by 'count' bytes. | |
bool | ff (size_t count) |
Step forward in cached stream by 'count' bytes. | |
size_t | avail () const |
Returns number of bytes available for reading in cache after rewinding. | |
void | clear () |
Clear the cache. | |
Protected Attributes | |
char | mBuffer [cacheSize] |
Static buffer. | |
size_t | mValidBytes |
Number of bytes valid in cache (written from the beginning of static buffer). | |
size_t | mPos |
Current read position. |
Template version of cache based on static array.
'cacheSize' defines size of cache in bytes.
Definition at line 41 of file OgreDataStream.h.
Ogre::StaticCache< cacheSize >::StaticCache | ( | ) |
Constructor.
Definition at line 54 of file OgreDataStream.h.
size_t Ogre::StaticCache< cacheSize >::avail | ( | ) | const |
Returns number of bytes available for reading in cache after rewinding.
Definition at line 135 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().
size_t Ogre::StaticCache< cacheSize >::cacheData | ( | const void * | buf, | |
size_t | count | |||
) |
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 62 of file OgreDataStream.h.
void Ogre::StaticCache< cacheSize >::clear | ( | void | ) |
Clear the cache.
Definition at line 141 of file OgreDataStream.h.
Referenced by Ogre::StaticCache< 16 *OGRE_STREAM_TEMP_SIZE >::ff(), and Ogre::StaticCache< 16 *OGRE_STREAM_TEMP_SIZE >::rewind().
bool Ogre::StaticCache< cacheSize >::ff | ( | size_t | count | ) |
Step forward in cached stream by 'count' bytes.
Returns 'true' if cache contains resulting position.
Definition at line 120 of file OgreDataStream.h.
size_t Ogre::StaticCache< cacheSize >::read | ( | void * | buf, | |
size_t | count | |||
) |
Read data from cache to 'buf' (maximum 'count' bytes).
Returns number of bytes read from cache.
Definition at line 96 of file OgreDataStream.h.
bool Ogre::StaticCache< cacheSize >::rewind | ( | size_t | count | ) |
Step back in cached stream by 'count' bytes.
Returns 'true' if cache contains resulting position.
Definition at line 106 of file OgreDataStream.h.
char Ogre::StaticCache< cacheSize >::mBuffer[cacheSize] [protected] |
Static buffer.
Definition at line 45 of file OgreDataStream.h.
Referenced by Ogre::StaticCache< 16 *OGRE_STREAM_TEMP_SIZE >::cacheData(), and Ogre::StaticCache< 16 *OGRE_STREAM_TEMP_SIZE >::read().
size_t Ogre::StaticCache< cacheSize >::mPos [protected] |
Current read position.
Definition at line 50 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().
size_t Ogre::StaticCache< cacheSize >::mValidBytes [protected] |
Number of bytes valid in cache (written from the beginning of static buffer).
Definition at line 48 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().
Copyright © 2012 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Fri May 25 23:37:18 2012