]> Dogcows Code - chaz/yoink/blobdiff - src/moof/timer.hh
prep for runloop code
[chaz/yoink] / src / moof / timer.hh
index a86f445d4168a9e2b19073a88593cc4790d9e9a0..3ec4ef9d8e04bd23a1e6141d4c242e430f6d0d5e 100644 (file)
@@ -19,6 +19,7 @@
 
 #include <boost/bind.hpp>
 #include <boost/function.hpp>
+#include <boost/noncopyable.hpp>
 
 #include <moof/hash.hh>
 #include <moof/math.hh>
@@ -33,7 +34,7 @@ namespace moof {
  * runloop associated with the current running view will make an attempt to
  * fire any expired timers as close to their scheduled times as possible.
  */
-class timer
+class timer : public boost::noncopyable
 {
 public:
 
@@ -148,6 +149,13 @@ public:
         */
        scalar seconds_remaining() const;
 
+       /**
+        * Get the absolute time of the next expiration of this timer.
+        * \return Seconds.
+        */
+       scalar next_expiration() const;
+
+
        /**
         * Get whether or not the timer is expired.  A timer on a repeating
         * schedule will never be expired since it will always have a scheduled
@@ -191,9 +199,9 @@ public:
         * Get the absolute time when the next timer is scheduled to expire.
         * \return Absolute time, in seconds.
         */
-       static scalar next_expiration()
+       static scalar next_event()
        {
-               return next_expiration_;
+               return next_event_;
        }
 
 
@@ -201,7 +209,10 @@ public:
         * Fire any timers which are not yet invalidated but have an expiration
         * time in the past.
         */
-       static void fire_expired_timers();
+       static void fire_expired_timers()
+       {
+               fire_expired_timers(ticks());
+       }
 
        /**
         * Fire any timers which are not yet invalidated but have an expiration
@@ -213,7 +224,7 @@ public:
 private:
 
        static unsigned new_identifier();
-       static scalar find_next_expiration();
+       static scalar find_next_event();
 
        function        function_;
        mode            mode_;
@@ -221,7 +232,7 @@ private:
        scalar          interval_;
        unsigned        id_;
 
-       static scalar                                                           next_expiration_;
+       static scalar                                                           next_event_;
        static hash<unsigned,timer*,hash_function>      timers_;
 };
 
This page took 0.021067 seconds and 4 git commands to generate.