add a Timer::Schedule (delay) method
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Fri, 28 Sep 2007 16:14:16 +0200
changeset 1688 96172e357b93
parent 1687 b10b13bad5e9
child 1689 c52eb7e20762
add a Timer::Schedule (delay) method
src/simulator/timer.cc
src/simulator/timer.h
--- a/src/simulator/timer.cc	Fri Sep 28 13:27:37 2007 +0200
+++ b/src/simulator/timer.cc	Fri Sep 28 16:14:16 2007 +0200
@@ -84,6 +84,12 @@
 void 
 Timer::Schedule (void)
 {
+  Schedule (m_delay);
+}
+
+void 
+Timer::Schedule (Time delay)
+{
   NS_ASSERT (m_impl != 0);
   if (m_flags & CHECK_ON_SCHEDULE)
     {
@@ -100,7 +106,7 @@
     {
       Simulator::Remove (m_event);
     }
-  m_event = m_impl->Schedule (m_delay);
+  m_event = m_impl->Schedule (delay);
   if (m_flags & GARBAGE_COLLECT)
     {
       SimulationSingleton<EventGarbageCollector>::Get ()->Track (m_event);
--- a/src/simulator/timer.h	Fri Sep 28 13:27:37 2007 +0200
+++ b/src/simulator/timer.h	Fri Sep 28 16:14:16 2007 +0200
@@ -190,12 +190,18 @@
    * \return true if there is a currently-running event, false otherwise.
    */
   bool IsRunning (void) const;
-
   /**
    * Schedule a new event using the currently-configured delay, function, 
    * and arguments.
    */
   void Schedule (void);
+  /**
+   * \param delay the delay to use
+   *
+   * Schedule a new event using the specified delay (ignore the delay set by 
+   * Timer::SetDelay), function, and arguments.
+   */
+  void Schedule (Time delay);
 
 private:
   template <typename FN>