rpa::unary_function_count< Ftor > Class Template Reference

Counts the number of times that a functor was called. More...

#include <functional.h>

List of all members.

Public Types

typedef Ftor::result_type result_type
typedef Ftor::argument_type argument_type

Public Member Functions

 unary_function_count ()
result_type operator() (const argument_type &aArg)
bool operator== (const unary_function_count &aUFC) const

Private Types

typedef atomic< size_t > atom_type
 This atomic type used a a counter of function calls.

Private Attributes

atom_type::atomic_type _cnt


Detailed Description

template<class Ftor>
class rpa::unary_function_count< Ftor >

Counts the number of times that a functor was called.

This allows to check that algorithms work correctly : Typically, a functor must be called once per input element, whatever the number of threads is, or if the algorithm is called sequentially. Therefore, we can have a better proof that at the end of a parallel computation, things worked properly.


Member Typedef Documentation

template<class Ftor>
typedef Ftor::argument_type rpa::unary_function_count< Ftor >::argument_type

template<class Ftor>
typedef atomic<size_t> rpa::unary_function_count< Ftor >::atom_type [private]

This atomic type used a a counter of function calls.

template<class Ftor>
typedef Ftor::result_type rpa::unary_function_count< Ftor >::result_type


Constructor & Destructor Documentation

template<class Ftor>
rpa::unary_function_count< Ftor >::unary_function_count (  )  [inline]

The same functor may be called simultaneously by several threads. Therefore the need of an atomic counter.


Member Function Documentation

template<class Ftor>
result_type rpa::unary_function_count< Ftor >::operator() ( const argument_type aArg  )  [inline]

template<class Ftor>
bool rpa::unary_function_count< Ftor >::operator== ( const unary_function_count< Ftor > &  aUFC  )  const [inline]


Member Data Documentation

template<class Ftor>
atom_type::atomic_type rpa::unary_function_count< Ftor >::_cnt [private]


The documentation for this class was generated from the following file:
Generated on Tue Sep 25 10:20:38 2007 for rpa by  doxygen 1.4.7