From 245feca0e7efb9f880f1de56d7ffa8b7fdd76a23 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Tue, 21 Nov 2017 13:03:51 +0100 Subject: [PATCH] Move the Timer::Holder class to timer.cpp --- lib/base/timer.cpp | 35 ++++++++++++++++++++++++++++++++--- lib/base/timer.hpp | 28 +++------------------------- 2 files changed, 35 insertions(+), 28 deletions(-) diff --git a/lib/base/timer.cpp b/lib/base/timer.cpp index 3e6099da9..2a583b694 100644 --- a/lib/base/timer.cpp +++ b/lib/base/timer.cpp @@ -29,11 +29,40 @@ using namespace icinga; +namespace icinga { + +class TimerHolder { +public: + TimerHolder(Timer *timer) + : m_Timer(timer) + { } + + inline Timer *GetObject(void) const + { + return m_Timer; + } + + inline double GetNextUnlocked(void) const + { + return m_Timer->m_Next; + } + + operator Timer *(void) const + { + return m_Timer; + } + +private: + Timer *m_Timer; +}; + +} + typedef boost::multi_index_container< - Timer::Holder, + TimerHolder, boost::multi_index::indexed_by< - boost::multi_index::ordered_unique >, - boost::multi_index::ordered_non_unique > + boost::multi_index::ordered_unique >, + boost::multi_index::ordered_non_unique > > > TimerSet; diff --git a/lib/base/timer.hpp b/lib/base/timer.hpp index fbae485e8..d10d1dbe0 100644 --- a/lib/base/timer.hpp +++ b/lib/base/timer.hpp @@ -26,6 +26,8 @@ namespace icinga { +class TimerHolder; + /** * A timer that periodically triggers an event. * @@ -52,31 +54,6 @@ public: boost::signals2::signal OnTimerExpired; - class Holder { - public: - Holder(Timer *timer) - : m_Timer(timer) - { } - - inline Timer *GetObject(void) const - { - return m_Timer; - } - - inline double GetNextUnlocked(void) const - { - return m_Timer->m_Next; - } - - operator Timer *(void) const - { - return m_Timer; - } - - private: - Timer *m_Timer; - }; - private: double m_Interval; /**< The interval of the timer. */ double m_Next; /**< When the next event should happen. */ @@ -92,6 +69,7 @@ private: static void Uninitialize(void); friend class Application; + friend class TimerHolder; }; } -- 2.40.0