LRT14  1.0
 All Classes Namespaces Functions Variables Enumerations Enumerator
CachedValue< T > Class Template Reference

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.
 
getValue ()
 Gets the most recent cached value and clears the new value flag.
 
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 ()
 

Detailed Description

template<class T>
class CachedValue< T >

Basic class to keep track of cached values.

Author
Robert Ying

Constructor & Destructor Documentation

template<class T>
CachedValue< T >::CachedValue ( initialValue,
int  cacheCycles = 12 
)

Constructs a new cached value object with an initial value.

Parameters
initialValuethe initial cached value
cacheCyclesthe number of cycles before automatic refresh

Member Function Documentation

template<class T >
void CachedValue< T >::enableCaching ( int  cacheCycles = -1)

Enables caching, defaults to previous setting of cache cycles.

Parameters
cacheCyclesnumber of cycles to cache
template<class T >
T CachedValue< T >::getValue ( )

Gets the most recent cached value and clears the new value flag.

Returns
the cached value

Here is the caller graph for this function:

template<class T >
bool CachedValue< T >::hasNewValue ( )

Flag for new or updated cache value

Returns
whether or not the cached value has changed

Here is the caller graph for this function:

template<class T >
bool CachedValue< T >::hasValue ( )

Flag for existance of value

Returns
whether or not the cached value has set
template<class T >
bool CachedValue< T >::isCaching ( )

Flag for whether or not caching is enabled

Returns
whether or not caching is enabled
template<class T >
T CachedValue< T >::peek ( )

Gets the most recent cached value.

Returns

Here is the caller graph for this function:

template<class T>
void CachedValue< T >::setValue ( newValue)

Set a new value to be cached, automatically sets the new value flag.

Parameters
newValuethe new value to be cached

Here is the caller graph for this function:


The documentation for this class was generated from the following file: