EvolvingObjects
eoProcedureCounter< Procedure > Class Template Reference

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

#include <eoCounter.h>

Inheritance diagram for eoProcedureCounter< Procedure >:
eoValueParam< unsigned long > eoParam

List of all members.

Public Member Functions

 eoProcedureCounter (Procedure &_proc, std::string _name="proc_counter")
Procedure::result_type operator() (void)
 Calls the embedded function and increments the counter.

Private Attributes

Procedure & proc

Detailed Description

template<class Procedure>
class eoProcedureCounter< Procedure >

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

Add a procedure 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 43 of file eoCounter.h.


Member Function Documentation

template<class Procedure>
Procedure::result_type eoProcedureCounter< Procedure >::operator() ( void  ) [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 66 of file eoCounter.h.

References eoValueParam< unsigned long >::value().


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Friends