Homepage Demos Overview Downloads Tutorials Reference
Credits

FreeMemReportControl Class Reference

#include <FreeMemReportControl.h>

Inheritance diagram for FreeMemReportControl:

Inheritance graph
[legend]
List of all members.

Detailed Description

gives reports on free memory size at variable rates, can also warn if free memory drops too low.

Definition at line 12 of file FreeMemReportControl.h.

Public Member Functions

virtual void DoStart ()
 By default, merely adds to the reference counter (through AddReference()) you should still call this from your overriding methods.

virtual void DoStop ()
 By default, subtracts from the reference counter, and deletes if zero you should still call this when you override this call this at the end of your DoStop(), not beginning (it might delete this ).

virtual void processEvent (const EventBase &e)
 By defining here, allows you to get away with not supplying a processEvent() function for the EventListener interface. By default, does nothing.

virtual std::string getName () const
 Identifies the behavior in menus and such.

virtual void refresh ()
 called when the child has died and this control should refresh its display

void report ()
 reports size of free memory - if this is below low_mem, also generates a warning

void resetTimerFreq ()
 resets timer delays

Contructors/Destructors
contructor

 FreeMemReportControl ()
 FreeMemReportControl (const std::string &n)
 FreeMemReportControl (const std::string &n, const std::string &d)
virtual ~FreeMemReportControl ()
 destructor


Static Public Member Functions

size_t freeMem ()
 returns the size of the free memory


Protected Member Functions

void init ()
 builds the submenus


Protected Attributes

int report_freq
 how often to report memory size (in milliseconds - negative turns off, 0 is as often as possible)

unsigned int low_mem
 threshold to trigger low memory warning (in kilobytes)

unsigned int monitor_freq
 how often to check for low memory (in milliseconds - -1U turns off, 0 is as often as possible)

bool isWarning
 true we already know we're below threshold


Constructor & Destructor Documentation

FreeMemReportControl::FreeMemReportControl  )  [inline]
 

Definition at line 16 of file FreeMemReportControl.h.

References init(), isWarning, low_mem, monitor_freq, and report_freq.

Here is the call graph for this function:

FreeMemReportControl::FreeMemReportControl const std::string &  n  )  [inline]
 

Definition at line 17 of file FreeMemReportControl.h.

References init(), isWarning, low_mem, monitor_freq, and report_freq.

Here is the call graph for this function:

FreeMemReportControl::FreeMemReportControl const std::string &  n,
const std::string &  d
[inline]
 

Definition at line 18 of file FreeMemReportControl.h.

References init(), isWarning, low_mem, monitor_freq, and report_freq.

Here is the call graph for this function:

virtual FreeMemReportControl::~FreeMemReportControl  )  [inline, virtual]
 

destructor

Definition at line 19 of file FreeMemReportControl.h.

References ControlBase::clearSlots(), DoStop(), and ReferenceCounter::SetAutoDelete().

Here is the call graph for this function:


Member Function Documentation

virtual void FreeMemReportControl::DoStart  )  [inline, virtual]
 

By default, merely adds to the reference counter (through AddReference()) you should still call this from your overriding methods.

Reimplemented from BehaviorBase.

Definition at line 22 of file FreeMemReportControl.h.

References BehaviorBase::DoStart(), and resetTimerFreq().

Here is the call graph for this function:

virtual void FreeMemReportControl::DoStop  )  [inline, virtual]
 

By default, subtracts from the reference counter, and deletes if zero you should still call this when you override this call this at the end of your DoStop(), not beginning (it might delete this ).

Reimplemented from BehaviorBase.

Definition at line 27 of file FreeMemReportControl.h.

References BehaviorBase::DoStop(), erouter, EventRouter::forgetListener(), and isWarning.

Here is the call graph for this function:

size_t FreeMemReportControl::freeMem  )  [static]
 

returns the size of the free memory

Definition at line 46 of file FreeMemReportControl.cc.

References Socket::printf(), and sout.

Here is the call graph for this function:

virtual std::string FreeMemReportControl::getName  )  const [inline, virtual]
 

Identifies the behavior in menus and such.

Implements BehaviorBase.

Definition at line 35 of file FreeMemReportControl.h.

References ControlBase::getName(), and BehaviorBase::isActive().

Here is the call graph for this function:

void FreeMemReportControl::init  )  [inline, protected]
 

builds the submenus

Definition at line 50 of file FreeMemReportControl.h.

References low_mem, monitor_freq, ControlBase::pushSlot(), and report_freq.

Here is the call graph for this function:

void FreeMemReportControl::processEvent const EventBase e  )  [virtual]
 

By defining here, allows you to get away with not supplying a processEvent() function for the EventListener interface. By default, does nothing.

Reimplemented from BehaviorBase.

Definition at line 5 of file FreeMemReportControl.cc.

References ASSERT, ASSERTRET, freeMem(), EventBase::getGeneratorID(), EventBase::getSourceID(), isWarning, low_mem, Socket::printf(), report(), serr, and EventBase::timerEGID.

Here is the call graph for this function:

void FreeMemReportControl::refresh  )  [virtual]
 

called when the child has died and this control should refresh its display

Reimplemented from ControlBase.

Definition at line 26 of file FreeMemReportControl.cc.

References freeMem(), ControlBase::options, ControlBase::refresh(), and report().

Here is the call graph for this function:

void FreeMemReportControl::report  ) 
 

reports size of free memory - if this is below low_mem, also generates a warning

Definition at line 36 of file FreeMemReportControl.cc.

References freeMem(), isWarning, low_mem, Socket::printf(), resetTimerFreq(), serr, and sout.

Here is the call graph for this function:

void FreeMemReportControl::resetTimerFreq  ) 
 

resets timer delays

Definition at line 53 of file FreeMemReportControl.cc.

References EventRouter::addTimer(), erouter, monitor_freq, EventRouter::removeTimer(), and report_freq.

Here is the call graph for this function:


Member Data Documentation

bool FreeMemReportControl::isWarning [protected]
 

true we already know we're below threshold

Definition at line 61 of file FreeMemReportControl.h.

unsigned int FreeMemReportControl::low_mem [protected]
 

threshold to trigger low memory warning (in kilobytes)

Definition at line 59 of file FreeMemReportControl.h.

unsigned int FreeMemReportControl::monitor_freq [protected]
 

how often to check for low memory (in milliseconds - -1U turns off, 0 is as often as possible)

Definition at line 60 of file FreeMemReportControl.h.

int FreeMemReportControl::report_freq [protected]
 

how often to report memory size (in milliseconds - negative turns off, 0 is as often as possible)

Definition at line 58 of file FreeMemReportControl.h.


The documentation for this class was generated from the following files:
Tekkotsu v1.5
Generated Fri Oct 10 15:56:10 2003 by Doxygen 1.3.4