EvolvingObjects
|
Generic counter class that counts the number of times a binary function is used. More...
#include <eoCounter.h>
Public Member Functions | |
eoBinaryFunctorCounter (BinaryFunctor &_func, std::string _name="proc_counter") | |
BinaryFunctor::result_type | operator() (typename BinaryFunctor::first_argument_type _arg1, typename BinaryFunctor::second_argument_type _arg2) |
Calls the embedded function and increments the counter. | |
Private Attributes | |
BinaryFunctor & | func |
Generic counter class that counts the number of times a binary function is used.
Add a binary function through its ctor and use this class instead of it.
It is derived from eoValueParam so you can add it to a monitor.
Definition at line 144 of file eoCounter.h.
BinaryFunctor::result_type eoBinaryFunctorCounter< BinaryFunctor >::operator() | ( | typename BinaryFunctor::first_argument_type | _arg1, |
typename BinaryFunctor::second_argument_type | _arg2 | ||
) | [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 168 of file eoCounter.h.
References eoValueParam< unsigned long >::value().