MINT2
Public Member Functions | Private Attributes | List of all members
CachedVar< T > Class Template Reference

#include <CachedVar.h>

Public Member Functions

 CachedVar (const T &var=T())
 
void changed ()
 
void updated ()
 
T & get ()
 
const T & get () const
 
CachedVaroperator= (const T &other)
 
 operator const T & ()
 
bool isUpdateNeeded ()
 
 ~CachedVar ()
 

Private Attributes

bool _needsUpdate
 
_cachedVar
 

Detailed Description

template<class T>
class CachedVar< T >

HyperPlot, Author: Sam Harnew, sam.h.nosp@m.arne.nosp@m.w@gma.nosp@m.il.c.nosp@m.om , Date: Dec 2015

Used for variables we want to cache. Provides a flag that tells us when the cached variable needs updating

Definition at line 24 of file CachedVar.h.

Constructor & Destructor Documentation

◆ CachedVar()

template<class T>
CachedVar< T >::CachedVar ( const T &  var = T())

Definition at line 65 of file CachedVar.h.

65  :
66  _needsUpdate(true),
67  _cachedVar(var)
68 {
69 
70 }
bool _needsUpdate
Definition: CachedVar.h:28
T _cachedVar
Definition: CachedVar.h:29

◆ ~CachedVar()

template<class T>
CachedVar< T >::~CachedVar ( )
inline

Definition at line 58 of file CachedVar.h.

58  {
59 
60  }

Member Function Documentation

◆ changed()

template<class T>
void CachedVar< T >::changed ( )
inline

Definition at line 35 of file CachedVar.h.

35  {
36  _needsUpdate = true;
37  }
bool _needsUpdate
Definition: CachedVar.h:28

◆ get() [1/2]

template<class T>
T& CachedVar< T >::get ( )
inline

Definition at line 42 of file CachedVar.h.

42 {return _cachedVar;}
T _cachedVar
Definition: CachedVar.h:29

◆ get() [2/2]

template<class T>
const T& CachedVar< T >::get ( ) const
inline

Definition at line 43 of file CachedVar.h.

43 {return _cachedVar;}
T _cachedVar
Definition: CachedVar.h:29

◆ isUpdateNeeded()

template<class T>
bool CachedVar< T >::isUpdateNeeded ( )
inline

Definition at line 54 of file CachedVar.h.

54  {
55  return _needsUpdate;
56  }
bool _needsUpdate
Definition: CachedVar.h:28

◆ operator const T &()

template<class T>
CachedVar< T >::operator const T & ( )
inline

Definition at line 50 of file CachedVar.h.

50  {
51  return _cachedVar;
52  }
T _cachedVar
Definition: CachedVar.h:29

◆ operator=()

template<class T>
CachedVar& CachedVar< T >::operator= ( const T &  other)
inline

Definition at line 45 of file CachedVar.h.

45  {
46  _cachedVar = other;
47  return *this;
48  }
T _cachedVar
Definition: CachedVar.h:29

◆ updated()

template<class T>
void CachedVar< T >::updated ( )
inline

Definition at line 38 of file CachedVar.h.

38  {
39  _needsUpdate = false;
40  }
bool _needsUpdate
Definition: CachedVar.h:28

Member Data Documentation

◆ _cachedVar

template<class T>
T CachedVar< T >::_cachedVar
private

Definition at line 29 of file CachedVar.h.

◆ _needsUpdate

template<class T>
bool CachedVar< T >::_needsUpdate
private

Definition at line 28 of file CachedVar.h.


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