LRT14
1.0
|
Basic class to keep track of cached values. More...
#include <CachedValue.h>
Public Member Functions | |
CachedValue (T initialValue, int cacheCycles=12) | |
Constructs a new cached value object with an initial value. | |
CachedValue () | |
Constructs a new cached value object. | |
void | setValue (T newValue) |
Set a new value to be cached, automatically sets the new value flag. | |
T | getValue () |
Gets the most recent cached value and clears the new value flag. | |
T | peek () |
Gets the most recent cached value. | |
void | uncache () |
Forcibly sets the new value flag. | |
void | incrementCounter () |
Increments the internal cycle counter. | |
void | enableCaching (int cacheCycles=-1) |
Enables caching, defaults to previous setting of cache cycles. | |
void | disableCaching () |
Disables caching. | |
bool | hasNewValue () |
bool | hasValue () |
bool | isCaching () |
Basic class to keep track of cached values.
CachedValue< T >::CachedValue | ( | T | initialValue, |
int | cacheCycles = 12 |
||
) |
Constructs a new cached value object with an initial value.
initialValue | the initial cached value |
cacheCycles | the number of cycles before automatic refresh |
void CachedValue< T >::enableCaching | ( | int | cacheCycles = -1 | ) |
Enables caching, defaults to previous setting of cache cycles.
cacheCycles | number of cycles to cache |
T CachedValue< T >::getValue | ( | ) |
Gets the most recent cached value and clears the new value flag.
bool CachedValue< T >::hasNewValue | ( | ) |
Flag for new or updated cache value
bool CachedValue< T >::hasValue | ( | ) |
Flag for existance of value
bool CachedValue< T >::isCaching | ( | ) |
Flag for whether or not caching is enabled
T CachedValue< T >::peek | ( | ) |
Gets the most recent cached value.
void CachedValue< T >::setValue | ( | T | newValue | ) |
Set a new value to be cached, automatically sets the new value flag.
newValue | the new value to be cached |