1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
3 * Copyright (c) 2005 INRIA
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation;
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
25 #include "event-impl.h"
26 #include "make-event.h"
29 #include "ns3/deprecated.h"
30 #include "ns3/object-factory.h"
43 * \brief Control the scheduling of simulation events.
45 * The internal simulation clock is maintained
46 * as a 64-bit integer in a unit specified by the user
47 * through the TimeStepPrecision::Set function. This means that it is
48 * not possible to specify event expiration times with anything better
49 * than this user-specified accuracy. Events whose expiration time is
50 * the same modulo this accuracy are scheduled in FIFO order: the
51 * first event inserted in the scheduling queue is scheduled to
54 * A simple example of how to use the Simulator class to schedule events
56 * \include samples/main-simulator.cc
62 * \param impl a new simulator implementation
64 * The simulator provides a mechanism to swap out different implementations.
65 * For example, the default implementation is a single-threaded simulator
66 * that performs no realtime synchronization. By calling this method, you
67 * can substitute in a new simulator implementation that might be multi-
68 * threaded and synchronize events to a realtime clock.
70 * The simulator implementation can be set when the simulator is not
73 static void SetImplementation (Ptr<SimulatorImpl> impl);
75 static Ptr<SimulatorImpl> GetImplementation (void);
78 * \param scheduler a new event scheduler
80 * The event scheduler can be set at any time: the events scheduled
81 * in the previous scheduler will be transfered to the new scheduler
82 * before we start to use it.
84 static void SetScheduler (ObjectFactory schedulerFactory);
87 * Every event scheduled by the Simulator::insertAtDestroy method is
88 * invoked. Then, we ensure that any memory allocated by the
90 * This method is typically invoked at the end of a simulation
91 * to avoid false-positive reports by a leak checker.
92 * After this method has been invoked, it is actually possible
93 * to restart a new simulation with a set of calls to Simulator::run
94 * and Simulator::insert_*.
96 static void Destroy (void);
99 * If there are no more events lefts to be scheduled, or if simulation
100 * time has already reached the "stop time" (see Simulator::Stop()),
101 * return true. Return false otherwise.
103 static bool IsFinished (void);
105 * If Simulator::isFinished returns true, the behavior of this
106 * method is undefined. Otherwise, it returns the microsecond-based
107 * time of the next event expected to be scheduled.
109 static Time Next (void);
112 * Run the simulation until one of:
113 * - no events are present anymore
114 * - the user called Simulator::stop
115 * - the user called Simulator::stopAtUs and the
116 * expiration time of the next event to be processed
117 * is greater than or equal to the stop time.
119 static void Run (void);
122 * Process only the next simulation event, then return immediately.
124 static void RunOneEvent (void);
127 * If an event invokes this method, it will be the last
128 * event scheduled by the Simulator::run method before
129 * returning to the caller.
131 static void Stop (void);
134 * Force the Simulator::run method to return to the caller when the
135 * expiration time of the next event to be processed is greater than
136 * or equal to the stop time. The stop time is relative to the
137 * current simulation time.
138 * @param time the stop time, relative to the current time.
140 static void Stop (Time const &time);
143 * Schedule an event to expire at the relative time "time"
144 * is reached. This can be thought of as scheduling an event
145 * for the current simulation time plus the Time passed as a
148 * When the event expires (when it becomes due to be run), the
149 * input method will be invoked on the input object.
151 * @param time the relative expiration time of the event.
152 * @param mem_ptr member method pointer to invoke
153 * @param obj the object on which to invoke the member method
154 * @returns an id for the scheduled event.
156 template <typename MEM, typename OBJ>
157 static EventId Schedule (Time const &time, MEM mem_ptr, OBJ obj);
160 * @param time the relative expiration time of the event.
161 * @param mem_ptr member method pointer to invoke
162 * @param obj the object on which to invoke the member method
163 * @param a1 the first argument to pass to the invoked method
164 * @returns an id for the scheduled event.
166 template <typename MEM, typename OBJ, typename T1>
167 static EventId Schedule (Time const &time, MEM mem_ptr, OBJ obj, T1 a1);
170 * @param time the relative expiration time of the event.
171 * @param mem_ptr member method pointer to invoke
172 * @param obj the object on which to invoke the member method
173 * @param a1 the first argument to pass to the invoked method
174 * @param a2 the second argument to pass to the invoked method
175 * @returns an id for the scheduled event.
177 template <typename MEM, typename OBJ, typename T1, typename T2>
178 static EventId Schedule (Time const &time, MEM mem_ptr, OBJ obj, T1 a1, T2 a2);
181 * @param time the relative expiration time of the event.
182 * @param mem_ptr member method pointer to invoke
183 * @param obj the object on which to invoke the member method
184 * @param a1 the first argument to pass to the invoked method
185 * @param a2 the second argument to pass to the invoked method
186 * @param a3 the third argument to pass to the invoked method
187 * @returns an id for the scheduled event.
189 template <typename MEM, typename OBJ,
190 typename T1, typename T2, typename T3>
191 static EventId Schedule (Time const &time, MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3);
194 * @param time the relative expiration time of the event.
195 * @param mem_ptr member method pointer to invoke
196 * @param obj the object on which to invoke the member method
197 * @param a1 the first argument to pass to the invoked method
198 * @param a2 the second argument to pass to the invoked method
199 * @param a3 the third argument to pass to the invoked method
200 * @param a4 the fourth argument to pass to the invoked method
201 * @returns an id for the scheduled event.
203 template <typename MEM, typename OBJ,
204 typename T1, typename T2, typename T3, typename T4>
205 static EventId Schedule (Time const &time, MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4);
208 * @param time the relative expiration time of the event.
209 * @param mem_ptr member method pointer to invoke
210 * @param obj the object on which to invoke the member method
211 * @param a1 the first argument to pass to the invoked method
212 * @param a2 the second argument to pass to the invoked method
213 * @param a3 the third argument to pass to the invoked method
214 * @param a4 the fourth argument to pass to the invoked method
215 * @param a5 the fifth argument to pass to the invoked method
216 * @returns an id for the scheduled event.
218 template <typename MEM, typename OBJ,
219 typename T1, typename T2, typename T3, typename T4, typename T5>
220 static EventId Schedule (Time const &time, MEM mem_ptr, OBJ obj,
221 T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
223 * @param time the relative expiration time of the event.
224 * @param f the function to invoke
225 * @returns an id for the scheduled event.
227 static EventId Schedule (Time const &time, void (*f) (void));
230 * @param time the relative expiration time of the event.
231 * @param f the function to invoke
232 * @param a1 the first argument to pass to the function to invoke
233 * @returns an id for the scheduled event.
235 template <typename U1, typename T1>
236 static EventId Schedule (Time const &time, void (*f) (U1), T1 a1);
239 * @param time the relative expiration time of the event.
240 * @param f the function to invoke
241 * @param a1 the first argument to pass to the function to invoke
242 * @param a2 the second argument to pass to the function to invoke
243 * @returns an id for the scheduled event.
245 template <typename U1, typename U2, typename T1, typename T2>
246 static EventId Schedule (Time const &time, void (*f) (U1,U2), T1 a1, T2 a2);
249 * @param time the relative expiration time of the event.
250 * @param f the function to invoke
251 * @param a1 the first argument to pass to the function to invoke
252 * @param a2 the second argument to pass to the function to invoke
253 * @param a3 the third argument to pass to the function to invoke
254 * @returns an id for the scheduled event.
256 template <typename U1, typename U2, typename U3, typename T1, typename T2, typename T3>
257 static EventId Schedule (Time const &time, void (*f) (U1,U2,U3), T1 a1, T2 a2, T3 a3);
260 * @param time the relative expiration time of the event.
261 * @param f the function to invoke
262 * @param a1 the first argument to pass to the function to invoke
263 * @param a2 the second argument to pass to the function to invoke
264 * @param a3 the third argument to pass to the function to invoke
265 * @param a4 the fourth argument to pass to the function to invoke
266 * @returns an id for the scheduled event.
268 template <typename U1, typename U2, typename U3, typename U4,
269 typename T1, typename T2, typename T3, typename T4>
270 static EventId Schedule (Time const &time, void (*f) (U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4);
273 * @param time the relative expiration time of the event.
274 * @param f the function to invoke
275 * @param a1 the first argument to pass to the function to invoke
276 * @param a2 the second argument to pass to the function to invoke
277 * @param a3 the third argument to pass to the function to invoke
278 * @param a4 the fourth argument to pass to the function to invoke
279 * @param a5 the fifth argument to pass to the function to invoke
280 * @returns an id for the scheduled event.
282 template <typename U1, typename U2, typename U3, typename U4, typename U5,
283 typename T1, typename T2, typename T3, typename T4, typename T5>
284 static EventId Schedule (Time const &time, void (*f) (U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
287 * Schedule an event to expire Now. All events scheduled to
288 * to expire "Now" are scheduled FIFO, after all normal events
291 * @param mem_ptr member method pointer to invoke
292 * @param obj the object on which to invoke the member method
294 template <typename MEM, typename OBJ>
295 static EventId ScheduleNow (MEM mem_ptr, OBJ obj);
298 * @param mem_ptr member method pointer to invoke
299 * @param obj the object on which to invoke the member method
300 * @param a1 the first argument to pass to the invoked method
302 template <typename MEM, typename OBJ,
304 static EventId ScheduleNow (MEM mem_ptr, OBJ obj, T1 a1);
307 * @param mem_ptr member method pointer to invoke
308 * @param obj the object on which to invoke the member method
309 * @param a1 the first argument to pass to the invoked method
310 * @param a2 the second argument to pass to the invoked method
312 template <typename MEM, typename OBJ,
313 typename T1, typename T2>
314 static EventId ScheduleNow (MEM mem_ptr, OBJ obj, T1 a1, T2 a2);
317 * @param mem_ptr member method pointer to invoke
318 * @param obj the object on which to invoke the member method
319 * @param a1 the first argument to pass to the invoked method
320 * @param a2 the second argument to pass to the invoked method
321 * @param a3 the third argument to pass to the invoked method
323 template <typename MEM, typename OBJ,
324 typename T1, typename T2, typename T3>
325 static EventId ScheduleNow (MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3);
328 * @param mem_ptr member method pointer to invoke
329 * @param obj the object on which to invoke the member method
330 * @param a1 the first argument to pass to the invoked method
331 * @param a2 the second argument to pass to the invoked method
332 * @param a3 the third argument to pass to the invoked method
333 * @param a4 the fourth argument to pass to the invoked method
335 template <typename MEM, typename OBJ,
336 typename T1, typename T2, typename T3, typename T4>
337 static EventId ScheduleNow (MEM mem_ptr, OBJ obj,
338 T1 a1, T2 a2, T3 a3, T4 a4);
340 * @param mem_ptr member method pointer to invoke
341 * @param obj the object on which to invoke the member method
342 * @param a1 the first argument to pass to the invoked method
343 * @param a2 the second argument to pass to the invoked method
344 * @param a3 the third argument to pass to the invoked method
345 * @param a4 the fourth argument to pass to the invoked method
346 * @param a5 the fifth argument to pass to the invoked method
348 template <typename MEM, typename OBJ,
349 typename T1, typename T2, typename T3, typename T4, typename T5>
350 static EventId ScheduleNow (MEM mem_ptr, OBJ obj,
351 T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
353 * @param f the function to invoke
355 static EventId ScheduleNow (void (*f) (void));
358 * @param f the function to invoke
359 * @param a1 the first argument to pass to the function to invoke
361 template <typename U1,
363 static EventId ScheduleNow (void (*f) (U1), T1 a1);
366 * @param f the function to invoke
367 * @param a1 the first argument to pass to the function to invoke
368 * @param a2 the second argument to pass to the function to invoke
370 template <typename U1, typename U2,
371 typename T1, typename T2>
372 static EventId ScheduleNow (void (*f) (U1,U2), T1 a1, T2 a2);
375 * @param f the function to invoke
376 * @param a1 the first argument to pass to the function to invoke
377 * @param a2 the second argument to pass to the function to invoke
378 * @param a3 the third argument to pass to the function to invoke
380 template <typename U1, typename U2, typename U3,
381 typename T1, typename T2, typename T3>
382 static EventId ScheduleNow (void (*f) (U1,U2,U3), T1 a1, T2 a2, T3 a3);
385 * @param f the function to invoke
386 * @param a1 the first argument to pass to the function to invoke
387 * @param a2 the second argument to pass to the function to invoke
388 * @param a3 the third argument to pass to the function to invoke
389 * @param a4 the fourth argument to pass to the function to invoke
391 template <typename U1, typename U2, typename U3, typename U4,
392 typename T1, typename T2, typename T3, typename T4>
393 static EventId ScheduleNow (void (*f) (U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4);
396 * @param f the function to invoke
397 * @param a1 the first argument to pass to the function to invoke
398 * @param a2 the second argument to pass to the function to invoke
399 * @param a3 the third argument to pass to the function to invoke
400 * @param a4 the fourth argument to pass to the function to invoke
401 * @param a5 the fifth argument to pass to the function to invoke
403 template <typename U1, typename U2, typename U3, typename U4, typename U5,
404 typename T1, typename T2, typename T3, typename T4, typename T5>
405 static EventId ScheduleNow (void (*f) (U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
408 * Schedule an event to expire at Destroy time. All events
409 * scheduled to expire at "Destroy" time are scheduled FIFO,
410 * after all normal events have expired and only when
411 * Simulator::Destroy is invoked.
413 * @param mem_ptr member method pointer to invoke
414 * @param obj the object on which to invoke the member method
416 template <typename MEM, typename OBJ>
417 static EventId ScheduleDestroy (MEM mem_ptr, OBJ obj);
420 * @param mem_ptr member method pointer to invoke
421 * @param obj the object on which to invoke the member method
422 * @param a1 the first argument to pass to the invoked method
424 template <typename MEM, typename OBJ,
426 static EventId ScheduleDestroy (MEM mem_ptr, OBJ obj, T1 a1);
429 * @param mem_ptr member method pointer to invoke
430 * @param obj the object on which to invoke the member method
431 * @param a1 the first argument to pass to the invoked method
432 * @param a2 the second argument to pass to the invoked method
434 template <typename MEM, typename OBJ,
435 typename T1, typename T2>
436 static EventId ScheduleDestroy (MEM mem_ptr, OBJ obj, T1 a1, T2 a2);
439 * @param mem_ptr member method pointer to invoke
440 * @param obj the object on which to invoke the member method
441 * @param a1 the first argument to pass to the invoked method
442 * @param a2 the second argument to pass to the invoked method
443 * @param a3 the third argument to pass to the invoked method
445 template <typename MEM, typename OBJ,
446 typename T1, typename T2, typename T3>
447 static EventId ScheduleDestroy (MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3);
450 * @param mem_ptr member method pointer to invoke
451 * @param obj the object on which to invoke the member method
452 * @param a1 the first argument to pass to the invoked method
453 * @param a2 the second argument to pass to the invoked method
454 * @param a3 the third argument to pass to the invoked method
455 * @param a4 the fourth argument to pass to the invoked method
457 template <typename MEM, typename OBJ,
458 typename T1, typename T2, typename T3, typename T4>
459 static EventId ScheduleDestroy (MEM mem_ptr, OBJ obj,
460 T1 a1, T2 a2, T3 a3, T4 a4);
462 * @param mem_ptr member method pointer to invoke
463 * @param obj the object on which to invoke the member method
464 * @param a1 the first argument to pass to the invoked method
465 * @param a2 the second argument to pass to the invoked method
466 * @param a3 the third argument to pass to the invoked method
467 * @param a4 the fourth argument to pass to the invoked method
468 * @param a5 the fifth argument to pass to the invoked method
470 template <typename MEM, typename OBJ,
471 typename T1, typename T2, typename T3, typename T4, typename T5>
472 static EventId ScheduleDestroy (MEM mem_ptr, OBJ obj,
473 T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
475 * @param f the function to invoke
477 static EventId ScheduleDestroy (void (*f) (void));
480 * @param f the function to invoke
481 * @param a1 the first argument to pass to the function to invoke
483 template <typename U1,
485 static EventId ScheduleDestroy (void (*f) (U1), T1 a1);
488 * @param f the function to invoke
489 * @param a1 the first argument to pass to the function to invoke
490 * @param a2 the second argument to pass to the function to invoke
492 template <typename U1, typename U2,
493 typename T1, typename T2>
494 static EventId ScheduleDestroy (void (*f) (U1,U2), T1 a1, T2 a2);
497 * @param f the function to invoke
498 * @param a1 the first argument to pass to the function to invoke
499 * @param a2 the second argument to pass to the function to invoke
500 * @param a3 the third argument to pass to the function to invoke
502 template <typename U1, typename U2, typename U3,
503 typename T1, typename T2, typename T3>
504 static EventId ScheduleDestroy (void (*f) (U1,U2,U3), T1 a1, T2 a2, T3 a3);
507 * @param f the function to invoke
508 * @param a1 the first argument to pass to the function to invoke
509 * @param a2 the second argument to pass to the function to invoke
510 * @param a3 the third argument to pass to the function to invoke
511 * @param a4 the fourth argument to pass to the function to invoke
513 template <typename U1, typename U2, typename U3, typename U4,
514 typename T1, typename T2, typename T3, typename T4>
515 static EventId ScheduleDestroy (void (*f) (U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4);
518 * @param f the function to invoke
519 * @param a1 the first argument to pass to the function to invoke
520 * @param a2 the second argument to pass to the function to invoke
521 * @param a3 the third argument to pass to the function to invoke
522 * @param a4 the fourth argument to pass to the function to invoke
523 * @param a5 the fifth argument to pass to the function to invoke
525 template <typename U1, typename U2, typename U3, typename U4, typename U5,
526 typename T1, typename T2, typename T3, typename T4, typename T5>
527 static EventId ScheduleDestroy (void (*f) (U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
530 * Remove an event from the event list.
531 * This method has the same visible effect as the
532 * ns3::EventId::Cancel method
533 * but its algorithmic complexity is much higher: it has often
534 * O(log(n)) complexity, sometimes O(n), sometimes worse.
535 * Note that it is not possible to remove events which were scheduled
536 * for the "destroy" time. Doing so will result in a program error (crash).
538 * @param id the event to remove from the list of scheduled events.
540 static void Remove (const EventId &id);
543 * Set the cancel bit on this event: the event's associated function
544 * will not be invoked when it expires.
545 * This method has the same visible effect as the
546 * ns3::Simulator::remove method but its algorithmic complexity is
547 * much lower: it has O(1) complexity.
548 * This method has the exact same semantics as ns3::EventId::cancel.
549 * Note that it is not possible to cancel events which were scheduled
550 * for the "destroy" time. Doing so will result in a program error (crash).
552 * @param id the event to cancel
554 static void Cancel (const EventId &id);
557 * This method has O(1) complexity.
558 * Note that it is not possible to test for the expiration of
559 * events which were scheduled for the "destroy" time. Doing so
560 * will result in a program error (crash).
561 * An event is said to "expire" when it starts being scheduled
562 * which means that if the code executed by the event calls
563 * this function, it will get true.
565 * @param id the event to test for expiration
566 * @returns true if the event has expired, false otherwise.
568 static bool IsExpired (const EventId &id);
571 * Return the "current simulation time".
573 static Time Now (void);
576 * \param id the event id to analyse
577 * \returns the delay left until the input event id expires.
578 * if the event is not running, this method returns
581 static Time GetDelayLeft (const EventId &id);
584 * \returns the maximum simulation time at which an event
587 * The returned value will always be bigger than or equal to Simulator::Now.
589 static Time GetMaximumSimulationTime (void);
592 * \param time delay until the event expires
593 * \param event the event to schedule
594 * \returns a unique identifier for the newly-scheduled event.
596 * This method will be typically used by language bindings
597 * to delegate events to their own subclass of the EventImpl base class.
599 static EventId Schedule (Time const &time, const Ptr<EventImpl> &event);
602 * \param event the event to schedule
603 * \returns a unique identifier for the newly-scheduled event.
605 * This method will be typically used by language bindings
606 * to delegate events to their own subclass of the EventImpl base class.
608 static EventId ScheduleDestroy (const Ptr<EventImpl> &event);
611 * \param event the event to schedule
612 * \returns a unique identifier for the newly-scheduled event.
614 * This method will be typically used by language bindings
615 * to delegate events to their own subclass of the EventImpl base class.
617 static EventId ScheduleNow (const Ptr<EventImpl> &event);
622 static EventId DoSchedule (Time const &time, EventImpl *event);
623 static EventId DoScheduleNow (EventImpl *event);
624 static EventId DoScheduleDestroy (EventImpl *event);
628 * \brief create an ns3::Time instance which contains the
629 * current simulation time.
631 * This is really a shortcut for the ns3::Simulator::Now method.
632 * It is typically used as shown below to schedule an event
633 * which expires at the absolute time "2 seconds":
635 * Simulator::Schedule (Seconds (2.0) - Now (), &my_function);
644 template <typename MEM, typename OBJ>
645 EventId Simulator::Schedule (Time const &time, MEM mem_ptr, OBJ obj)
647 return DoSchedule (time, MakeEvent (mem_ptr, obj));
651 template <typename MEM, typename OBJ,
653 EventId Simulator::Schedule (Time const &time, MEM mem_ptr, OBJ obj, T1 a1)
655 return DoSchedule (time, MakeEvent (mem_ptr, obj, a1));
658 template <typename MEM, typename OBJ,
659 typename T1, typename T2>
660 EventId Simulator::Schedule (Time const &time, MEM mem_ptr, OBJ obj, T1 a1, T2 a2)
662 return DoSchedule (time, MakeEvent (mem_ptr, obj, a1, a2));
665 template <typename MEM, typename OBJ,
666 typename T1, typename T2, typename T3>
667 EventId Simulator::Schedule (Time const &time, MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3)
669 return DoSchedule (time, MakeEvent (mem_ptr, obj, a1, a2, a3));
672 template <typename MEM, typename OBJ,
673 typename T1, typename T2, typename T3, typename T4>
674 EventId Simulator::Schedule (Time const &time, MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4)
676 return DoSchedule (time, MakeEvent (mem_ptr, obj, a1, a2, a3, a4));
679 template <typename MEM, typename OBJ,
680 typename T1, typename T2, typename T3, typename T4, typename T5>
681 EventId Simulator::Schedule (Time const &time, MEM mem_ptr, OBJ obj,
682 T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
684 return DoSchedule (time, MakeEvent (mem_ptr, obj, a1, a2, a3, a4, a5));
687 template <typename U1, typename T1>
688 EventId Simulator::Schedule (Time const &time, void (*f) (U1), T1 a1)
690 return DoSchedule (time, MakeEvent (f, a1));
693 template <typename U1, typename U2,
694 typename T1, typename T2>
695 EventId Simulator::Schedule (Time const &time, void (*f) (U1,U2), T1 a1, T2 a2)
697 return DoSchedule (time, MakeEvent (f, a1, a2));
700 template <typename U1, typename U2, typename U3,
701 typename T1, typename T2, typename T3>
702 EventId Simulator::Schedule (Time const &time, void (*f) (U1,U2,U3), T1 a1, T2 a2, T3 a3)
704 return DoSchedule (time, MakeEvent (f, a1, a2, a3));
707 template <typename U1, typename U2, typename U3, typename U4,
708 typename T1, typename T2, typename T3, typename T4>
709 EventId Simulator::Schedule (Time const &time, void (*f) (U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4)
711 return DoSchedule (time, MakeEvent (f, a1, a2, a3, a4));
714 template <typename U1, typename U2, typename U3, typename U4, typename U5,
715 typename T1, typename T2, typename T3, typename T4, typename T5>
716 EventId Simulator::Schedule (Time const &time, void (*f) (U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
718 return DoSchedule (time, MakeEvent (f, a1, a2, a3, a4, a5));
724 template <typename MEM, typename OBJ>
726 Simulator::ScheduleNow (MEM mem_ptr, OBJ obj)
728 return DoScheduleNow (MakeEvent (mem_ptr, obj));
732 template <typename MEM, typename OBJ,
735 Simulator::ScheduleNow (MEM mem_ptr, OBJ obj, T1 a1)
737 return DoScheduleNow (MakeEvent (mem_ptr, obj, a1));
740 template <typename MEM, typename OBJ,
741 typename T1, typename T2>
743 Simulator::ScheduleNow (MEM mem_ptr, OBJ obj, T1 a1, T2 a2)
745 return DoScheduleNow (MakeEvent (mem_ptr, obj, a1, a2));
748 template <typename MEM, typename OBJ,
749 typename T1, typename T2, typename T3>
751 Simulator::ScheduleNow (MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3)
753 return DoScheduleNow (MakeEvent (mem_ptr, obj, a1, a2, a3));
756 template <typename MEM, typename OBJ,
757 typename T1, typename T2, typename T3, typename T4>
759 Simulator::ScheduleNow (MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4)
761 return DoScheduleNow (MakeEvent (mem_ptr, obj, a1, a2, a3, a4));
764 template <typename MEM, typename OBJ,
765 typename T1, typename T2, typename T3, typename T4, typename T5>
767 Simulator::ScheduleNow (MEM mem_ptr, OBJ obj,
768 T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
770 return DoScheduleNow (MakeEvent (mem_ptr, obj, a1, a2, a3, a4, a5));
773 template <typename U1,
776 Simulator::ScheduleNow (void (*f) (U1), T1 a1)
778 return DoScheduleNow (MakeEvent (f, a1));
781 template <typename U1, typename U2,
782 typename T1, typename T2>
784 Simulator::ScheduleNow (void (*f) (U1,U2), T1 a1, T2 a2)
786 return DoScheduleNow (MakeEvent (f, a1, a2));
789 template <typename U1, typename U2, typename U3,
790 typename T1, typename T2, typename T3>
792 Simulator::ScheduleNow (void (*f) (U1,U2,U3), T1 a1, T2 a2, T3 a3)
794 return DoScheduleNow (MakeEvent (f, a1, a2, a3));
797 template <typename U1, typename U2, typename U3, typename U4,
798 typename T1, typename T2, typename T3, typename T4>
800 Simulator::ScheduleNow (void (*f) (U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4)
802 return DoScheduleNow (MakeEvent (f, a1, a2, a3, a4));
805 template <typename U1, typename U2, typename U3, typename U4, typename U5,
806 typename T1, typename T2, typename T3, typename T4, typename T5>
808 Simulator::ScheduleNow (void (*f) (U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
810 return DoScheduleNow (MakeEvent (f, a1, a2, a3, a4, a5));
815 template <typename MEM, typename OBJ>
817 Simulator::ScheduleDestroy (MEM mem_ptr, OBJ obj)
819 return DoScheduleDestroy (MakeEvent (mem_ptr, obj));
823 template <typename MEM, typename OBJ,
826 Simulator::ScheduleDestroy (MEM mem_ptr, OBJ obj, T1 a1)
828 return DoScheduleDestroy (MakeEvent (mem_ptr, obj, a1));
831 template <typename MEM, typename OBJ,
832 typename T1, typename T2>
834 Simulator::ScheduleDestroy (MEM mem_ptr, OBJ obj, T1 a1, T2 a2)
836 return DoScheduleDestroy (MakeEvent (mem_ptr, obj, a1, a2));
839 template <typename MEM, typename OBJ,
840 typename T1, typename T2, typename T3>
842 Simulator::ScheduleDestroy (MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3)
844 return DoScheduleDestroy (MakeEvent (mem_ptr, obj, a1, a2, a3));
847 template <typename MEM, typename OBJ,
848 typename T1, typename T2, typename T3, typename T4>
850 Simulator::ScheduleDestroy (MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4)
852 return DoScheduleDestroy (MakeEvent (mem_ptr, obj, a1, a2, a3, a4));
855 template <typename MEM, typename OBJ,
856 typename T1, typename T2, typename T3, typename T4, typename T5>
858 Simulator::ScheduleDestroy (MEM mem_ptr, OBJ obj,
859 T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
861 return DoScheduleDestroy (MakeEvent (mem_ptr, obj, a1, a2, a3, a4, a5));
864 template <typename U1,
867 Simulator::ScheduleDestroy (void (*f) (U1), T1 a1)
869 return DoScheduleDestroy (MakeEvent (f, a1));
872 template <typename U1, typename U2,
873 typename T1, typename T2>
875 Simulator::ScheduleDestroy (void (*f) (U1,U2), T1 a1, T2 a2)
877 return DoScheduleDestroy (MakeEvent (f, a1, a2));
880 template <typename U1, typename U2, typename U3,
881 typename T1, typename T2, typename T3>
883 Simulator::ScheduleDestroy (void (*f) (U1,U2,U3), T1 a1, T2 a2, T3 a3)
885 return DoScheduleDestroy (MakeEvent (f, a1, a2, a3));
888 template <typename U1, typename U2, typename U3, typename U4,
889 typename T1, typename T2, typename T3, typename T4>
891 Simulator::ScheduleDestroy (void (*f) (U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4)
893 return DoScheduleDestroy (MakeEvent (f, a1, a2, a3, a4));
896 template <typename U1, typename U2, typename U3, typename U4, typename U5,
897 typename T1, typename T2, typename T3, typename T4, typename T5>
899 Simulator::ScheduleDestroy (void (*f) (U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
901 return DoScheduleDestroy (MakeEvent (f, a1, a2, a3, a4, a5));
906 #endif /* SIMULATOR_H */