Recast Navigation
Navigation-mesh Toolset for Games
rcContext Class Reference

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

#include <Recast.h>

Inheritance diagram for rcContext:
BuildContext

Public Member Functions

 rcContext (bool state=true)
 Constructor. 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 performance 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::rcContext ( bool  state = true)
inline

Constructor.

Parameters
[in]stateTRUE if the logging and performance timers should be enabled. [Default: true]

◆ ~rcContext()

virtual rcContext::~rcContext ( )
inlinevirtual

Member Function Documentation

◆ doGetAccumulatedTime()

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.

Reimplemented in BuildContext.

◆ doLog()

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.

Reimplemented in BuildContext.

◆ doResetLog()

void rcContext::doResetLog ( )
protectedvirtual

Clears all log entries.

Reimplemented in BuildContext.

◆ doResetTimers()

virtual void rcContext::doResetTimers ( )
inlineprotectedvirtual

Clears all timers. (Resets all to unused.)

Reimplemented in BuildContext.

◆ doStartTimer()

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

Starts the specified performance timer.

Parameters
[in]labelThe category of timer.

Reimplemented in BuildContext.

◆ doStopTimer()

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

Stops the specified performance timer.

Parameters
[in]labelThe category of the timer.

Reimplemented in BuildContext.

◆ enableLog()

void rcContext::enableLog ( bool  state)
inline

Enables or disables logging.

Parameters
[in]stateTRUE if logging should be enabled.

◆ enableTimer()

void rcContext::enableTimer ( bool  state)
inline

Enables or disables the performance timers.

Parameters
[in]stateTRUE if timers should be enabled.

◆ getAccumulatedTime()

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.

◆ log()

void rcContext::log ( const rcLogCategory  category,
const char *  format,
  ... 
)

Logs a 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);
@ RC_LOG_ERROR
An error log entry.
Definition: Recast.h:34
Parameters
[in]categoryThe category of the message.
[in]formatThe message.

◆ resetLog()

void rcContext::resetLog ( )
inline

Clears all log entries.

◆ resetTimers()

void rcContext::resetTimers ( )
inline

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

◆ startTimer()

void rcContext::startTimer ( const rcTimerLabel  label)
inline

Starts the specified performance timer.

Parameters
labelThe category of the timer.

◆ stopTimer()

void rcContext::stopTimer ( const rcTimerLabel  label)
inline

Stops the specified performance timer.

Parameters
labelThe category of the timer.

Member Data Documentation

◆ m_logEnabled

bool rcContext::m_logEnabled
protected

True if logging is enabled.

◆ m_timerEnabled

bool rcContext::m_timerEnabled
protected

True if the performance timers are enabled.


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