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

VCF::DelegateR< ReturnType > Class Template Reference

The base calss for delegates that return a value from a function. More...

#include <vcf/FoundationKit/Delegates.h>

Inheritance diagram for VCF::DelegateR< ReturnType >:

VCF::Delegate VCF::AsyncReturns VCF::FunctionTypeInfo List of all members.

Public Types

typedef Function< ReturnType > CallbackType
typedef _typename_ CallbackType::FuncPtr FuncPtr
typedef std::vector< ReturnType > Results

Public Member Functions

 DelegateR ()
virtual ~DelegateR ()
DelegateR< ReturnType > & operator+= (FuncPtr rhs)
DelegateR< ReturnType > & operator+= (CallBack *rhs)
virtual const std::type_info & getReturnType () const
 Returns a type_info that represents the return type defined by ReturnType.
virtual TypeArray getArgumentTypes () const
ReturnType operator() ()
ReturnType invoke ()
 invokes the delegate and iterates through it's list of callbacks.
AsyncResultbeginInvoke (AsyncCallback *callback)
ReturnType endInvoke (AsyncResult *asyncResult)
 Gets the result for the AsyncResult instance that was returned by the previous call to beginInvoke().
Results endInvokeWithResults (AsyncResult *asyncResult)
 Gets the results for the AsyncResult instance that was returned by the previous call to beginInvoke().

Public Attributes

Results results

Protected Member Functions

virtual void functionFinished (AsyncResult *, Runnable *runnable)

Protected Attributes

ResultsCache< ReturnType > resultsCache_

Detailed Description

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

The base calss for delegates that return a value from a function.

This delegate returns a value of type ReturnType but has no arguments.

The delegate stores all the return values in a vector of type ReturnType. You can access the values via the results member variable which is marked as public.

When the invoke() method returns the results vector will have been populated with all the return values from the callbacks, stored in the order the callbacks were called in. The return result for invoke() is the return value of the last callback.

If the delegate is invoked asynchronously with beingInvoke() then if you want to get the return value(s) you need ot call either endInvoke(), or endInvokeWithResults() to get all the return values.


Member Typedef Documentation

template<typename ReturnType>
typedef Function<ReturnType> VCF::DelegateR< ReturnType >::CallbackType
 

template<typename ReturnType>
typedef _typename_ CallbackType::FuncPtr VCF::DelegateR< ReturnType >::FuncPtr
 

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


Constructor & Destructor Documentation

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

template<typename ReturnType>
virtual VCF::DelegateR< ReturnType >::~DelegateR  )  [inline, virtual]
 


Member Function Documentation

template<typename ReturnType>
AsyncResult* VCF::DelegateR< ReturnType >::beginInvoke AsyncCallback callback  )  [inline]
 

template<typename ReturnType>
ReturnType VCF::DelegateR< ReturnType >::endInvoke AsyncResult asyncResult  )  [inline]
 

Gets the result for the AsyncResult instance that was returned by the previous call to beginInvoke().

Returns:
ReturnType returns the return value of the last callback.

template<typename ReturnType>
DelegateR< ReturnType >::Results VCF::DelegateR< ReturnType >::endInvokeWithResults AsyncResult asyncResult  )  [inline]
 

Gets the results for the AsyncResult instance that was returned by the previous call to beginInvoke().

Returns:
Results returns an a array of results, reprepresenting all the return values for each callback that was called. The collection is a vector of ReturnType.

template<typename ReturnType>
void VCF::DelegateR< ReturnType >::functionFinished AsyncResult ,
Runnable runnable
[inline, protected, virtual]
 

Implements VCF::AsyncReturns.

template<typename ReturnType>
virtual TypeArray VCF::DelegateR< ReturnType >::getArgumentTypes  )  const [inline, virtual]
 

Reimplemented from VCF::FunctionTypeInfo.

template<typename ReturnType>
virtual const std::type_info& VCF::DelegateR< ReturnType >::getReturnType  )  const [inline, virtual]
 

Returns a type_info that represents the return type defined by ReturnType.

Reimplemented from VCF::FunctionTypeInfo.

template<typename ReturnType>
ReturnType VCF::DelegateR< ReturnType >::invoke  )  [inline]
 

invokes the delegate and iterates through it's list of callbacks.

Returns:
ReturnType returns the return value of the last callback.

template<typename ReturnType>
ReturnType VCF::DelegateR< ReturnType >::operator()  )  [inline]
 

template<typename ReturnType>
DelegateR<ReturnType>& VCF::DelegateR< ReturnType >::operator+= CallBack rhs  )  [inline]
 

template<typename ReturnType>
DelegateR<ReturnType >& VCF::DelegateR< ReturnType >::operator+= FuncPtr  rhs  )  [inline]
 


Member Data Documentation

template<typename ReturnType>
Results VCF::DelegateR< ReturnType >::results
 

template<typename ReturnType>
ResultsCache<ReturnType> VCF::DelegateR< ReturnType >::resultsCache_ [protected]
 


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