Utils::CalitkoMocks::DelayedCallDriver< OuterExpectationDriver, Function > Class Template Reference

#include <DelayedCallDriver.h> [code]

List of all members.


Detailed Description

template<typename OuterExpectationDriver, typename Function>
class Utils::CalitkoMocks::DelayedCallDriver< OuterExpectationDriver, Function >

A DelayedCallDriver differs from a CallDriver in that it does not own its underlying BoundFunction because the BoundFunction object is owned by the a ExpectedFunction object, which is supposed to call it later. DelayedCallDriver has the same set of functions that CallDriver has but some of them have slightly different signatures, and return different contexts.

DelayedCallDriver objects are created by ExpectationDriver objects when a call back to the object under test needs to be modeled from a mock object. Using the DelayedCallDriver object further expectations for the environment can be modelled. The functions willReturn() and willReturnVoid() can be used to switch back to the context of the outer ExpectationDriver.

There was the idea to use a mixin base class in order to avoid some (though not all) code duplication in CallDriver and DelayedCallDriver, but that wouldn't work for a few reasons: DelayedCallDriver takes two template arguments, whereas CallDriver takes only one; CallDriver might own the underlying BoundFunction and in contrast DelayedCallDriver never does.

Definition at line 57 of file DelayedCallDriver.h.

Public Types

typedef Function::ReturnType ReturnType

Public Member Functions

 DelayedCallDriver (OuterExpectationDriver &expectationDriver_, Function &f_)
template<typename Foo>
ExpectationDriver< DelayedCallDriver,
ExpectedFunction< Foo > > 
willCall (ExpectationPair< ExpectedFunction< Foo > > expectation)
 Express the expectation that a function will be called.
template<typename Foo>
ExpectationDriver< DelayedCallDriver,
ExpectedFunction< Foo > > 
willCallMsg (ExpectationPair< ExpectedFunction< Foo > > expectation, const std::string &expressionString, const SourceLine &sourceLine)
OuterExpectationDriver & willReturn (const ReturnTypeWrapper< ReturnType > &returnValue)
 Express the expectation for the return value of the bound function.
OuterExpectationDriver & willReturnMsg (const ReturnTypeWrapper< ReturnType > &returnValue, const std::string &expressionString, const SourceLine &sourceLine)
OuterExpectationDriver & returns ()
 Express the expectation that the bound function returns void.
template<typename Foo>
DelayedCallDriverwillEmit (ExpectationPair< ExpectedFunction< Foo > > expectation)
 Express the expectation that a signal is emitted form bound function.
template<typename Foo>
DelayedCallDriverwillEmitMsg (ExpectationPair< ExpectedFunction< Foo > > expectation, const std::string &expressionString, const SourceLine &sourceLine)

Protected Attributes

Function & f
OuterExpectationDriver & outerExpectationDriver


Member Typedef Documentation

template<typename OuterExpectationDriver, typename Function>
typedef Function::ReturnType Utils::CalitkoMocks::DelayedCallDriver< OuterExpectationDriver, Function >::ReturnType
 

Definition at line 60 of file DelayedCallDriver.h.


Constructor & Destructor Documentation

template<typename OuterExpectationDriver, typename Function>
Utils::CalitkoMocks::DelayedCallDriver< OuterExpectationDriver, Function >::DelayedCallDriver OuterExpectationDriver &  expectationDriver_,
Function &  f_
[inline]
 

Definition at line 62 of file DelayedCallDriver.h.


Member Function Documentation

template<typename OuterExpectationDriver, typename Function>
OuterExpectationDriver& Utils::CalitkoMocks::DelayedCallDriver< OuterExpectationDriver, Function >::returns  )  [inline]
 

Express the expectation that the bound function returns void.

Definition at line 116 of file DelayedCallDriver.h.

template<typename OuterExpectationDriver, typename Function>
template<typename Foo>
ExpectationDriver<DelayedCallDriver, ExpectedFunction <Foo> > Utils::CalitkoMocks::DelayedCallDriver< OuterExpectationDriver, Function >::willCall ExpectationPair< ExpectedFunction< Foo > >  expectation  )  [inline]
 

Express the expectation that a function will be called.

This overload gets called when we want to model the expectation that a function of a mock object gets called.

Definition at line 72 of file DelayedCallDriver.h.

template<typename OuterExpectationDriver, typename Function>
template<typename Foo>
ExpectationDriver<DelayedCallDriver, ExpectedFunction <Foo> > Utils::CalitkoMocks::DelayedCallDriver< OuterExpectationDriver, Function >::willCallMsg ExpectationPair< ExpectedFunction< Foo > >  expectation,
const std::string &  expressionString,
const SourceLine &  sourceLine
[inline]
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 86 of file DelayedCallDriver.h.

template<typename OuterExpectationDriver, typename Function>
template<typename Foo>
DelayedCallDriver& Utils::CalitkoMocks::DelayedCallDriver< OuterExpectationDriver, Function >::willEmit ExpectationPair< ExpectedFunction< Foo > >  expectation  )  [inline]
 

Express the expectation that a signal is emitted form bound function.

Definition at line 124 of file DelayedCallDriver.h.

template<typename OuterExpectationDriver, typename Function>
template<typename Foo>
DelayedCallDriver& Utils::CalitkoMocks::DelayedCallDriver< OuterExpectationDriver, Function >::willEmitMsg ExpectationPair< ExpectedFunction< Foo > >  expectation,
const std::string &  expressionString,
const SourceLine &  sourceLine
[inline]
 

Definition at line 138 of file DelayedCallDriver.h.

template<typename OuterExpectationDriver, typename Function>
OuterExpectationDriver& Utils::CalitkoMocks::DelayedCallDriver< OuterExpectationDriver, Function >::willReturn const ReturnTypeWrapper< ReturnType > &  returnValue  )  [inline]
 

Express the expectation for the return value of the bound function.

Definition at line 96 of file DelayedCallDriver.h.

template<typename OuterExpectationDriver, typename Function>
OuterExpectationDriver& Utils::CalitkoMocks::DelayedCallDriver< OuterExpectationDriver, Function >::willReturnMsg const ReturnTypeWrapper< ReturnType > &  returnValue,
const std::string &  expressionString,
const SourceLine &  sourceLine
[inline]
 

Definition at line 107 of file DelayedCallDriver.h.


Member Data Documentation

template<typename OuterExpectationDriver, typename Function>
Function& Utils::CalitkoMocks::DelayedCallDriver< OuterExpectationDriver, Function >::f [protected]
 

Definition at line 147 of file DelayedCallDriver.h.

template<typename OuterExpectationDriver, typename Function>
OuterExpectationDriver& Utils::CalitkoMocks::DelayedCallDriver< OuterExpectationDriver, Function >::outerExpectationDriver [protected]
 

Definition at line 148 of file DelayedCallDriver.h.


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