Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

FreeMemReportControl Class Reference

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

#include <FreeMemReportControl.h>

Inheritance diagram for FreeMemReportControl:

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.

List of all members.

Public Member Functions

virtual void doStart ()
 Delegate function for subclasses to be notified when the behavior starts up.
virtual void doStop ()
 Delegate function for subclasses to be notified when the behavior starts up.
virtual void doEvent ()
 Delegate function for event processing, the event itself is pointed to (only for the duration of the doEvent() call!) by event.
virtual std::string getName () const
 Identifies the behavior in menus and such.
virtual void refresh ()
 called when the child has deactivated and this control should refresh its display, or some other event (such as the user pressing the refresh button) has happened to cause a refresh to be needed
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 ()
 destructor
 FreeMemReportControl (const std::string &n)
 destructor
 FreeMemReportControl (const std::string &n, const std::string &d)
 destructor
virtual ~FreeMemReportControl ()
 destructor

Static Public Member Functions

static 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
size_t lastReport
 free memory at last report so we can report the difference

Constructor & Destructor Documentation

FreeMemReportControl::FreeMemReportControl (  ) 

destructor

Definition at line 16 of file FreeMemReportControl.h.

FreeMemReportControl::FreeMemReportControl ( const std::string &  n  ) 

destructor

Definition at line 17 of file FreeMemReportControl.h.

FreeMemReportControl::FreeMemReportControl ( const std::string &  n,
const std::string &  d 
)

destructor

Definition at line 18 of file FreeMemReportControl.h.

virtual FreeMemReportControl::~FreeMemReportControl (  )  [virtual]

destructor

Definition at line 19 of file FreeMemReportControl.h.


Member Function Documentation

void FreeMemReportControl::doEvent (  )  [virtual]

Delegate function for event processing, the event itself is pointed to (only for the duration of the doEvent() call!) by event.

Default implementation watches for 'private' text message events (those forwarded by a BehaviorSwitchControl from ControllerGUI input) and will publically rebroadcast them. The idea is that your own processEvent gets first dibs, but if the behavior doesn't handle the text message, it will be handed off for others.

Reimplemented from BehaviorBase.

Definition at line 10 of file FreeMemReportControl.cc.

virtual void FreeMemReportControl::doStart (  )  [virtual]

Delegate function for subclasses to be notified when the behavior starts up.

Should be overridden by subclasses to subscribe to events, install motion commands, etc.

doStart() is basically a hook to allow subclasses to jump in and do some customization of behavior parameters while the behavior is starting. If you are writing a behavior class and do not expect further derivation, just override doStart() yourself. However, if you do expect further derivation of your class, consider using preStart() or postStart() instead, and leave doStart() for the 'leaf' classes.

Reimplemented from BehaviorBase.

Definition at line 22 of file FreeMemReportControl.h.

virtual void FreeMemReportControl::doStop (  )  [virtual]

Delegate function for subclasses to be notified when the behavior starts up.

May be overridden to cleanup when the behavior is shutting down. However events will automatically be unsubscribed, and by using addMotion(), motions will automatically be removed by stop(), so you may not need any cleanup.

Reimplemented from BehaviorBase.

Definition at line 27 of file FreeMemReportControl.h.

size_t FreeMemReportControl::freeMem (  )  [static]

returns the size of the free memory

Definition at line 53 of file FreeMemReportControl.cc.

Referenced by doEvent(), init(), refresh(), and report().

virtual std::string FreeMemReportControl::getName (  )  const [virtual]

Identifies the behavior in menus and such.

Reimplemented from BehaviorBase.

Definition at line 35 of file FreeMemReportControl.h.

void FreeMemReportControl::init (  )  [protected]

builds the submenus

Definition at line 50 of file FreeMemReportControl.h.

Referenced by FreeMemReportControl().

void FreeMemReportControl::refresh (  )  [virtual]

called when the child has deactivated and this control should refresh its display, or some other event (such as the user pressing the refresh button) has happened to cause a refresh to be needed

Reimplemented from ControlBase.

Definition at line 32 of file FreeMemReportControl.cc.

void FreeMemReportControl::report (  ) 

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

Definition at line 42 of file FreeMemReportControl.cc.

Referenced by doEvent(), and refresh().

void FreeMemReportControl::resetTimerFreq (  ) 

resets timer delays

Definition at line 64 of file FreeMemReportControl.cc.

Referenced by doStart(), and report().


Member Data Documentation

true we already know we're below threshold

Definition at line 63 of file FreeMemReportControl.h.

Referenced by doEvent(), doStop(), and report().

free memory at last report so we can report the difference

Definition at line 64 of file FreeMemReportControl.h.

Referenced by init(), and report().

unsigned int FreeMemReportControl::low_mem [protected]

threshold to trigger low memory warning (in kilobytes)

Definition at line 61 of file FreeMemReportControl.h.

Referenced by doEvent(), init(), and report().

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 62 of file FreeMemReportControl.h.

Referenced by init(), and resetTimerFreq().

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

Definition at line 60 of file FreeMemReportControl.h.

Referenced by init(), and resetTimerFreq().


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

Tekkotsu v5.1CVS
Generated Mon May 9 04:59:08 2016 by Doxygen 1.6.3