Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | Related Pages | Search for

# eoUnaryFunctorCounter< UnaryFunctor > Class Template Reference

Generic counter class that counts the number of times a unary function is used. More...

`#include <eoCounter.h>`

Inheritance diagram for eoUnaryFunctorCounter< UnaryFunctor >:

List of all members.

## Public Member Functions
| eoUnaryFunctorCounter (UnaryFunctor &_func, std::string _name="uf_counter")
UnaryFunctor::result_type | operator() (typename UnaryFunctor::first_argument_type _arg1)
| Calls the embedded function and increments the counter.
## Private Attributes
UnaryFunctor & | func

## Detailed Description

### template<class UnaryFunctor>
class eoUnaryFunctorCounter< UnaryFunctor >

Generic counter class that counts the number of times a unary function is used.

Add a unary function through its ctor and use this class instead of it.

It is derived from eoValueParam so you can add it to a monitor.

Example: suppose you have an eoEvalFunc called myeval, to count the number of evaluations, just define:

eoUnaryFunctorCounter<void, EoType> evalCounter(myeval);

and use evalCounter now instead of myeval.

Definition at line 95 of file eoCounter.h.

## Member Function Documentation

template<class UnaryFunctor>
UnaryFunctor::result_type eoUnaryFunctorCounter< UnaryFunctor >::operator() | ( | typename UnaryFunctor::first_argument_type | _arg1 | ) | `[inline]`

| Calls the embedded function and increments the counter. Note for MSVC users, if this code does not compile, you are quite likely trying to count a function that has a non-void return type. Don't look at us, look at the MSVC builders. Code like "return void;" is perfectly legal according to the ANSI standard, but the guys at Microsoft didn't get to implementing it yet. We had two choices: assuming (and compiling ) code that returns void or code that returns non-void. Given that in EO most functors return void, it was chosen to support void. But also please let me know if you have a compiler that defines _MSC_VER (lot's of windows compilers do), but is quite capable of compiling return void; type of code. We'll try to change the signature then. You happy GNU (and other compiler) users will not have a problem with this. Definition at line 118 of file eoCounter.h. References eoValueParam< unsigned long >::value().

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

- eoCounter.h