Anope IRC Services  Version 2.0
timers.h
Go to the documentation of this file.
1 /* Timer include stuff.
2  *
3  * (C) 2003-2014 Anope Team
4  * Contact us at team@anope.org
5  *
6  * Please read COPYING and README for further details.
7  *
8  * Based on the original code of Epona by Lara.
9  * Based on the original code of Services by Andy Church.
10  *
11  */
12 
13 #ifndef TIMERS_H
14 #define TIMERS_H
15 
16 #include "anope.h"
17 
19 {
20  private:
24 
27  time_t settime;
28 
31  time_t trigger;
32 
35  long secs;
36 
39  bool repeat;
40 
41  public:
47  Timer(long time_from_now, time_t now = Anope::CurTime, bool repeating = false);
48 
55  Timer(Module *creator, long time_from_now, time_t now = Anope::CurTime, bool repeating = false);
56 
59  virtual ~Timer();
60 
64  void SetTimer(time_t t);
65 
69  time_t GetTimer() const;
70 
74  bool GetRepeat() const;
75 
79  void SetSecs(time_t t);
80 
84  long GetSecs() const;
85 
89  time_t GetSetTime() const;
90 
94  Module *GetOwner() const;
95 
99  virtual void Tick(time_t ctime) = 0;
100 };
101 
107 {
110  static std::multimap<time_t, Timer *> Timers;
111  public:
115  static void AddTimer(Timer *t);
116 
120  static void DelTimer(Timer *t);
121 
125  static void TickTimers(time_t ctime = Anope::CurTime);
126 
129  static void DeleteTimersFor(Module *m);
130 };
131 
132 #endif // TIMERS_H
Definition: timers.h:18
long secs
Definition: timers.h:35
CoreExport time_t CurTime
Definition: main.cpp:41
bool repeat
Definition: timers.h:39
time_t settime
Definition: timers.h:27
#define CoreExport
Definition: services.h:62
static std::multimap< time_t, Timer * > Timers
Definition: timers.h:110
time_t trigger
Definition: timers.h:31
Module * owner
Definition: timers.h:23