Click
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | List of all members
StabilityEWMAXParameters< SCALE, T, U > Class Template Reference

Parameters for a EWMA with constant scaling factor and user-settable alpha. More...

#include <click/ewma.hh>

Public Types

typedef T value_type
 
typedef U signed_value_type
 

Public Member Functions

 StabilityEWMAXParameters ()
 Construct a StabilityEWMAXParameters with initial alpha 1/16.
 
unsigned stability_shift () const
 Return the current stability shift.
 
void set_stability_shift (unsigned stability_shift)
 Set the current stability shift.
 
unsigned compensation () const
 Return this EWMA's compensation.
 

Static Public Member Functions

static unsigned scale ()
 Return this EWMA's scaling factor (bits of fraction).
 
static value_type scaled_one ()
 Return this EWMA's scaled value for one.
 

Detailed Description

template<unsigned SCALE, typename T = unsigned, typename U = int>
class StabilityEWMAXParameters< SCALE, T, U >

Parameters for a EWMA with constant scaling factor and user-settable alpha.

The StabilityEWMAXParameters template class is used as a template argument to DirectEWMAX. It defines a EWMA with fixed constant scaling factor. StabilityEWMAXParameters's first template argument is the EWMA's scaling factor, its second template argument is the EWMA's value type, and the third template argument is the EWMA's signed value type.

Example: DirectEWMAX<StabilityEWMAXParameters<10, unsigned, int> > defines a EWMA with user-settable alpha (stability shift) initially equal to 1/16, scaling factor 10, and value type unsigned.

A DirectEWMAX<StabilityEWMAXParameters<...> > object has stability_shift() and set_stability_shift() methods.

Constructor & Destructor Documentation

◆ StabilityEWMAXParameters()

template<unsigned SCALE, typename T = unsigned, typename U = int>
StabilityEWMAXParameters< SCALE, T, U >::StabilityEWMAXParameters ( )
inline

Construct a StabilityEWMAXParameters with initial alpha 1/16.

Member Function Documentation

◆ stability_shift()

template<unsigned SCALE, typename T = unsigned, typename U = int>
unsigned StabilityEWMAXParameters< SCALE, T, U >::stability_shift ( ) const
inline

Return the current stability shift.

The current alpha equals 1. / (2 ** stability_shift()).

◆ set_stability_shift()

template<unsigned SCALE, typename T = unsigned, typename U = int>
void StabilityEWMAXParameters< SCALE, T, U >::set_stability_shift ( unsigned  stability_shift)
inline

Set the current stability shift.

Parameters
stability_shiftnew value

◆ scale()

template<unsigned SCALE, typename T = unsigned, typename U = int>
static unsigned StabilityEWMAXParameters< SCALE, T, U >::scale ( )
inlinestatic

Return this EWMA's scaling factor (bits of fraction).

Returns
the 1st template parameter

◆ scaled_one()

template<unsigned SCALE, typename T = unsigned, typename U = int>
static value_type StabilityEWMAXParameters< SCALE, T, U >::scaled_one ( )
inlinestatic

Return this EWMA's scaled value for one.

◆ compensation()

template<unsigned SCALE, typename T = unsigned, typename U = int>
unsigned StabilityEWMAXParameters< SCALE, T, U >::compensation ( ) const
inline

Return this EWMA's compensation.

Returns
1 << (stability_shift() - 1)

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