diff options
author | Naram Qashat <cyberbotx@cyberbotx.com> | 2010-06-20 18:42:58 -0400 |
---|---|---|
committer | Naram Qashat <cyberbotx@cyberbotx.com> | 2010-06-20 18:42:58 -0400 |
commit | 381c9c8870fad4c544f29deec22ba4be3549a731 (patch) | |
tree | f5f26e2dd380910b0ddd26e3d885d6bf56d40181 /include/timers.h | |
parent | 2528dc80bd1b3e6b2c09db23eb51659e30128110 (diff) |
The first of a few "CBX OCDing over code style" commits, focusing on include/* and src/* but not src/core/* or src/modules/*.
Diffstat (limited to 'include/timers.h')
-rw-r--r-- | include/timers.h | 168 |
1 files changed, 83 insertions, 85 deletions
diff --git a/include/timers.h b/include/timers.h index 05f731ff0..9573ee524 100644 --- a/include/timers.h +++ b/include/timers.h @@ -5,9 +5,7 @@ * * Please read COPYING and README for furhter details. * Based on the original code of Epona by Lara. - * Based on the original code of Services by Andy Church. - * - * + * Based on the original code of Services by Andy Church. */ #ifndef TIMERS_H @@ -21,64 +19,64 @@ class CoreExport Timer : public Extensible { - private: - /** The time this was created - */ - time_t settime; - - /** The triggering time - */ - time_t trigger; - - /** Numer of seconds between triggers - */ - long secs; - - /** True if this is a repeating timer - */ - bool repeat; - - public: - /** Default constructor, initializes the triggering time - * @param time_from_now The number of seconds from now to trigger the timer - * @param now The time now - * @param repeating Repeat this timer every time_from_now if this is true - */ - Timer(long time_from_now, time_t now = time(NULL), bool repeating = false); - - /** Default destructor, removes the timer from the list - */ - virtual ~Timer(); - - /** Set the trigger time to a new value - * @param t The new time - */ - void SetTimer(time_t t); - - /** Retrieve the triggering time - * @return The trigger time - */ - const time_t GetTimer(); - - /** Returns true if the timer is set to repeat - * @return Returns true if the timer is set to repeat - */ - const bool GetRepeat(); - - /** Returns the interval between ticks - * @return The interval - */ - const long GetSecs(); - - /** Returns the time this timer was created - * @return The time this timer was created - */ - const time_t GetSetTime(); - - /** Called when the timer ticks - * This should be overridden with something useful - */ - virtual void Tick(time_t ctime) = 0; + private: + /** The time this was created + */ + time_t settime; + + /** The triggering time + */ + time_t trigger; + + /** Numer of seconds between triggers + */ + long secs; + + /** True if this is a repeating timer + */ + bool repeat; + + public: + /** Default constructor, initializes the triggering time + * @param time_from_now The number of seconds from now to trigger the timer + * @param now The time now + * @param repeating Repeat this timer every time_from_now if this is true + */ + Timer(long time_from_now, time_t now = time(NULL), bool repeating = false); + + /** Default destructor, removes the timer from the list + */ + virtual ~Timer(); + + /** Set the trigger time to a new value + * @param t The new time + */ + void SetTimer(time_t t); + + /** Retrieve the triggering time + * @return The trigger time + */ + const time_t GetTimer(); + + /** Returns true if the timer is set to repeat + * @return Returns true if the timer is set to repeat + */ + const bool GetRepeat(); + + /** Returns the interval between ticks + * @return The interval + */ + const long GetSecs(); + + /** Returns the time this timer was created + * @return The time this timer was created + */ + const time_t GetSetTime(); + + /** Called when the timer ticks + * This should be overridden with something useful + */ + virtual void Tick(time_t ctime) = 0; }; /** This class manages sets of Timers, and triggers them at their defined times. @@ -87,29 +85,29 @@ class CoreExport Timer : public Extensible */ class CoreExport TimerManager : public Extensible { - protected: - /** A list of timers - */ - static std::vector<Timer *> Timers; - public: - /** Add a timer to the list - * @param T A Timer derived class to add - */ - static void AddTimer(Timer *T); - - /** Deletes a timer - * @param T A Timer derived class to delete - */ - static void DelTimer(Timer *T); - - /** Tick all pending timers - * @param ctime The current time - */ - static void TickTimers(time_t ctime = time(NULL)); - - /** Compares two timers - */ - static bool TimerComparison(Timer *one, Timer *two); + protected: + /** A list of timers + */ + static std::vector<Timer *> Timers; + public: + /** Add a timer to the list + * @param T A Timer derived class to add + */ + static void AddTimer(Timer *T); + + /** Deletes a timer + * @param T A Timer derived class to delete + */ + static void DelTimer(Timer *T); + + /** Tick all pending timers + * @param ctime The current time + */ + static void TickTimers(time_t ctime = time(NULL)); + + /** Compares two timers + */ + static bool TimerComparison(Timer *one, Timer *two); }; -#endif +#endif // TIMERS_H |