#ifndef TIMER_H #define TIMER_H #include namespace icinga { struct TimerEventArgs : public EventArgs { typedef shared_ptr Ptr; typedef weak_ptr WeakPtr; EventArgs::Ptr UserArgs; }; class Timer : public Object { private: EventArgs::Ptr m_UserArgs; unsigned int m_Interval; time_t m_Next; static time_t NextCall; static void RescheduleTimers(void); void Call(void); public: typedef shared_ptr Ptr; typedef weak_ptr WeakPtr; static list Timers; Timer(void); void SetInterval(unsigned int interval); unsigned int GetInterval(void) const; void SetUserArgs(const EventArgs::Ptr& userArgs); EventArgs::Ptr GetUserArgs(void) const; static time_t GetNextCall(void); static void CallExpiredTimers(void); static void StopAllTimers(void); void Start(void); void Stop(void); void Reschedule(time_t next); event OnTimerExpired; }; } #endif /* TIMER_H */