glotzmath::ConstHistogram< T > Class Template Reference

a histogram with a constant size More...

#include <ConstHistogram.h>

List of all members.

Public Member Functions

 ConstHistogram (T min, T step, T max)
 Constructor taking two arguments.
 ~ConstHistogram ()
 ConstHistogram (ConstHistogram< T > &rhs)
 Copy constructor.
void operator+= (T value)
 insert a datapoint into the histogram
void operator-= (T value)
 removes a datapoint into the histogram
void Insert (T value)
 insert a datapoint into the histogram
void Insert (T value, double weight)
 insert a datapoint into the histogram
void Remove (T value)
 removes a datapoint into the histogram
void Remove (T value, double weight)
 removes a datapoint into the histogram
double & operator[] (int i) const
 indexing operator
void Clear ()
 Clears the contents of the bins.
void Reset ()
 Clears the contents of the bins.
void Print ()
 Prints the histogram to the stdout.
void Print (std::ostream &os)
int GetNumberOfBins () const

Protected Attributes

int mNbins
 Number of bins.
mInc
 Increment.
mMin
 Minimum value.
mMax
 Maximum value.
mInvRange
 1 over the range of values
bool mShowWarnings
 Indicates whether warnings should be displayed.
double * mWeightOfBin
 Bin weight (number of datapoints in each bin).


Detailed Description

template<class T>
class glotzmath::ConstHistogram< T >

a histogram with a constant size

Author:
Aaron Keys
        #include <stdlib.h>                                                     //gives us the drand48() random number generator
        #include <iostream>                                                     //gives us std::cerr
        #include <glotzmath.h>
        using namespace glotzmath;
        
        int main()
        {
                ConstHistogram <double> h(0, 0.1, 1);   //histogram "h" binning values of type double, binsize 0.1, interval [0,1]
                h.Insert(drand48());                                    //insert a random double [0,1]
                h += drand48();                                                 //another way to add a value to h
                h.Remove(drand48());                                    //de-increment the bin containing a number
                h -= drand48();                                                 //another way to do it
                h.Print();                                                              //Print to stdout
                h.Print(std::cerr);                                             //Print to stderr
        }

Constructor & Destructor Documentation

template<class T>
glotzmath::ConstHistogram< T >::ConstHistogram ( min,
step,
max 
) [inline]

Constructor taking two arguments.

Parameters:
min is the minimum of the histogram
max is the max of the histogram

template<class T>
glotzmath::ConstHistogram< T >::~ConstHistogram (  )  [inline]

template<class T>
glotzmath::ConstHistogram< T >::ConstHistogram ( ConstHistogram< T > &  rhs  )  [inline]

Copy constructor.

Parameters:
rhs is another histogram of equal size


Member Function Documentation

template<class T>
void glotzmath::ConstHistogram< T >::operator+= ( value  )  [inline]

insert a datapoint into the histogram

Parameters:
value is the value of the datapoint
See also:
Insert

template<class T>
void glotzmath::ConstHistogram< T >::operator-= ( value  )  [inline]

removes a datapoint into the histogram

Parameters:
value is the value of the datapoint
See also:
Remove

template<class T>
void glotzmath::ConstHistogram< T >::Insert ( value  )  [inline]

insert a datapoint into the histogram

Parameters:
value is the value of the datapoint

template<class T>
void glotzmath::ConstHistogram< T >::Insert ( value,
double  weight 
) [inline]

insert a datapoint into the histogram

Parameters:
value is the value of the datapoint
weight is the weight of the datapoint

template<class T>
void glotzmath::ConstHistogram< T >::Remove ( value  )  [inline]

removes a datapoint into the histogram

Parameters:
value is the value of the datapoint

template<class T>
void glotzmath::ConstHistogram< T >::Remove ( value,
double  weight 
) [inline]

removes a datapoint into the histogram

Parameters:
value is the value of the datapoint

template<class T>
double& glotzmath::ConstHistogram< T >::operator[] ( int  i  )  const [inline]

indexing operator

Parameters:
i is the index to be returned

template<class T>
void glotzmath::ConstHistogram< T >::Clear (  )  [inline]

Clears the contents of the bins.

See also:
Reset()

template<class T>
void glotzmath::ConstHistogram< T >::Reset (  )  [inline]

Clears the contents of the bins.

See also:
Clear()

template<class T>
void glotzmath::ConstHistogram< T >::Print (  )  [inline]

Prints the histogram to the stdout.

template<class T>
void glotzmath::ConstHistogram< T >::Print ( std::ostream &  os  )  [inline]

template<class T>
int glotzmath::ConstHistogram< T >::GetNumberOfBins (  )  const [inline]


Member Data Documentation

template<class T>
int glotzmath::ConstHistogram< T >::mNbins [protected]

Number of bins.

template<class T>
T glotzmath::ConstHistogram< T >::mInc [protected]

Increment.

template<class T>
T glotzmath::ConstHistogram< T >::mMin [protected]

Minimum value.

template<class T>
T glotzmath::ConstHistogram< T >::mMax [protected]

Maximum value.

template<class T>
T glotzmath::ConstHistogram< T >::mInvRange [protected]

1 over the range of values

template<class T>
bool glotzmath::ConstHistogram< T >::mShowWarnings [protected]

Indicates whether warnings should be displayed.

template<class T>
double* glotzmath::ConstHistogram< T >::mWeightOfBin [protected]

Bin weight (number of datapoints in each bin).


The documentation for this class was generated from the following file:
Generated on Tue Feb 24 20:53:39 2009 by  doxygen 1.5.3