]> granicus.if.org Git - icinga2/commitdiff
Move the Timer::Holder class to timer.cpp
authorGunnar Beutner <gunnar.beutner@icinga.com>
Tue, 21 Nov 2017 12:03:51 +0000 (13:03 +0100)
committerGunnar Beutner <gunnar.beutner@icinga.com>
Thu, 30 Nov 2017 16:39:22 +0000 (17:39 +0100)
lib/base/timer.cpp
lib/base/timer.hpp

index 3e6099da9b1018cd9f27187fcc9ab3342ef4f5ac..2a583b6946ab8911738cfaaa4039f322e96fe48c 100644 (file)
 
 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::const_mem_fun<Timer::Holder, Timer *, &Timer::Holder::GetObject> >,
-               boost::multi_index::ordered_non_unique<boost::multi_index::const_mem_fun<Timer::Holder, double, &Timer::Holder::GetNextUnlocked> >
+               boost::multi_index::ordered_unique<boost::multi_index::const_mem_fun<TimerHolder, Timer *, &TimerHolder::GetObject> >,
+               boost::multi_index::ordered_non_unique<boost::multi_index::const_mem_fun<TimerHolder, double, &TimerHolder::GetNextUnlocked> >
        >
 > TimerSet;
 
index fbae485e87ede7541a2f17f48d16a934054baf03..d10d1dbe0ce1ec328d7d80694fb7b468957f0e94 100644 (file)
@@ -26,6 +26,8 @@
 
 namespace icinga {
 
+class TimerHolder;
+
 /**
  * A timer that periodically triggers an event.
  *
@@ -52,31 +54,6 @@ public:
 
        boost::signals2::signal<void(const Timer::Ptr&)> 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;
 };
 
 }