Recast Navigation  1.0.35
rcContext Class Reference

Provides an interface for optional logging and performance tracking of the Recast build process. More...

#include <Recast.h>

Public Member Functions

 rcContext (bool logAndProfile=true)
 Contructor. More...
 
virtual ~rcContext ()
 
void enableLog (bool state)
 Enables or disables logging. More...
 
void resetLog ()
 Clears all log entries. More...
 
void log (const rcLogCategory category, const char *format,...)
 Logs a message. More...
 
void enableTimer (bool state)
 Enables or disables the performance timers. More...
 
void resetTimers ()
 Clears all peformance timers. (Resets all to unused.) More...
 
void startTimer (const rcTimerLabel label)
 Starts the specified performance timer. More...
 
void stopTimer (const rcTimerLabel label)
 Stops the specified performance timer. More...
 
int getAccumulatedTime (const rcTimerLabel label) const
 Returns the total accumulated time of the specified performance timer. More...
 

Protected Member Functions

virtual void doResetLog ()
 Clears all log entries. More...
 
virtual void doLog (const rcLogCategory category, const char *msg, const int len)
 Logs a message. More...
 
virtual void doResetTimers ()
 Clears all timers. (Resets all to unused.) More...
 
virtual void doStartTimer (const rcTimerLabel label)
 Starts the specified performance timer. More...
 
virtual void doStopTimer (const rcTimerLabel label)
 Stops the specified performance timer. More...
 
virtual int doGetAccumulatedTime (const rcTimerLabel label) const
 Returns the total accumulated time of the specified performance timer. More...
 

Protected Attributes

bool m_logEnabled
 True if logging is enabled. More...
 
bool m_timerEnabled
 True if the performance timers are enabled. More...
 

Description

Provides an interface for optional logging and performance tracking of the Recast build process.

This class does not provide logging or timer functionality on its own. Both must be provided by a concrete implementation by overriding the protected member functions. Also, this class does not provide an interface for extracting log messages. (Only adding them.) So concrete implementations must provide one.

If no logging or timers are required, just pass an instance of this class through the Recast build process.

Constructor & Destructor Documentation

rcContext::rcContext ( bool  logAndProfile = true)
inline

Contructor.

Parameters
[in]logAndProfileTRUE if the logging and performance timers should be enabled. [Default: true]
virtual rcContext::~rcContext ( )
inlinevirtual

Member Function Documentation

virtual int rcContext::doGetAccumulatedTime ( const rcTimerLabel  label) const
inlineprotectedvirtual

Returns the total accumulated time of the specified performance timer.

Parameters
[in]labelThe category of the timer.
Returns
The accumulated time of the timer, or -1 if timers are disabled or the timer has never been started.
virtual void rcContext::doLog ( const rcLogCategory  category,
const char *  msg,
const int  len 
)
inlineprotectedvirtual

Logs a message.

Parameters
[in]categoryThe category of the message.
[in]msgThe formatted message.
[in]lenThe length of the formatted message.
virtual void rcContext::doResetLog ( )
inlineprotectedvirtual

Clears all log entries.

virtual void rcContext::doResetTimers ( )
inlineprotectedvirtual

Clears all timers. (Resets all to unused.)

virtual void rcContext::doStartTimer ( const rcTimerLabel  label)
inlineprotectedvirtual

Starts the specified performance timer.

Parameters
[in]labelThe category of timer.
virtual void rcContext::doStopTimer ( const rcTimerLabel  label)
inlineprotectedvirtual

Stops the specified performance timer.

Parameters
[in]labelThe category of the timer.
void rcContext::enableLog ( bool  state)
inline

Enables or disables logging.

Parameters
[in]stateTRUE if logging should be enabled.
void rcContext::enableTimer ( bool  state)
inline

Enables or disables the performance timers.

Parameters
[in]stateTRUE if timers should be enabled.
int rcContext::getAccumulatedTime ( const rcTimerLabel  label) const
inline

Returns the total accumulated time of the specified performance timer.

Parameters
labelThe category of the timer.
Returns
The accumulated time of the timer, or -1 if timers are disabled or the timer has never been started.
void rcContext::log ( const rcLogCategory  category,
const char *  format,
  ... 
)

Logs a message.

Parameters
[in]categoryThe category of the message.
[in]formatThe message.

Example:

// Where ctx is an instance of rcContext and filepath is a char array.
ctx->log(RC_LOG_ERROR, "buildTiledNavigation: Could not load '%s'", filepath);
void rcContext::resetLog ( )
inline

Clears all log entries.

void rcContext::resetTimers ( )
inline

Clears all peformance timers. (Resets all to unused.)

void rcContext::startTimer ( const rcTimerLabel  label)
inline

Starts the specified performance timer.

Parameters
labelThe category of timer.
void rcContext::stopTimer ( const rcTimerLabel  label)
inline

Stops the specified performance timer.

Parameters
labelThe category of the timer.

Member Data Documentation

bool rcContext::m_logEnabled
protected

True if logging is enabled.

bool rcContext::m_timerEnabled
protected

True if the performance timers are enabled.


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