Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

ACE_Stats_Value Class Reference

Helper class for ACE_Stats. More...

#include <Stats.h>

List of all members.

Public Methods

 ACE_Stats_Value (const u_int precision)
u_int precision (void) const
 Accessor for precision. More...

void whole (const ACE_UINT32)
 Set the whole_ field. More...

ACE_UINT32 whole (void) const
 Accessor for the whole_ field. More...

void fractional (const ACE_UINT32)
 Set the fractional_ field. More...

ACE_UINT32 fractional (void) const
 Accessor for the fractional_ field. More...

ACE_UINT32 fractional_field (void) const
 Calculates the maximum value of the fractional portion, given its precision. More...

void scaled_value (ACE_UINT64 &) const
void dump (void) const
 Print to stdout. More...


Private Methods

 ACE_Stats_Value (void)

Private Attributes

ACE_UINT32 whole_
 The integer portion of the value. More...

ACE_UINT32 fractional_
 The fractional portion of the value. More...

u_int precision_


Detailed Description

Helper class for ACE_Stats.

Container struct for 64-bit signed quantity and its precision. It would be nicer to use a fixed-point class, but this is sufficient. Users typically don't need to use this class directly; see ACE_Stats below.

Definition at line 40 of file Stats.h.


Constructor & Destructor Documentation

ACE_INLINE ACE_Stats_Value::ACE_Stats_Value const u_int    precision
 

Constructor, which requires precision in terms of number of decimal digits. The more variation in the data, and the greater the data values, the smaller the precision must be to avoid overflow in the standard deviation calculation. 3 might be a good value, or maybe 4. 5 will probably be too large for non-trivial data sets.

Definition at line 5 of file Stats.i.

00006   : whole_ (0),
00007     fractional_ (0),
00008     precision_ (precision)
00009 {
00010 }

ACE_Stats_Value::ACE_Stats_Value void    [private]
 


Member Function Documentation

ACE_INLINE void ACE_Stats_Value::dump void    const
 

Print to stdout.

Definition at line 56 of file Stats.i.

References ACE_DEBUG, ACE_LIB_TEXT, fractional_, LM_DEBUG, precision_, and whole_.

00057 {
00058   ACE_DEBUG ((LM_DEBUG,
00059               ACE_LIB_TEXT ("precision: %u digits; whole: %u, fractional: %u\n"),
00060               precision_, whole_, fractional_));
00061 }

ACE_INLINE ACE_UINT32 ACE_Stats_Value::fractional void    const
 

Accessor for the fractional_ field.

Definition at line 42 of file Stats.i.

References fractional_.

Referenced by scaled_value.

00043 {
00044   return fractional_;
00045 }

ACE_INLINE void ACE_Stats_Value::fractional const    ACE_UINT32
 

Set the fractional_ field.

Definition at line 35 of file Stats.i.

References fractional_.

Referenced by ACE_Stats::mean, ACE_Stats::print_summary, ACE_Stats::quotient, ACE_Stats::square_root, and ACE_Stats::std_dev.

00036 {
00037   fractional_ = value;
00038 }

ACE_UINT32 ACE_Stats_Value::fractional_field void    const
 

Calculates the maximum value of the fractional portion, given its precision.

Definition at line 14 of file Stats.cpp.

References precision.

Referenced by ACE_Stats::quotient, scaled_value, ACE_Stats::square_root, and ACE_Stats::std_dev.

00015 {
00016   if (precision () == 0)
00017     {
00018       return 1;
00019     }
00020   else
00021     {
00022       ACE_UINT32 field = 10;
00023       for (u_int i = 0; i < precision () - 1; ++i)
00024         {
00025           field *= 10;
00026         }
00027 
00028       return field;
00029     }
00030 }

ACE_INLINE u_int ACE_Stats_Value::precision void    const
 

Accessor for precision.

Definition at line 14 of file Stats.i.

References precision_.

Referenced by fractional_field, ACE_Stats::quotient, ACE_Stats::square_root, and ACE_Stats::std_dev.

00015 {
00016   return precision_;
00017 }

ACE_INLINE void ACE_Stats_Value::scaled_value ACE_UINT64   const
 

Access the value as an _unsigned_ 64 bit quantity. It scales the value up by <precision> decimal digits, so that no precision will be lost. It assumes that <whole_> is >= 0.

Definition at line 49 of file Stats.i.

References ACE_UINT64, fractional, fractional_field, and whole.

Referenced by ACE_Stats::std_dev.

00050 {
00051   sv = whole () * fractional_field ()  +  fractional ();
00052 }

ACE_INLINE ACE_UINT32 ACE_Stats_Value::whole void    const
 

Accessor for the whole_ field.

Definition at line 28 of file Stats.i.

References whole_.

Referenced by scaled_value.

00029 {
00030   return whole_;
00031 }

ACE_INLINE void ACE_Stats_Value::whole const    ACE_UINT32
 

Set the whole_ field.

Definition at line 21 of file Stats.i.

References whole_.

Referenced by ACE_High_Res_Timer::calibrate, ACE_Stats::mean, ACE_Stats::print_summary, ACE_Stats::quotient, ACE_Stats::square_root, and ACE_Stats::std_dev.

00022 {
00023   whole_ = value;
00024 }


Member Data Documentation

ACE_UINT32 ACE_Stats_Value::fractional_ [private]
 

The fractional portion of the value.

Definition at line 87 of file Stats.h.

Referenced by dump, and fractional.

u_int ACE_Stats_Value::precision_ [private]
 

The number of decimal digits of precision represented by <fractional_>. Not declared const, so the only way to change it is via the assignment operator.

Definition at line 94 of file Stats.h.

Referenced by dump, and precision.

ACE_UINT32 ACE_Stats_Value::whole_ [private]
 

The integer portion of the value.

Definition at line 84 of file Stats.h.

Referenced by dump, and whole.


The documentation for this class was generated from the following files:
Generated on Mon Jun 16 12:56:37 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002