OpenWalnut  1.4.0
Public Member Functions | Protected Attributes
WHistogram Class Reference

Container which associate values with (uniform width) bins (aka intervals or buckets). More...

#include <WHistogram.h>

+ Inheritance diagram for WHistogram:

List of all members.

Public Member Functions

 WHistogram (double min, double max, size_t buckets=1000)
 Default constructor.
 WHistogram (const WHistogram &hist)
 Copy constructor.
virtual ~WHistogram ()
 Default destructor.
virtual size_t operator[] (size_t index) const =0
 Get the count of the specified bucket.
virtual size_t at (size_t index) const =0
 Get the count of the specified bucket.
virtual size_t size () const
 Returns the number of buckets in the histogram with the actual mapping.
virtual double getMinimum () const
 Returns the minimum value.
virtual double getMaximum () const
 Returns the maximum value.
virtual double getBucketSize (size_t index=0) const =0
 Return the size of one specific bucket.
virtual std::pair< double, double > getIntervalForIndex (size_t index) const =0
 Returns the actual interval associated with the given index.

Protected Attributes

double m_minimum
 The smallest value.
double m_maximum
 The biggest value.
double m_nbBuckets
 The number of buckets.

Detailed Description

Container which associate values with (uniform width) bins (aka intervals or buckets).

This class implements the abstract interface and therefore builds the base class for all histogram classes. The interface also allows programming histogram of different bucket sizes.

Definition at line 36 of file WHistogram.h.


Constructor & Destructor Documentation

WHistogram::WHistogram ( double  min,
double  max,
size_t  buckets = 1000 
)

Default constructor.

Creates an empty histogram covering the specified min and max values with the specified number of buckets.

Parameters:
minthe smallest value
maxthe largest value
bucketsthe number of buckets

Definition at line 30 of file WHistogram.cpp.

References m_maximum, and m_minimum.

Copy constructor.

Creates a deep copy of the specified histogram.

Parameters:
histthe histogram to copy.

Definition at line 43 of file WHistogram.cpp.

WHistogram::~WHistogram ( ) [virtual]

Default destructor.

Definition at line 50 of file WHistogram.cpp.


Member Function Documentation

virtual size_t WHistogram::at ( size_t  index) const [pure virtual]

Get the count of the specified bucket.

Testing if the position is valid.

Parameters:
indexwhich buckets count is to be returned; starts with 0 which is the bucket containing the smallest values.
Returns:
elements in the bucket

Implemented in WValueSetHistogram, and WHistogramBasic.

virtual double WHistogram::getBucketSize ( size_t  index = 0) const [pure virtual]

Return the size of one specific bucket.

Parameters:
indexthe width for this bucket is queried.
Returns:
the size of a bucket.

Implemented in WValueSetHistogram, and WHistogramBasic.

virtual std::pair< double, double > WHistogram::getIntervalForIndex ( size_t  index) const [pure virtual]

Returns the actual interval associated with the given index.

The interval is open, meaning that getIntervalForIndex( i ).second == getIntervalForIndex( i + 1 ).first but does not belong anymore to the interval itself but every value smaller than getIntervalForIndex( i ).second.

Parameters:
indexthe intex
Returns:
the open interval.

Implemented in WValueSetHistogram, and WHistogramBasic.

double WHistogram::getMaximum ( ) const [virtual]

Returns the maximum value.

Returns:
maximum

Definition at line 64 of file WHistogram.cpp.

References m_maximum.

double WHistogram::getMinimum ( ) const [virtual]

Returns the minimum value.

Returns:
minimum

Definition at line 59 of file WHistogram.cpp.

References m_minimum.

virtual size_t WHistogram::operator[] ( size_t  index) const [pure virtual]

Get the count of the specified bucket.

Parameters:
indexwhich buckets count is to be returned; starts with 0 which is the bucket containing the smallest values.
Returns:
elements in the bucket.

Implemented in WValueSetHistogram, and WHistogramBasic.

size_t WHistogram::size ( ) const [virtual]

Returns the number of buckets in the histogram with the actual mapping.

Returns:
number of buckets

Reimplemented in WValueSetHistogram.

Definition at line 54 of file WHistogram.cpp.

References m_nbBuckets.

Referenced by WHistogramBasicTest::testInitialization(), WHistogramBasicTest::testInsert(), WHistogramBasicTest::testInsertOutOfBounds(), and WHistogramBasicTest::testOperatorToGetNumberOfElementsInsideTheBin().


Member Data Documentation

double WHistogram::m_maximum [protected]
double WHistogram::m_minimum [protected]
double WHistogram::m_nbBuckets [protected]

The number of buckets.

Definition at line 133 of file WHistogram.h.

Referenced by WValueSetHistogram::buildHistogram(), WHistogramBasic::insert(), and size().


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