Utils::CalitkoMocks::ExpectationsList< Function > Class Template Reference

#include <ExpectationsList.h> [code]

Inheritance diagram for Utils::CalitkoMocks::ExpectationsList< Function >:

Inheritance graph
[legend]
List of all members.

Detailed Description

template<typename Function>
class Utils::CalitkoMocks::ExpectationsList< Function >

A list of expected function calls on a mock object.

An object of an template instantiation of this class will be created for each function that a Mock class is supposed to mock. This class provides the functions add() and take() which perfectly suite our needs for the times when we need to create and verify and expectation:

    // Devlare the expectations list object:
    ExpectationsList <ExpectedFunction <int (int)> > expectations_foo;
    ...
    // Add and expected function call to the list:
    expectations_foo.add (new ExpectedFunction <int (int)> (3) // adds the new
                            // object to the list and returns a reference to it
        .willReturn (1);    // stub the return value of the function
    ...
    // Check the expected function call:
    expectations_foo.take() // removes the function from the list and returns it
        .check (3);         // compares the expected with the compared value and
                            // returns the stubbed value

Todo:
To explicitly show that ExpectationsList owns the Function objects have add() take an auto_ptr. Doing so would require all EXPECTED_FUNCTION_FACTORYX macros to be updated.

Definition at line 59 of file ExpectationsList.h.

Public Member Functions

 ExpectationsList ()
 ~ExpectationsList ()
bool empty ()
Function & add (auto_ptr< Function > foo)
Function & take ()

Private Member Functions

 ExpectationsList (const ExpectationsList &)
ExpectationsListoperator= (const ExpectationsList &)

Private Attributes

std::list< Function * > added
std::list< Function * > taken


Constructor & Destructor Documentation

template<typename Function>
Utils::CalitkoMocks::ExpectationsList< Function >::ExpectationsList  )  [inline]
 

Definition at line 62 of file ExpectationsList.h.

template<typename Function>
Utils::CalitkoMocks::ExpectationsList< Function >::~ExpectationsList  )  [inline]
 

Definition at line 67 of file ExpectationsList.h.

template<typename Function>
Utils::CalitkoMocks::ExpectationsList< Function >::ExpectationsList const ExpectationsList< Function > &   )  [private]
 


Member Function Documentation

template<typename Function>
Function& Utils::CalitkoMocks::ExpectationsList< Function >::add auto_ptr< Function >  foo  )  [inline]
 

Definition at line 84 of file ExpectationsList.h.

template<typename Function>
bool Utils::CalitkoMocks::ExpectationsList< Function >::empty  )  [inline]
 

Definition at line 79 of file ExpectationsList.h.

template<typename Function>
ExpectationsList& Utils::CalitkoMocks::ExpectationsList< Function >::operator= const ExpectationsList< Function > &   )  [private]
 

template<typename Function>
Function& Utils::CalitkoMocks::ExpectationsList< Function >::take  )  [inline]
 

Definition at line 92 of file ExpectationsList.h.


Member Data Documentation

template<typename Function>
std::list<Function *> Utils::CalitkoMocks::ExpectationsList< Function >::added [private]
 

Definition at line 116 of file ExpectationsList.h.

template<typename Function>
std::list<Function *> Utils::CalitkoMocks::ExpectationsList< Function >::taken [private]
 

Definition at line 117 of file ExpectationsList.h.


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