The Pedigree Project 0.1
Public Member Functions | Private Member Functions | Private Attributes | List of all members
LazyEvaluate< T, M, create, destroy > Class Template Reference

#include <LazyEvaluate.h>

+ Collaboration diagram for LazyEvaluate< T, M, create, destroy >:

Public Member Functions

 LazyEvaluate (const M &metadata)
 
 LazyEvaluate (M &&metadata)
 
 LazyEvaluate (T *value)
 
 LazyEvaluate (T *value, const M &metadata)
 
 LazyEvaluate (T *value, M &&metadata)
 
bool active () const
 
void reset ()
 
T * get ()
 
T * operator-> ()
 
T & operator* ()
 
 operator bool () const
 
 operator bool ()
 
 operator T* ()
 

Private Member Functions

 NOT_COPYABLE_OR_ASSIGNABLE (LazyEvaluate)
 

Private Attributes

M m_Metadata
 
T * m_Field
 
bool m_Ok
 

Detailed Description

template<class T, class M, T *(*)(const M &) create, void(*)(T *) destroy>
class LazyEvaluate< T, M, create, destroy >

LazyEvaluate offers a way to defer potentially-expensive evaluation to the time at which the result of the evaluation is needed. This can allow for reduced memory usage and better performance, especially in cases where many objects are available for evaluation but only a few actually become evaluated.

Parameters
[in]Tthe result type of the evaluation
[in]Mtype for metadata to be passed to creation function
[in]createa function that performs evaluation based on the given metadata
[in]destroya function that cleans up an evaluation if needed

Definition at line 40 of file LazyEvaluate.h.

Constructor & Destructor Documentation

◆ LazyEvaluate() [1/6]

template<class T , class M , T *(*)(const M &) create, void(*)(T *) destroy>
LazyEvaluate< T, M, create, destroy >::LazyEvaluate ( )
inline

Definition at line 43 of file LazyEvaluate.h.

◆ LazyEvaluate() [2/6]

template<class T , class M , T *(*)(const M &) create, void(*)(T *) destroy>
LazyEvaluate< T, M, create, destroy >::LazyEvaluate ( const M &  metadata)
inline

Definition at line 45 of file LazyEvaluate.h.

◆ LazyEvaluate() [3/6]

template<class T , class M , T *(*)(const M &) create, void(*)(T *) destroy>
LazyEvaluate< T, M, create, destroy >::LazyEvaluate ( M &&  metadata)
inline

Definition at line 46 of file LazyEvaluate.h.

◆ LazyEvaluate() [4/6]

template<class T , class M , T *(*)(const M &) create, void(*)(T *) destroy>
LazyEvaluate< T, M, create, destroy >::LazyEvaluate ( T *  value)
inline

Definition at line 49 of file LazyEvaluate.h.

◆ LazyEvaluate() [5/6]

template<class T , class M , T *(*)(const M &) create, void(*)(T *) destroy>
LazyEvaluate< T, M, create, destroy >::LazyEvaluate ( T *  value,
const M &  metadata 
)
inline

Definition at line 50 of file LazyEvaluate.h.

◆ LazyEvaluate() [6/6]

template<class T , class M , T *(*)(const M &) create, void(*)(T *) destroy>
LazyEvaluate< T, M, create, destroy >::LazyEvaluate ( T *  value,
M &&  metadata 
)
inline

Definition at line 51 of file LazyEvaluate.h.

◆ ~LazyEvaluate()

template<class T , class M , T *(*)(const M &) create, void(*)(T *) destroy>
virtual LazyEvaluate< T, M, create, destroy >::~LazyEvaluate ( )
inlinevirtual

Definition at line 53 of file LazyEvaluate.h.

Member Function Documentation

◆ active()

template<class T , class M , T *(*)(const M &) create, void(*)(T *) destroy>
bool LazyEvaluate< T, M, create, destroy >::active ( ) const
inline

Definition at line 57 of file LazyEvaluate.h.

◆ get()

template<class T , class M , T *(*)(const M &) create, void(*)(T *) destroy>
T * LazyEvaluate< T, M, create, destroy >::get ( )
inline

Definition at line 68 of file LazyEvaluate.h.

◆ operator bool() [1/2]

template<class T , class M , T *(*)(const M &) create, void(*)(T *) destroy>
LazyEvaluate< T, M, create, destroy >::operator bool ( )
inline

Definition at line 91 of file LazyEvaluate.h.

◆ operator bool() [2/2]

template<class T , class M , T *(*)(const M &) create, void(*)(T *) destroy>
LazyEvaluate< T, M, create, destroy >::operator bool ( ) const
inline

Definition at line 86 of file LazyEvaluate.h.

◆ operator T*()

template<class T , class M , T *(*)(const M &) create, void(*)(T *) destroy>
LazyEvaluate< T, M, create, destroy >::operator T* ( )
inline

Definition at line 95 of file LazyEvaluate.h.

◆ operator*()

template<class T , class M , T *(*)(const M &) create, void(*)(T *) destroy>
T & LazyEvaluate< T, M, create, destroy >::operator* ( )
inline

Definition at line 82 of file LazyEvaluate.h.

◆ operator->()

template<class T , class M , T *(*)(const M &) create, void(*)(T *) destroy>
T * LazyEvaluate< T, M, create, destroy >::operator-> ( )
inline

Definition at line 78 of file LazyEvaluate.h.

◆ reset()

template<class T , class M , T *(*)(const M &) create, void(*)(T *) destroy>
void LazyEvaluate< T, M, create, destroy >::reset ( )
inline

Definition at line 61 of file LazyEvaluate.h.

Member Data Documentation

◆ m_Field

template<class T , class M , T *(*)(const M &) create, void(*)(T *) destroy>
T* LazyEvaluate< T, M, create, destroy >::m_Field
private

Definition at line 103 of file LazyEvaluate.h.

◆ m_Metadata

template<class T , class M , T *(*)(const M &) create, void(*)(T *) destroy>
M LazyEvaluate< T, M, create, destroy >::m_Metadata
private

Definition at line 102 of file LazyEvaluate.h.

◆ m_Ok

template<class T , class M , T *(*)(const M &) create, void(*)(T *) destroy>
bool LazyEvaluate< T, M, create, destroy >::m_Ok
private

Definition at line 104 of file LazyEvaluate.h.


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