Sourceforge.net - The VCF's Project Host
   The VCF Website Home   |   Online Discussion Forums   |   Sourceforge.net Project Page   

VCF::ResultsCache< ReturnType > Class Template Reference

A class that is uses to cache the results of callbacks that return values. More...

#include <vcf/FoundationKit/Delegates.h>

List of all members.

Public Types

typedef std::vector< ReturnType > Results
typedef std::map< AsyncResult *,
Results * > 
CacheMap

Public Member Functions

 ResultsCache ()
 ~ResultsCache ()
void addResult (ReturnType result, AsyncResult *asyncRes)
 this is called by the various implementations of callbacks that return a value when a function is finished.
ReturnType getLastResult (AsyncResult *asyncResult)
 Get's the last result for a given AsyncResult instance.
ResultsgetResults (AsyncResult *asyncResult)
 Gets an instance of the result collection for an AsyncResult instance.

Protected Attributes

Mutex asyncResultsMtx_
CacheMapcache_


Detailed Description

template<typename ReturnType>
class VCF::ResultsCache< ReturnType >

A class that is uses to cache the results of callbacks that return values.

The ResultsCache may be used with delegates that have been fired asynchronously.


Member Typedef Documentation

template<typename ReturnType>
typedef std::map<AsyncResult*,Results*> VCF::ResultsCache< ReturnType >::CacheMap
 

template<typename ReturnType>
typedef std::vector<ReturnType> VCF::ResultsCache< ReturnType >::Results
 


Constructor & Destructor Documentation

template<typename ReturnType>
VCF::ResultsCache< ReturnType >::ResultsCache  )  [inline]
 

template<typename ReturnType>
VCF::ResultsCache< ReturnType >::~ResultsCache  )  [inline]
 


Member Function Documentation

template<typename ReturnType>
void VCF::ResultsCache< ReturnType >::addResult ReturnType  result,
AsyncResult asyncRes
[inline]
 

this is called by the various implementations of callbacks that return a value when a function is finished.

The AsyncResult passed in is used as a key to make sure that the results list that the result is added to is the correct one.

template<typename ReturnType>
ReturnType VCF::ResultsCache< ReturnType >::getLastResult AsyncResult asyncResult  )  [inline]
 

Get's the last result for a given AsyncResult instance.

This is called to get the last result in a collection of possible results, for a given AsyncResult. If you had a delegate that return a value with three callbacks associated with it, then the result list would have 3 possible values in it, stored in the order the callbacks were invoked. This function would return the last result put into the list.

template<typename ReturnType>
Results* VCF::ResultsCache< ReturnType >::getResults AsyncResult asyncResult  )  [inline]
 

Gets an instance of the result collection for an AsyncResult instance.

This may be NULL if there are no results. This will return all the results for the delegate that was invoked asynchronously.


Member Data Documentation

template<typename ReturnType>
Mutex VCF::ResultsCache< ReturnType >::asyncResultsMtx_ [protected]
 

template<typename ReturnType>
CacheMap* VCF::ResultsCache< ReturnType >::cache_ [protected]
 


The documentation for this class was generated from the following file:
   Comments or Suggestions?    License Information