navContext.h

Engine/source/navigation/navContext.h

More...

Classes:

class

Implements the rcContext interface in Torque.

Detailed Description

 1
 2//-----------------------------------------------------------------------------
 3// Copyright (c) 2014 Daniel Buckmaster
 4//
 5// Permission is hereby granted, free of charge, to any person obtaining a copy
 6// of this software and associated documentation files (the "Software"), to
 7// deal in the Software without restriction, including without limitation the
 8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 9// sell copies of the Software, and to permit persons to whom the Software is
10// furnished to do so, subject to the following conditions:
11//
12// The above copyright notice and this permission notice shall be included in
13// all copies or substantial portions of the Software.
14//
15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21// IN THE SOFTWARE.
22//-----------------------------------------------------------------------------
23
24#ifndef _NAV_CONTEXT_H_
25#define _NAV_CONTEXT_H_
26
27#include "torqueRecast.h"
28#include <Recast.h>
29
30/// @brief Implements the rcContext interface in Torque.
31class NavContext: public rcContext {
32public:
33   /// Default constructor.
34   NavContext() : rcContext(true) { doResetTimers(); }
35
36   void log(const rcLogCategory category, const String &msg);
37
38protected:
39   /// Clears all log entries.
40   virtual void doResetLog();
41
42   /// Logs a message.
43   /// @param[in] category The category of the message.
44   /// @param[in] msg      The formatted message.
45   /// @param[in] len      The length of the formatted message.
46   virtual void doLog(const rcLogCategory category, const char* msg, const int len);
47
48   /// Clears all timers. (Resets all to unused.)
49   virtual void doResetTimers();
50
51   /// Starts the specified performance timer.
52   /// @param[in] label The category of timer.
53   virtual void doStartTimer(const rcTimerLabel label);
54
55   /// Stops the specified performance timer.
56   /// @param[in] label The category of the timer.
57   virtual void doStopTimer(const rcTimerLabel label);
58
59   /// Returns the total accumulated time of the specified performance timer.
60   /// @param[in] label The category of the timer.
61   /// @return The accumulated time of the timer, or -1 if timers are disabled or the timer has never been started.
62   virtual int doGetAccumulatedTime(const rcTimerLabel label) const;
63
64private:
65   /// Store start time and final time for each timer.
66   S32 mTimers[RC_MAX_TIMERS][2];
67};
68
69#endif
70