My Project
std
osl
stat
ratio.h
Go to the documentation of this file.
1
/* ratio.h
2
*/
3
#ifndef _RATIO_H
4
#define _RATIO_H
5
6
#include "
osl/stat/average.h
"
7
8
namespace
osl
9
{
10
namespace
stat
11
{
12
class
Ratio
13
{
14
Average
ave
;
15
const
char
*
name
;
16
bool
show_on_destructor
;
17
public
:
18
Ratio
(
const
char
*n=0,
bool
show
=
false
) :
name
(n),
show_on_destructor
(
show
)
19
{
20
}
21
~Ratio
();
22
void
add
(
bool
success) {
ave
.
add
(success ? 1.0 : 0.0); }
23
double
ratio
()
const
{
return
ave
.
average
(); }
24
void
show
()
const
;
25
void
clear
() {
ave
.
clear
(); }
26
};
27
}
// namespace stat
28
}
// namespace osl
29
30
31
#endif
/* _RATIO_H */
32
// ;;; Local Variables:
33
// ;;; mode:c++
34
// ;;; c-basic-offset:2
35
// ;;; End:
average.h
osl::stat::Average
incrementaly maintain average of data sequence
Definition
average.h:14
osl::stat::Average::clear
void clear(double a=0.0, int e=0)
Definition
average.h:42
osl::stat::Average::add
double add(const double &x)
Add an element x.
Definition
average.h:27
osl::stat::Average::average
double average() const
Definition
average.h:48
osl::stat::Ratio
Definition
ratio.h:13
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
Definition
additionalEffect.h:6
Generated by
1.9.8