hysteresis Class Reference

Provides a mechanism for responding to events with relaxed timing. More...

#include <hysteresis.h>

Collaboration diagram for hysteresis:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 hysteresis (int staleness_period, int longest_delay)
void record_event ()
 records that we have just seen an event.
void reset_waiter ()
 resets the timestamp to indicate that we have just handled an event.
bool time_to_process ()
 returns true if it is time to do some processing now.
istring text_form () const

Public Attributes

int _staleness_period
time_stamp _last_event
int _longest_delay
time_stamp _end_of_wait

Detailed Description

Provides a mechanism for responding to events with relaxed timing.

Rather than triggering right away and possibly flipping back and forth quickly once a threshold is reached, the hysteresis object will allow more time to pass before the decision to flip is made.

Definition at line 29 of file hysteresis.h.


Constructor & Destructor Documentation

hysteresis::hysteresis ( int  staleness_period,
int  longest_delay 
) [inline]

Definition at line 32 of file hysteresis.h.


Member Function Documentation

void hysteresis::record_event (  )  [inline]

records that we have just seen an event.

Definition at line 38 of file hysteresis.h.

void hysteresis::reset_waiter (  )  [inline]

resets the timestamp to indicate that we have just handled an event.

Definition at line 41 of file hysteresis.h.

bool hysteresis::time_to_process (  ) 

returns true if it is time to do some processing now.

this will happen if the last_event has languished too long or if the period we've been delaying has gotten too large.

Definition at line 22 of file hysteresis.cpp.

References _end_of_wait, _last_event, and _staleness_period.

istring hysteresis::text_form (  )  const

Definition at line 25 of file hysteresis.cpp.

References _end_of_wait, _last_event, _longest_delay, _staleness_period, istring::SPRINTF, and time_stamp::text_form().


Member Data Documentation

int hysteresis::_staleness_period

Definition at line 51 of file hysteresis.h.

Referenced by text_form(), and time_to_process().

time_stamp hysteresis::_last_event

Definition at line 52 of file hysteresis.h.

Referenced by text_form(), and time_to_process().

int hysteresis::_longest_delay

Definition at line 53 of file hysteresis.h.

Referenced by text_form().

time_stamp hysteresis::_end_of_wait

Definition at line 54 of file hysteresis.h.

Referenced by text_form(), and time_to_process().


The documentation for this class was generated from the following files:
Generated on Fri Nov 28 04:30:48 2008 for HOOPLE Libraries by  doxygen 1.5.1