ratio.h
Go to the documentation of this file.
/* ratio.h
*/
#ifndef _RATIO_H
#define _RATIO_H
#include "osl/stat/average.h"
namespace osl
{
namespace stat
{
class Ratio
{
Average ave;
const char *name;
bool show_on_destructor;
public:
Ratio(const char *n=0, bool show=false) : name(n), show_on_destructor(show)
{
}
~Ratio();
void add(bool success) { ave.add(success ? 1.0 : 0.0); }
double ratio() const { return ave.average(); }
void show() const;
void clear() { ave.clear(); }
};
} // namespace stat
} // namespace osl
#endif /* _RATIO_H */
// ;;; Local Variables:
// ;;; mode:c++
// ;;; c-basic-offset:2
// ;;; End:
average.h
osl::stat::Average
incrementaly maintain average of data sequence
Definition average.h:14
osl::stat::Ratio::ave
Average ave
Definition ratio.h:14
osl::stat::Ratio::add
void add(bool success)
Definition ratio.h:22
osl::stat::Ratio::ratio
double ratio() const
Definition ratio.h:23
osl::stat::Ratio::show
void show() const
Definition ratio.cc:19
osl::stat::Ratio::name
const char * name
Definition ratio.h:15
osl::stat::Ratio::Ratio
Ratio(const char *n=0, bool show=false)
Definition ratio.h:18
osl::stat::Ratio::clear
void clear()
Definition ratio.h:25
osl::stat::Ratio::~Ratio
~Ratio()
Definition ratio.cc:6
osl::stat::Ratio::show_on_destructor
bool show_on_destructor
Definition ratio.h:16
osl::stat
Definition rating/featureSet.h:18
osl
Definition additionalEffect.h:6