senf::StatisticsBase::StatisticsBase::OutputProxy< Owner > Class Template Reference
[Statistics]

Output connection interface. More...

#include <senf/Utils/Statistics.hh>

List of all members.


Detailed Description

template<class Owner>
class senf::StatisticsBase::OutputProxy< Owner >

Output connection interface.

This class is returned from senf::StatisticsBase::output() and the derived output() implementations to allow connecting an output with an arbitrary target.

There are two types of targets:

  • Externally managed targets. These targets live outside of the statistics module, just a reference to those targets is saved. The target should derive from boost::signals::trackable to ensure they are automatically disconnected when destroyed.
  • Internally managed targets. Those targets are owned by the statistics module and will be destroyed when the statistics class is destroyed.
Externally managed targets are passed by non-const reference to connect(), internally managed targets are passed using std::auto_ptr.

A target is any callable object which takes three float values as argument: The current minimum, average and maximum value.

// Simple function as statistics target
void collect(float min, float avg, float max)
    { ... }

// Function object
struct Collector
{
    void operator()(float min, float avg, float max, float dev)
        { ... }
};

Definition at line 124 of file Statistics.hh.


Public Member Functions

template<class Target >
Owner &  connect (Target &target, std::string label="") const
  Connect externally managed target.
template<class PTarget >
Owner &  connect (std::auto_ptr< PTarget > target, std::string label="") const
  Connect internally managed target.
Owner &  noconnect () const
  Don't connect the output.
senf::console::ScopedDirectory dir () const
  Get target's console directory.

Member Function Documentation

template<class Owner >
template<class PTarget >
Owner & senf::StatisticsBase::StatisticsBase::OutputProxy< Owner >::
connect ( std::auto_ptr< PTarget >  target,
std::string  label = "" )

Connect internally managed target.

Definition at line 63 of file Statistics.cti.

template<class Owner >
template<class Target >
Owner & senf::StatisticsBase::StatisticsBase::OutputProxy< Owner >::
connect ( Target &  target,
std::string  label = "" )

Connect externally managed target.

Definition at line 50 of file Statistics.cti.

template<class Owner >
senf::console::ScopedDirectory & senf::StatisticsBase::StatisticsBase::OutputProxy< Owner >::
dir ()

Get target's console directory.

Definition at line 82 of file Statistics.cti.

template<class Owner >
Owner & senf::StatisticsBase::StatisticsBase::OutputProxy< Owner >::
noconnect ()

Don't connect the output.

Definition at line 75 of file Statistics.cti.


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