StatHandler< SH > Class Template Reference

A class to compute and store the summary statistics associated with a SimComponent. More...

#include <stathandler.h>

Inheritance diagram for StatHandler< SH >:

Inheritance graph
[legend]
Collaboration diagram for StatHandler< SH >:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 StatHandler ()
virtual ~StatHandler ()
virtual void clear ()
 Empties the _recorders list, they are destroyed in StatHandlerBase::reset().
virtual void execute ()
 Computes the stats by executing the function variables stored in the StatRecorder's.
virtual void add (std::string Title, std::string Name, st_order Order, age_t AGE, unsigned int ARG, double(SH::*getStat)(void), double(SH::*getStatBoolArg)(bool), double(SH::*getStatUintArg)(unsigned int), void(SH::*setStat)(void))
 Adds a StatRecorder to the list, it is also added to the StatHandlerBase::_stats list.

Protected Types

typedef std::list
< StatRecorder< SH >
* >::iterator 
REC_IT

Protected Attributes

std::list< StatRecorder< SH > * > _recorders
 The list of stat recorders.


Detailed Description

template<class SH>
class StatHandler< SH >

A class to compute and store the summary statistics associated with a SimComponent.

The template type must be the type of the class that declares the methods linked into the StatRecorder elements.

Definition at line 132 of file stathandler.h.


Member Typedef Documentation

template<class SH>
typedef std::list< StatRecorder<SH>* >::iterator StatHandler< SH >::REC_IT [protected]

Definition at line 138 of file stathandler.h.


Constructor & Destructor Documentation

template<class SH>
StatHandler< SH >::StatHandler (  )  [inline]

Definition at line 142 of file stathandler.h.

00142 { }

template<class SH>
virtual StatHandler< SH >::~StatHandler (  )  [inline, virtual]

Definition at line 144 of file stathandler.h.

00144 { }


Member Function Documentation

template<class SH>
virtual void StatHandler< SH >::add ( std::string  Title,
std::string  Name,
st_order  Order,
age_t  AGE,
unsigned int  ARG,
double(SH::*)(void)  getStat,
double(SH::*)(bool)  getStatBoolArg,
double(SH::*)(unsigned int)  getStatUintArg,
void(SH::*)(void)  setStat 
) [inline, virtual]

Adds a StatRecorder to the list, it is also added to the StatHandlerBase::_stats list.

Two types of function variables are passed to this function. The "getter" and "setter". A "getter" returns a double value that will be stored in the StatRecorder structure. It may or may not take an argument. Only one getter should be passed to the stat recorder. The setter is used to set variables in the SH class which are then read by the getter. A setter and a getter may be given together but a setter alone will issue an error at runtime as no getter is present in the stat recorder.

Parameters:
Title the stat title (as shown in the R frontend fro eg.)
Name the stat name (headers in the stat output file)
Order stat table ordering flag
AGE the age class for which the stat will be recorded
ARG the argument to pass to the SH function
getStat function ptr to a SH getter
getStatBoolArg function ptr to a SH getter with boolean argument
getStatUintArg function ptr to a SH getter with unsigned int argument
setStat function ptr to a SH setter

Definition at line 166 of file stathandler.h.

Referenced by StatHandler< TTDeletMutBitstrSH >::add().

00169   {
00170     StatRecorder<SH>* new_rec = new StatRecorder<SH>(this->get_nrows(),this->get_ncols());
00171     
00172     new_rec->set(Title,Name,Order,AGE,ARG,getStat,getStatBoolArg,getStatUintArg,setStat);
00173     
00174     _recorders.push_back(new_rec);
00175     
00176     StatHandlerBase::add(new_rec);
00177   }

template<class SH>
virtual void StatHandler< SH >::clear (  )  [inline, virtual]

Empties the _recorders list, they are destroyed in StatHandlerBase::reset().

Implements StatHandlerBase.

Definition at line 146 of file stathandler.h.

00146 {_recorders.clear();}

template<class SH>
virtual void StatHandler< SH >::execute (  )  [virtual]

Computes the stats by executing the function variables stored in the StatRecorder's.

Implements StatHandlerBase.


Member Data Documentation

template<class SH>
std::list<StatRecorder<SH>*> StatHandler< SH >::_recorders [protected]


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

Generated for Nemo v2.1.2 by  doxygen 1.5.8 -- Nemo is hosted by  SourceForge.net Logo