Belle II Software development
MinMax Class Reference

small class for storing min and max. More...

#include <MinMax.h>

Public Member Functions

 MinMax ()
 constructor, starts with max for min and min for max (will later be replaced by valid entries).
 
void reset ()
 reset to start values.
 
bool checkAndReplaceIfMinMax (double newVal)
 checks value and replaces old ones if new one is better.
 
double getMin () const
 returns smallest value stored so far.
 
double getMax () const
 returns biggest value stored so far.
 
std::string print () const
 print function returning results for min and max as a string.
 

Protected Attributes

std::pair< double, double > m_minMax
 .first is min, .second is .max.
 

Detailed Description

small class for storing min and max.

Definition at line 23 of file MinMax.h.

Constructor & Destructor Documentation

◆ MinMax()

MinMax ( )
inline

constructor, starts with max for min and min for max (will later be replaced by valid entries).

Definition at line 29 of file MinMax.h.

29 :
30 m_minMax({std::numeric_limits< double >::max(), -std::numeric_limits< double >::max()}) {}
std::pair< double, double > m_minMax
.first is min, .second is .max.
Definition: MinMax.h:25

Member Function Documentation

◆ checkAndReplaceIfMinMax()

bool checkAndReplaceIfMinMax ( double  newVal)
inline

checks value and replaces old ones if new one is better.

returns true if minMax was updated.

Definition at line 36 of file MinMax.h.

37 {
38 bool wasAdded = false;
39 if (newVal < m_minMax.first) { m_minMax.first = newVal; wasAdded = true; }
40 if (m_minMax.second < newVal) { m_minMax.second = newVal; wasAdded = true; }
41 return wasAdded;
42 }

◆ getMax()

double getMax ( ) const
inline

returns biggest value stored so far.

Definition at line 46 of file MinMax.h.

◆ getMin()

double getMin ( ) const
inline

returns smallest value stored so far.

Definition at line 44 of file MinMax.h.

◆ print()

std::string print ( ) const
inline

print function returning results for min and max as a string.

Definition at line 48 of file MinMax.h.

◆ reset()

void reset ( )
inline

reset to start values.

Definition at line 33 of file MinMax.h.

33{ m_minMax = {std::numeric_limits< double >::max(), -std::numeric_limits< double >::max()}; }

Member Data Documentation

◆ m_minMax

std::pair<double, double> m_minMax
protected

.first is min, .second is .max.

Definition at line 25 of file MinMax.h.


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