hpp::statistics::Statistics< T > Class Template Reference

Template class to do statistics. More...

#include <hpp/statistics/fwd.hh>

Public Types

typedef std::list< T > Container
 
typedef Container::iterator iterator
 
typedef Container::const_iterator const_iterator
 

Public Member Functions

virtual size_t freq (const T &bin) const
 Return the number of occurence of a Bin. More...
 
virtual Proba_t relativeFreq (const T &bin) const
 Return the relative frequency of a Bin. More...
 
unsigned int numberOfObservations () const
 Return the number of times a observation has recorded. More...
 
virtual std::ostream & print (std::ostream &os) const
 Put the results in a stream. More...
 
const_iterator find (const T &bin) const
 
template<typename U >
const_iterator find (const U &value) const
 
const_iterator begin () const
 Return an iterator pointing at the beginning of the set of bins. More...
 
const_iterator end () const
 Return an iterator pointing at the end of the set of bins. More...
 

Protected Member Functions

 Statistics ()
 Constructor. More...
 
virtual T & increment (const T &bin) __attribute__((deprecated))
 Increment a Bin. More...
 
virtual iterator insert (const T &bin)
 insert a Bin. More...
 

Detailed Description

template<typename T>
class hpp::statistics::Statistics< T >

Template class to do statistics.

You should derivate class Bin and construct a class Statistics < YourBin >.

Member Typedef Documentation

◆ const_iterator

template<typename T>
typedef Container::const_iterator hpp::statistics::Statistics< T >::const_iterator

◆ Container

template<typename T>
typedef std::list< T > hpp::statistics::Statistics< T >::Container

◆ iterator

template<typename T>
typedef Container::iterator hpp::statistics::Statistics< T >::iterator

Constructor & Destructor Documentation

◆ Statistics()

template<typename T >
hpp::statistics::Statistics< T >::Statistics ( )
protected

Constructor.

Member Function Documentation

◆ begin()

template<typename T>
const_iterator hpp::statistics::Statistics< T >::begin ( ) const
inline

Return an iterator pointing at the beginning of the set of bins.

Referenced by hpp::statistics::Statistics< SuccessBin >::increment(), and hpp::statistics::Statistics< SuccessBin >::insert().

◆ end()

template<typename T>
const_iterator hpp::statistics::Statistics< T >::end ( ) const
inline

Return an iterator pointing at the end of the set of bins.

Referenced by hpp::statistics::Statistics< SuccessBin >::find().

◆ find() [1/2]

template<typename T>
Statistics< T >::const_iterator hpp::statistics::Statistics< T >::find ( const T &  bin) const

◆ find() [2/2]

template<typename T >
template<typename U >
Statistics< T >::const_iterator hpp::statistics::Statistics< T >::find ( const U &  value) const

◆ freq()

template<typename T>
size_t hpp::statistics::Statistics< T >::freq ( const T &  bin) const
virtual

Return the number of occurence of a Bin.

Parameters
bina Bin for which only the value is useful.
Note
It searches for the equivalent Bin is the set and returns the frequency of the result.

Referenced by hpp::statistics::Statistics< SuccessBin >::freq(), and hpp::statistics::Statistics< SuccessBin >::relativeFreq().

◆ increment()

template<typename T>
T & hpp::statistics::Statistics< T >::increment ( const T &  bin)
protectedvirtual

Increment a Bin.

Note
bin is inserted in the set of bins if it was not already in the set.

◆ insert()

template<typename T>
Statistics< T >::iterator hpp::statistics::Statistics< T >::insert ( const T &  bin)
protectedvirtual

insert a Bin.

Note
bin is inserted in the set of bins if it was not already in the set.

◆ numberOfObservations()

template<typename T>
unsigned int hpp::statistics::Statistics< T >::numberOfObservations ( ) const
inline

Return the number of times a observation has recorded.

It is the total number of observations.

◆ print()

template<typename T >
std::ostream & hpp::statistics::Statistics< T >::print ( std::ostream &  os) const
virtual

Put the results in a stream.

◆ relativeFreq()

template<typename T>
Proba_t hpp::statistics::Statistics< T >::relativeFreq ( const T &  bin) const
virtual

Return the relative frequency of a Bin.

Parameters
bina Bin for which only the value is useful.
Note
It searches for the equivalent Bin is the set and returns the frequency of the result.