src/simulator/simulator.h
author Guillaume Seguin <guillaume@segu.in>
Thu Nov 12 13:19:35 2009 +0100 (2009-11-12)
changeset 5507 915abd2b907b
parent 4448 641b88d1e131
child 5521 37c6c83d4252
permissions -rw-r--r--
Simulator::SetScheduler now takes an ObjectFactory
mathieu@150
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
mathieu@9
     2
/*
mathieu@9
     3
 * Copyright (c) 2005 INRIA
mathieu@9
     4
 *
mathieu@9
     5
 * This program is free software; you can redistribute it and/or modify
mathieu@9
     6
 * it under the terms of the GNU General Public License version 2 as
mathieu@9
     7
 * published by the Free Software Foundation;
mathieu@9
     8
 *
mathieu@9
     9
 * This program is distributed in the hope that it will be useful,
mathieu@9
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
mathieu@9
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
mathieu@9
    12
 * GNU General Public License for more details.
mathieu@9
    13
 *
mathieu@9
    14
 * You should have received a copy of the GNU General Public License
mathieu@9
    15
 * along with this program; if not, write to the Free Software
mathieu@9
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
mathieu@9
    17
 *
mathieu@9
    18
 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
mathieu@9
    19
 */
mathieu@9
    20
mathieu@9
    21
#ifndef SIMULATOR_H
mathieu@9
    22
#define SIMULATOR_H
mathieu@9
    23
mathieu@25
    24
#include "event-id.h"
mathieu@25
    25
#include "event-impl.h"
mathieu@3809
    26
#include "make-event.h"
mathieu@108
    27
#include "nstime.h"
craigdo@3470
    28
mathieu@3489
    29
#include "ns3/deprecated.h"
guillaume@5507
    30
#include "ns3/object-factory.h"
mathieu@9
    31
craigdo@3470
    32
#include <stdint.h>
craigdo@3470
    33
#include <string>
craigdo@3470
    34
mathieu@16
    35
namespace ns3 {
mathieu@9
    36
craigdo@3469
    37
class SimulatorImpl;
mathieu@3804
    38
class Scheduler;
mathieu@9
    39
mathieu@9
    40
/**
tomh@3182
    41
 * \ingroup simulator
tomh@3182
    42
 *
mathieu@9
    43
 * \brief Control the scheduling of simulation events. 
mathieu@9
    44
 *
mathieu@9
    45
 * The internal simulation clock is maintained
mathieu@682
    46
 * as a 64-bit integer in a unit specified by the user
mathieu@682
    47
 * through the TimeStepPrecision::Set function. This means that it is
mathieu@9
    48
 * not possible to specify event expiration times with anything better
mathieu@682
    49
 * than this user-specified accuracy. Events whose expiration time is
mathieu@682
    50
 * the same modulo this accuracy are scheduled in FIFO order: the 
mathieu@682
    51
 * first event inserted in the scheduling queue is scheduled to 
mathieu@682
    52
 * expire first.
mathieu@84
    53
 * 
mathieu@84
    54
 * A simple example of how to use the Simulator class to schedule events
mathieu@84
    55
 * is shown below:
mathieu@84
    56
 * \include samples/main-simulator.cc
mathieu@9
    57
 */
mathieu@3390
    58
class Simulator 
mathieu@3390
    59
{
mathieu@9
    60
public:
mathieu@150
    61
  /**
craigdo@3470
    62
   * \param impl a new simulator implementation
craigdo@3470
    63
   *
craigdo@3470
    64
   * The simulator provides a mechanism to swap out different implementations.
craigdo@3470
    65
   * For example, the default implementation is a single-threaded simulator
craigdo@3470
    66
   * that performs no realtime synchronization.  By calling this method, you
craigdo@3470
    67
   * can substitute in a new simulator implementation that might be multi-
craigdo@3470
    68
   * threaded and synchronize events to a realtime clock.
craigdo@3470
    69
   *
craigdo@3470
    70
   * The simulator implementation can be set when the simulator is not 
craigdo@3470
    71
   * running.
craigdo@3470
    72
   */
craigdo@3470
    73
  static void SetImplementation (Ptr<SimulatorImpl> impl);
craigdo@3470
    74
mathieu@3816
    75
  static Ptr<SimulatorImpl> GetImplementation (void);
mathieu@3816
    76
craigdo@3470
    77
  /**
mathieu@3188
    78
   * \param scheduler a new event scheduler
mathieu@3188
    79
   *
mathieu@3188
    80
   * The event scheduler can be set at any time: the events scheduled
mathieu@3188
    81
   * in the previous scheduler will be transfered to the new scheduler
mathieu@3188
    82
   * before we start to use it.
mathieu@150
    83
   */
guillaume@5507
    84
  static void SetScheduler (ObjectFactory schedulerFactory);
mathieu@9
    85
mathieu@150
    86
  /**
mathieu@150
    87
   * Every event scheduled by the Simulator::insertAtDestroy method is
mathieu@150
    88
   * invoked. Then, we ensure that any memory allocated by the 
mathieu@150
    89
   * Simulator is freed.
mathieu@150
    90
   * This method is typically invoked at the end of a simulation
mathieu@150
    91
   * to avoid false-positive reports by a leak checker.
mathieu@150
    92
   * After this method has been invoked, it is actually possible
mathieu@150
    93
   * to restart a new simulation with a set of calls to Simulator::run
mathieu@150
    94
   * and Simulator::insert_*.
mathieu@150
    95
   */
mathieu@150
    96
  static void Destroy (void);
mathieu@9
    97
mathieu@150
    98
  /**
gjc@4089
    99
   * If there are no more events lefts to be scheduled, or if simulation
gjc@4089
   100
   * time has already reached the "stop time" (see Simulator::Stop()),
gjc@4085
   101
   * return true. Return false otherwise.
mathieu@150
   102
   */
mathieu@150
   103
  static bool IsFinished (void);
mathieu@150
   104
  /**
mathieu@150
   105
   * If Simulator::isFinished returns true, the behavior of this
mathieu@150
   106
   * method is undefined. Otherwise, it returns the microsecond-based
mathieu@150
   107
   * time of the next event expected to be scheduled.
mathieu@150
   108
   */
mathieu@150
   109
  static Time Next (void);
mathieu@9
   110
mathieu@150
   111
  /**
mathieu@150
   112
   * Run the simulation until one of:
mathieu@150
   113
   *   - no events are present anymore
mathieu@150
   114
   *   - the user called Simulator::stop
mathieu@150
   115
   *   - the user called Simulator::stopAtUs and the
mathieu@150
   116
   *     expiration time of the next event to be processed
mathieu@150
   117
   *     is greater than or equal to the stop time.
mathieu@150
   118
   */
mathieu@150
   119
  static void Run (void);
craigdo@3470
   120
mathieu@150
   121
  /**
gjc@3515
   122
   * Process only the next simulation event, then return immediately.
gjc@3515
   123
   */
gjc@3515
   124
  static void RunOneEvent (void);
gjc@3515
   125
gjc@3515
   126
  /**
mathieu@150
   127
   * If an event invokes this method, it will be the last
mathieu@150
   128
   * event scheduled by the Simulator::run method before
mathieu@150
   129
   * returning to the caller.
mathieu@150
   130
   */
mathieu@150
   131
  static void Stop (void);
craigdo@3470
   132
mathieu@150
   133
  /**
gjc@3174
   134
   * Force the Simulator::run method to return to the caller when the
gjc@3174
   135
   * expiration time of the next event to be processed is greater than
gjc@3174
   136
   * or equal to the stop time.  The stop time is relative to the
gjc@3174
   137
   * current simulation time.
gjc@3174
   138
   * @param time the stop time, relative to the current time.
mathieu@150
   139
   */
gjc@3174
   140
  static void Stop (Time const &time);
mathieu@9
   141
mathieu@150
   142
  /**
craigdo@3796
   143
   * Schedule an event to expire at the relative time "time"
craigdo@3796
   144
   * is reached.  This can be thought of as scheduling an event
craigdo@3796
   145
   * for the current simulation time plus the Time passed as a
craigdo@3796
   146
   * parameter
craigdo@3796
   147
   *
craigdo@3796
   148
   * When the event expires (when it becomes due to be run), the 
craigdo@3796
   149
   * input method will be invoked on the input object.  
mathieu@150
   150
   *
tomh@345
   151
   * @param time the relative expiration time of the event.
mathieu@150
   152
   * @param mem_ptr member method pointer to invoke
mathieu@150
   153
   * @param obj the object on which to invoke the member method
mathieu@150
   154
   * @returns an id for the scheduled event.
mathieu@150
   155
   */
mathieu@1295
   156
  template <typename MEM, typename OBJ>
mathieu@1295
   157
  static EventId Schedule (Time const &time, MEM mem_ptr, OBJ obj);
craigdo@3470
   158
mathieu@150
   159
  /**
tomh@345
   160
   * @param time the relative expiration time of the event.
mathieu@150
   161
   * @param mem_ptr member method pointer to invoke
mathieu@150
   162
   * @param obj the object on which to invoke the member method
mathieu@150
   163
   * @param a1 the first argument to pass to the invoked method
mathieu@150
   164
   * @returns an id for the scheduled event.
mathieu@150
   165
   */
mathieu@1295
   166
  template <typename MEM, typename OBJ, typename T1>
mathieu@1295
   167
  static EventId Schedule (Time const &time, MEM mem_ptr, OBJ obj, T1 a1);
craigdo@3470
   168
mathieu@150
   169
  /**
tomh@345
   170
   * @param time the relative expiration time of the event.
mathieu@150
   171
   * @param mem_ptr member method pointer to invoke
mathieu@150
   172
   * @param obj the object on which to invoke the member method
mathieu@150
   173
   * @param a1 the first argument to pass to the invoked method
mathieu@150
   174
   * @param a2 the second argument to pass to the invoked method
mathieu@150
   175
   * @returns an id for the scheduled event.
mathieu@150
   176
   */
mathieu@1295
   177
  template <typename MEM, typename OBJ, typename T1, typename T2>
mathieu@1295
   178
  static EventId Schedule (Time const &time, MEM mem_ptr, OBJ obj, T1 a1, T2 a2);
craigdo@3470
   179
mathieu@150
   180
  /**
tomh@345
   181
   * @param time the relative expiration time of the event.
mathieu@150
   182
   * @param mem_ptr member method pointer to invoke
mathieu@150
   183
   * @param obj the object on which to invoke the member method
mathieu@150
   184
   * @param a1 the first argument to pass to the invoked method
mathieu@150
   185
   * @param a2 the second argument to pass to the invoked method
mathieu@150
   186
   * @param a3 the third argument to pass to the invoked method
mathieu@150
   187
   * @returns an id for the scheduled event.
mathieu@150
   188
   */
mathieu@1295
   189
  template <typename MEM, typename OBJ, 
mathieu@948
   190
            typename T1, typename T2, typename T3>
mathieu@1295
   191
  static EventId Schedule (Time const &time, MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3);
craigdo@3470
   192
mathieu@150
   193
  /**
tomh@345
   194
   * @param time the relative expiration time of the event.
mathieu@150
   195
   * @param mem_ptr member method pointer to invoke
mathieu@150
   196
   * @param obj the object on which to invoke the member method
mathieu@150
   197
   * @param a1 the first argument to pass to the invoked method
mathieu@150
   198
   * @param a2 the second argument to pass to the invoked method
mathieu@150
   199
   * @param a3 the third argument to pass to the invoked method
mathieu@150
   200
   * @param a4 the fourth argument to pass to the invoked method
mathieu@150
   201
   * @returns an id for the scheduled event.
mathieu@150
   202
   */
mathieu@1295
   203
  template <typename MEM, typename OBJ, 
mathieu@948
   204
            typename T1, typename T2, typename T3, typename T4>
mathieu@1295
   205
  static EventId Schedule (Time const &time, MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4);
craigdo@3470
   206
mathieu@150
   207
  /**
tomh@345
   208
   * @param time the relative expiration time of the event.
mathieu@150
   209
   * @param mem_ptr member method pointer to invoke
mathieu@150
   210
   * @param obj the object on which to invoke the member method
mathieu@150
   211
   * @param a1 the first argument to pass to the invoked method
mathieu@150
   212
   * @param a2 the second argument to pass to the invoked method
mathieu@150
   213
   * @param a3 the third argument to pass to the invoked method
mathieu@150
   214
   * @param a4 the fourth argument to pass to the invoked method
mathieu@150
   215
   * @param a5 the fifth argument to pass to the invoked method
mathieu@150
   216
   * @returns an id for the scheduled event.
mathieu@150
   217
   */
mathieu@1295
   218
  template <typename MEM, typename OBJ, 
mathieu@948
   219
            typename T1, typename T2, typename T3, typename T4, typename T5>
mathieu@1295
   220
  static EventId Schedule (Time const &time, MEM mem_ptr, OBJ obj, 
mathieu@690
   221
                           T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
mathieu@150
   222
  /**
tomh@345
   223
   * @param time the relative expiration time of the event.
mathieu@150
   224
   * @param f the function to invoke
mathieu@150
   225
   * @returns an id for the scheduled event.
mathieu@150
   226
   */
mathieu@150
   227
  static EventId Schedule (Time const &time, void (*f) (void));
craigdo@3470
   228
mathieu@150
   229
  /**
tomh@345
   230
   * @param time the relative expiration time of the event.
mathieu@150
   231
   * @param f the function to invoke
mathieu@150
   232
   * @param a1 the first argument to pass to the function to invoke
mathieu@150
   233
   * @returns an id for the scheduled event.
mathieu@150
   234
   */
mathieu@947
   235
  template <typename U1, typename T1>
mathieu@947
   236
  static EventId Schedule (Time const &time, void (*f) (U1), T1 a1);
craigdo@3470
   237
mathieu@150
   238
  /**
tomh@345
   239
   * @param time the relative expiration time of the event.
mathieu@150
   240
   * @param f the function to invoke
mathieu@150
   241
   * @param a1 the first argument to pass to the function to invoke
mathieu@150
   242
   * @param a2 the second argument to pass to the function to invoke
mathieu@150
   243
   * @returns an id for the scheduled event.
mathieu@150
   244
   */
mathieu@947
   245
  template <typename U1, typename U2, typename T1, typename T2>
mathieu@947
   246
  static EventId Schedule (Time const &time, void (*f) (U1,U2), T1 a1, T2 a2);
craigdo@3470
   247
mathieu@150
   248
  /**
tomh@345
   249
   * @param time the relative expiration time of the event.
mathieu@150
   250
   * @param f the function to invoke
mathieu@150
   251
   * @param a1 the first argument to pass to the function to invoke
mathieu@150
   252
   * @param a2 the second argument to pass to the function to invoke
mathieu@150
   253
   * @param a3 the third argument to pass to the function to invoke
mathieu@150
   254
   * @returns an id for the scheduled event.
mathieu@150
   255
   */
mathieu@947
   256
  template <typename U1, typename U2, typename U3, typename T1, typename T2, typename T3>
mathieu@947
   257
  static EventId Schedule (Time const &time, void (*f) (U1,U2,U3), T1 a1, T2 a2, T3 a3);
craigdo@3470
   258
mathieu@150
   259
  /**
tomh@345
   260
   * @param time the relative expiration time of the event.
mathieu@150
   261
   * @param f the function to invoke
mathieu@150
   262
   * @param a1 the first argument to pass to the function to invoke
mathieu@150
   263
   * @param a2 the second argument to pass to the function to invoke
mathieu@150
   264
   * @param a3 the third argument to pass to the function to invoke
mathieu@150
   265
   * @param a4 the fourth argument to pass to the function to invoke
mathieu@150
   266
   * @returns an id for the scheduled event.
mathieu@150
   267
   */
mathieu@947
   268
  template <typename U1, typename U2, typename U3, typename U4, 
mathieu@947
   269
            typename T1, typename T2, typename T3, typename T4>
mathieu@947
   270
  static EventId Schedule (Time const &time, void (*f) (U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4);
craigdo@3470
   271
mathieu@150
   272
  /**
tomh@345
   273
   * @param time the relative expiration time of the event.
mathieu@150
   274
   * @param f the function to invoke
mathieu@150
   275
   * @param a1 the first argument to pass to the function to invoke
mathieu@150
   276
   * @param a2 the second argument to pass to the function to invoke
mathieu@150
   277
   * @param a3 the third argument to pass to the function to invoke
mathieu@150
   278
   * @param a4 the fourth argument to pass to the function to invoke
mathieu@150
   279
   * @param a5 the fifth argument to pass to the function to invoke
mathieu@150
   280
   * @returns an id for the scheduled event.
mathieu@150
   281
   */
mathieu@947
   282
  template <typename U1, typename U2, typename U3, typename U4, typename U5,
mathieu@947
   283
            typename T1, typename T2, typename T3, typename T4, typename T5>
mathieu@947
   284
  static EventId Schedule (Time const &time, void (*f) (U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
mathieu@142
   285
mathieu@150
   286
  /**
mathieu@150
   287
   * Schedule an event to expire Now. All events scheduled to
mathieu@150
   288
   * to expire "Now" are scheduled FIFO, after all normal events
mathieu@150
   289
   * have expired. 
mathieu@150
   290
   *
mathieu@150
   291
   * @param mem_ptr member method pointer to invoke
mathieu@150
   292
   * @param obj the object on which to invoke the member method
mathieu@150
   293
   */
mathieu@1295
   294
  template <typename MEM, typename OBJ>
mathieu@1295
   295
  static EventId ScheduleNow (MEM mem_ptr, OBJ obj);
craigdo@3470
   296
mathieu@150
   297
  /**
mathieu@150
   298
   * @param mem_ptr member method pointer to invoke
mathieu@150
   299
   * @param obj the object on which to invoke the member method
mathieu@150
   300
   * @param a1 the first argument to pass to the invoked method
mathieu@150
   301
   */
mathieu@1295
   302
  template <typename MEM, typename OBJ, 
mathieu@948
   303
            typename T1>
mathieu@1295
   304
  static EventId ScheduleNow (MEM mem_ptr, OBJ obj, T1 a1);
craigdo@3470
   305
mathieu@150
   306
  /**
mathieu@150
   307
   * @param mem_ptr member method pointer to invoke
mathieu@150
   308
   * @param obj the object on which to invoke the member method
mathieu@150
   309
   * @param a1 the first argument to pass to the invoked method
mathieu@150
   310
   * @param a2 the second argument to pass to the invoked method
mathieu@150
   311
   */
mathieu@1295
   312
  template <typename MEM, typename OBJ, 
mathieu@948
   313
            typename T1, typename T2>
mathieu@1295
   314
  static EventId ScheduleNow (MEM mem_ptr, OBJ obj, T1 a1, T2 a2);
craigdo@3470
   315
mathieu@150
   316
  /**
mathieu@150
   317
   * @param mem_ptr member method pointer to invoke
mathieu@150
   318
   * @param obj the object on which to invoke the member method
mathieu@150
   319
   * @param a1 the first argument to pass to the invoked method
mathieu@150
   320
   * @param a2 the second argument to pass to the invoked method
mathieu@150
   321
   * @param a3 the third argument to pass to the invoked method
mathieu@150
   322
   */
mathieu@1295
   323
  template <typename MEM, typename OBJ, 
mathieu@948
   324
            typename T1, typename T2, typename T3>
mathieu@1295
   325
  static EventId ScheduleNow (MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3);
craigdo@3470
   326
mathieu@150
   327
  /**
mathieu@150
   328
   * @param mem_ptr member method pointer to invoke
mathieu@150
   329
   * @param obj the object on which to invoke the member method
mathieu@150
   330
   * @param a1 the first argument to pass to the invoked method
mathieu@150
   331
   * @param a2 the second argument to pass to the invoked method
mathieu@150
   332
   * @param a3 the third argument to pass to the invoked method
mathieu@150
   333
   * @param a4 the fourth argument to pass to the invoked method
mathieu@150
   334
   */
mathieu@1295
   335
  template <typename MEM, typename OBJ, 
mathieu@948
   336
            typename T1, typename T2, typename T3, typename T4>
mathieu@1295
   337
  static EventId ScheduleNow (MEM mem_ptr, OBJ obj, 
mathieu@1295
   338
                              T1 a1, T2 a2, T3 a3, T4 a4);
mathieu@150
   339
  /**
mathieu@150
   340
   * @param mem_ptr member method pointer to invoke
mathieu@150
   341
   * @param obj the object on which to invoke the member method
mathieu@150
   342
   * @param a1 the first argument to pass to the invoked method
mathieu@150
   343
   * @param a2 the second argument to pass to the invoked method
mathieu@150
   344
   * @param a3 the third argument to pass to the invoked method
mathieu@150
   345
   * @param a4 the fourth argument to pass to the invoked method
mathieu@150
   346
   * @param a5 the fifth argument to pass to the invoked method
mathieu@150
   347
   */
mathieu@1295
   348
  template <typename MEM, typename OBJ, 
mathieu@948
   349
            typename T1, typename T2, typename T3, typename T4, typename T5>
mathieu@1295
   350
  static EventId ScheduleNow (MEM mem_ptr, OBJ obj, 
mathieu@1295
   351
                              T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
mathieu@150
   352
  /**
mathieu@150
   353
   * @param f the function to invoke
mathieu@150
   354
   */
mathieu@963
   355
  static EventId ScheduleNow (void (*f) (void));
craigdo@3470
   356
mathieu@150
   357
  /**
mathieu@150
   358
   * @param f the function to invoke
mathieu@150
   359
   * @param a1 the first argument to pass to the function to invoke
mathieu@150
   360
   */
mathieu@948
   361
  template <typename U1,
mathieu@948
   362
            typename T1>
mathieu@963
   363
  static EventId ScheduleNow (void (*f) (U1), T1 a1);
craigdo@3470
   364
mathieu@150
   365
  /**
mathieu@150
   366
   * @param f the function to invoke
mathieu@150
   367
   * @param a1 the first argument to pass to the function to invoke
mathieu@150
   368
   * @param a2 the second argument to pass to the function to invoke
mathieu@150
   369
   */
mathieu@948
   370
  template <typename U1, typename U2,
mathieu@948
   371
            typename T1, typename T2>
mathieu@963
   372
  static EventId ScheduleNow (void (*f) (U1,U2), T1 a1, T2 a2);
craigdo@3470
   373
mathieu@150
   374
  /**
mathieu@150
   375
   * @param f the function to invoke
mathieu@150
   376
   * @param a1 the first argument to pass to the function to invoke
mathieu@150
   377
   * @param a2 the second argument to pass to the function to invoke
mathieu@150
   378
   * @param a3 the third argument to pass to the function to invoke
mathieu@150
   379
   */
mathieu@948
   380
  template <typename U1, typename U2, typename U3,
mathieu@948
   381
            typename T1, typename T2, typename T3>
mathieu@963
   382
  static EventId ScheduleNow (void (*f) (U1,U2,U3), T1 a1, T2 a2, T3 a3);
craigdo@3470
   383
mathieu@150
   384
  /**
mathieu@150
   385
   * @param f the function to invoke
mathieu@150
   386
   * @param a1 the first argument to pass to the function to invoke
mathieu@150
   387
   * @param a2 the second argument to pass to the function to invoke
mathieu@150
   388
   * @param a3 the third argument to pass to the function to invoke
mathieu@150
   389
   * @param a4 the fourth argument to pass to the function to invoke
mathieu@150
   390
   */
mathieu@948
   391
  template <typename U1, typename U2, typename U3, typename U4,
mathieu@948
   392
            typename T1, typename T2, typename T3, typename T4>
mathieu@963
   393
  static EventId ScheduleNow (void (*f) (U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4);
craigdo@3470
   394
mathieu@150
   395
  /**
mathieu@150
   396
   * @param f the function to invoke
mathieu@150
   397
   * @param a1 the first argument to pass to the function to invoke
mathieu@150
   398
   * @param a2 the second argument to pass to the function to invoke
mathieu@150
   399
   * @param a3 the third argument to pass to the function to invoke
mathieu@150
   400
   * @param a4 the fourth argument to pass to the function to invoke
mathieu@150
   401
   * @param a5 the fifth argument to pass to the function to invoke
mathieu@150
   402
   */
mathieu@948
   403
  template <typename U1, typename U2, typename U3, typename U4, typename U5,
mathieu@948
   404
            typename T1, typename T2, typename T3, typename T4, typename T5>
mathieu@963
   405
  static EventId ScheduleNow (void (*f) (U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
mathieu@146
   406
mathieu@150
   407
  /**
mathieu@150
   408
   * Schedule an event to expire at Destroy time. All events 
mathieu@150
   409
   * scheduled to expire at "Destroy" time are scheduled FIFO, 
mathieu@150
   410
   * after all normal events have expired and only when 
mathieu@150
   411
   * Simulator::Destroy is invoked.
mathieu@150
   412
   *
mathieu@150
   413
   * @param mem_ptr member method pointer to invoke
mathieu@150
   414
   * @param obj the object on which to invoke the member method
mathieu@150
   415
   */
mathieu@1295
   416
  template <typename MEM, typename OBJ>
mathieu@1295
   417
  static EventId ScheduleDestroy (MEM mem_ptr, OBJ obj);
craigdo@3470
   418
mathieu@150
   419
  /**
mathieu@150
   420
   * @param mem_ptr member method pointer to invoke
mathieu@150
   421
   * @param obj the object on which to invoke the member method
mathieu@150
   422
   * @param a1 the first argument to pass to the invoked method
mathieu@150
   423
   */
mathieu@1295
   424
  template <typename MEM, typename OBJ, 
mathieu@948
   425
            typename T1>
mathieu@1295
   426
  static EventId ScheduleDestroy (MEM mem_ptr, OBJ obj, T1 a1);
craigdo@3470
   427
mathieu@150
   428
  /**
mathieu@150
   429
   * @param mem_ptr member method pointer to invoke
mathieu@150
   430
   * @param obj the object on which to invoke the member method
mathieu@150
   431
   * @param a1 the first argument to pass to the invoked method
mathieu@150
   432
   * @param a2 the second argument to pass to the invoked method
mathieu@150
   433
   */
mathieu@1295
   434
  template <typename MEM, typename OBJ,
mathieu@948
   435
            typename T1, typename T2>
mathieu@1295
   436
  static EventId ScheduleDestroy (MEM mem_ptr, OBJ obj, T1 a1, T2 a2);
craigdo@3470
   437
mathieu@150
   438
  /**
mathieu@150
   439
   * @param mem_ptr member method pointer to invoke
mathieu@150
   440
   * @param obj the object on which to invoke the member method
mathieu@150
   441
   * @param a1 the first argument to pass to the invoked method
mathieu@150
   442
   * @param a2 the second argument to pass to the invoked method
mathieu@150
   443
   * @param a3 the third argument to pass to the invoked method
mathieu@150
   444
   */
mathieu@1295
   445
  template <typename MEM, typename OBJ, 
mathieu@948
   446
            typename T1, typename T2, typename T3>
mathieu@1295
   447
  static EventId ScheduleDestroy (MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3);
craigdo@3470
   448
mathieu@150
   449
  /**
mathieu@150
   450
   * @param mem_ptr member method pointer to invoke
mathieu@150
   451
   * @param obj the object on which to invoke the member method
mathieu@150
   452
   * @param a1 the first argument to pass to the invoked method
mathieu@150
   453
   * @param a2 the second argument to pass to the invoked method
mathieu@150
   454
   * @param a3 the third argument to pass to the invoked method
mathieu@150
   455
   * @param a4 the fourth argument to pass to the invoked method
mathieu@150
   456
   */
mathieu@1295
   457
  template <typename MEM, typename OBJ, 
mathieu@948
   458
            typename T1, typename T2, typename T3, typename T4>
mathieu@1295
   459
  static EventId ScheduleDestroy (MEM mem_ptr, OBJ obj, 
mathieu@1295
   460
                                  T1 a1, T2 a2, T3 a3, T4 a4);
mathieu@150
   461
  /**
mathieu@150
   462
   * @param mem_ptr member method pointer to invoke
mathieu@150
   463
   * @param obj the object on which to invoke the member method
mathieu@150
   464
   * @param a1 the first argument to pass to the invoked method
mathieu@150
   465
   * @param a2 the second argument to pass to the invoked method
mathieu@150
   466
   * @param a3 the third argument to pass to the invoked method
mathieu@150
   467
   * @param a4 the fourth argument to pass to the invoked method
mathieu@150
   468
   * @param a5 the fifth argument to pass to the invoked method
mathieu@150
   469
   */
mathieu@1295
   470
  template <typename MEM, typename OBJ, 
mathieu@948
   471
            typename T1, typename T2, typename T3, typename T4, typename T5>
mathieu@1295
   472
  static EventId ScheduleDestroy (MEM mem_ptr, OBJ obj, 
mathieu@1295
   473
                                  T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
mathieu@150
   474
  /**
mathieu@150
   475
   * @param f the function to invoke
mathieu@150
   476
   */
mathieu@963
   477
  static EventId ScheduleDestroy (void (*f) (void));
craigdo@3470
   478
mathieu@150
   479
  /**
mathieu@150
   480
   * @param f the function to invoke
mathieu@150
   481
   * @param a1 the first argument to pass to the function to invoke
mathieu@150
   482
   */
mathieu@948
   483
  template <typename U1,
mathieu@948
   484
            typename T1>
mathieu@963
   485
  static EventId ScheduleDestroy (void (*f) (U1), T1 a1);
craigdo@3470
   486
mathieu@150
   487
  /**
mathieu@150
   488
   * @param f the function to invoke
mathieu@150
   489
   * @param a1 the first argument to pass to the function to invoke
mathieu@150
   490
   * @param a2 the second argument to pass to the function to invoke
mathieu@150
   491
   */
mathieu@948
   492
  template <typename U1, typename U2,
mathieu@948
   493
            typename T1, typename T2>
mathieu@963
   494
  static EventId ScheduleDestroy (void (*f) (U1,U2), T1 a1, T2 a2);
craigdo@3470
   495
mathieu@150
   496
  /**
mathieu@150
   497
   * @param f the function to invoke
mathieu@150
   498
   * @param a1 the first argument to pass to the function to invoke
mathieu@150
   499
   * @param a2 the second argument to pass to the function to invoke
mathieu@150
   500
   * @param a3 the third argument to pass to the function to invoke
mathieu@150
   501
   */
mathieu@948
   502
  template <typename U1, typename U2, typename U3,
mathieu@948
   503
            typename T1, typename T2, typename T3>
mathieu@963
   504
  static EventId ScheduleDestroy (void (*f) (U1,U2,U3), T1 a1, T2 a2, T3 a3);
craigdo@3470
   505
mathieu@150
   506
  /**
mathieu@150
   507
   * @param f the function to invoke
mathieu@150
   508
   * @param a1 the first argument to pass to the function to invoke
mathieu@150
   509
   * @param a2 the second argument to pass to the function to invoke
mathieu@150
   510
   * @param a3 the third argument to pass to the function to invoke
mathieu@150
   511
   * @param a4 the fourth argument to pass to the function to invoke
mathieu@150
   512
   */
mathieu@948
   513
  template <typename U1, typename U2, typename U3, typename U4,
mathieu@948
   514
            typename T1, typename T2, typename T3, typename T4>
mathieu@963
   515
  static EventId ScheduleDestroy (void (*f) (U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4);
craigdo@3470
   516
mathieu@150
   517
  /**
mathieu@150
   518
   * @param f the function to invoke
mathieu@150
   519
   * @param a1 the first argument to pass to the function to invoke
mathieu@150
   520
   * @param a2 the second argument to pass to the function to invoke
mathieu@150
   521
   * @param a3 the third argument to pass to the function to invoke
mathieu@150
   522
   * @param a4 the fourth argument to pass to the function to invoke
mathieu@150
   523
   * @param a5 the fifth argument to pass to the function to invoke
mathieu@150
   524
   */
mathieu@948
   525
  template <typename U1, typename U2, typename U3, typename U4, typename U5,
mathieu@948
   526
            typename T1, typename T2, typename T3, typename T4, typename T5>
mathieu@963
   527
  static EventId ScheduleDestroy (void (*f) (U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
mathieu@146
   528
mathieu@150
   529
  /**
mathieu@150
   530
   * Remove an event from the event list. 
mathieu@150
   531
   * This method has the same visible effect as the 
mathieu@472
   532
   * ns3::EventId::Cancel method
mathieu@150
   533
   * but its algorithmic complexity is much higher: it has often 
mathieu@150
   534
   * O(log(n)) complexity, sometimes O(n), sometimes worse.
mathieu@150
   535
   * Note that it is not possible to remove events which were scheduled
mathieu@150
   536
   * for the "destroy" time. Doing so will result in a program error (crash).
mathieu@150
   537
   *
mathieu@150
   538
   * @param id the event to remove from the list of scheduled events.
mathieu@150
   539
   */
mathieu@1011
   540
  static void Remove (const EventId &id);
craigdo@3470
   541
mathieu@150
   542
  /**
mathieu@150
   543
   * Set the cancel bit on this event: the event's associated function
mathieu@150
   544
   * will not be invoked when it expires. 
mathieu@150
   545
   * This method has the same visible effect as the 
mathieu@150
   546
   * ns3::Simulator::remove method but its algorithmic complexity is 
mathieu@150
   547
   * much lower: it has O(1) complexity.
mathieu@150
   548
   * This method has the exact same semantics as ns3::EventId::cancel.
mathieu@150
   549
   * Note that it is not possible to cancel events which were scheduled
mathieu@150
   550
   * for the "destroy" time. Doing so will result in a program error (crash).
mathieu@150
   551
   * 
mathieu@150
   552
   * @param id the event to cancel
mathieu@150
   553
   */
mathieu@1011
   554
  static void Cancel (const EventId &id);
craigdo@3470
   555
mathieu@150
   556
  /**
mathieu@150
   557
   * This method has O(1) complexity.
mathieu@150
   558
   * Note that it is not possible to test for the expiration of
mathieu@150
   559
   * events which were scheduled for the "destroy" time. Doing so
mathieu@150
   560
   * will result in a program error (crash).
mathieu@150
   561
   * An event is said to "expire" when it starts being scheduled
mathieu@150
   562
   * which means that if the code executed by the event calls
mathieu@150
   563
   * this function, it will get true.
mathieu@150
   564
   *
mathieu@150
   565
   * @param id the event to test for expiration
mathieu@150
   566
   * @returns true if the event has expired, false otherwise.
mathieu@150
   567
   */
mathieu@1011
   568
  static bool IsExpired (const EventId &id);
craigdo@3470
   569
mathieu@150
   570
  /**
mathieu@150
   571
   * Return the "current simulation time".
mathieu@150
   572
   */
mathieu@150
   573
  static Time Now (void);
craigdo@3470
   574
mathieu@1690
   575
  /**
mathieu@1690
   576
   * \param id the event id to analyse
mathieu@1690
   577
   * \returns the delay left until the input event id expires.
mathieu@1690
   578
   *          if the event is not running, this method returns
mathieu@1690
   579
   *          zero.
mathieu@1690
   580
   */
mathieu@1690
   581
  static Time GetDelayLeft (const EventId &id);
mathieu@1863
   582
mathieu@1863
   583
  /**
mathieu@1863
   584
   * \returns the maximum simulation time at which an event 
mathieu@1863
   585
   *          can be scheduled.
mathieu@1863
   586
   *
mathieu@1863
   587
   * The returned value will always be bigger than or equal to Simulator::Now.
mathieu@1863
   588
   */
mathieu@1863
   589
  static Time GetMaximumSimulationTime (void);
craigdo@3470
   590
mathieu@3369
   591
  /**
mathieu@3369
   592
   * \param time delay until the event expires
mathieu@3369
   593
   * \param event the event to schedule
mathieu@3369
   594
   * \returns a unique identifier for the newly-scheduled event.
mathieu@3369
   595
   *
mathieu@3369
   596
   * This method will be typically used by language bindings
mathieu@3369
   597
   * to delegate events to their own subclass of the EventImpl base class.
mathieu@3369
   598
   */
mathieu@3369
   599
  static EventId Schedule (Time const &time, const Ptr<EventImpl> &event);  
craigdo@3470
   600
mathieu@3369
   601
  /**
mathieu@3369
   602
   * \param event the event to schedule
mathieu@3369
   603
   * \returns a unique identifier for the newly-scheduled event.
mathieu@3369
   604
   *
mathieu@3369
   605
   * This method will be typically used by language bindings
mathieu@3369
   606
   * to delegate events to their own subclass of the EventImpl base class.
mathieu@3369
   607
   */
mathieu@3369
   608
  static EventId ScheduleDestroy (const Ptr<EventImpl> &event);
craigdo@3470
   609
mathieu@3369
   610
  /**
mathieu@3369
   611
   * \param event the event to schedule
mathieu@3369
   612
   * \returns a unique identifier for the newly-scheduled event.
mathieu@3369
   613
   *
mathieu@3369
   614
   * This method will be typically used by language bindings
mathieu@3369
   615
   * to delegate events to their own subclass of the EventImpl base class.
mathieu@3369
   616
   */
mathieu@3369
   617
  static EventId ScheduleNow (const Ptr<EventImpl> &event);
mathieu@9
   618
private:
mathieu@150
   619
  Simulator ();
mathieu@150
   620
  ~Simulator ();
mathieu@947
   621
mathieu@3808
   622
  static EventId DoSchedule (Time const &time, EventImpl *event);  
mathieu@3808
   623
  static EventId DoScheduleNow (EventImpl *event);
mathieu@3808
   624
  static EventId DoScheduleDestroy (EventImpl *event);
mathieu@9
   625
};
mathieu@9
   626
mathieu@679
   627
/**
mathieu@679
   628
 * \brief create an ns3::Time instance which contains the
mathieu@679
   629
 *        current simulation time.
mathieu@679
   630
 *
mathieu@679
   631
 * This is really a shortcut for the ns3::Simulator::Now method.
mathieu@679
   632
 * It is typically used as shown below to schedule an event
mathieu@679
   633
 * which expires at the absolute time "2 seconds":
mathieu@679
   634
 * \code
mathieu@679
   635
 * Simulator::Schedule (Seconds (2.0) - Now (), &my_function);
mathieu@679
   636
 * \endcode
mathieu@679
   637
 */
mathieu@679
   638
Time Now (void);
mathieu@679
   639
mathieu@3808
   640
} // namespace ns3
mathieu@9
   641
mathieu@75
   642
namespace ns3 {
mathieu@75
   643
mathieu@1295
   644
template <typename MEM, typename OBJ>
mathieu@1295
   645
EventId Simulator::Schedule (Time const &time, MEM mem_ptr, OBJ obj) 
mathieu@142
   646
{
mathieu@3808
   647
  return DoSchedule (time, MakeEvent (mem_ptr, obj));
mathieu@142
   648
}
mathieu@142
   649
mathieu@142
   650
mathieu@1295
   651
template <typename MEM, typename OBJ,
mathieu@948
   652
          typename T1>
mathieu@1295
   653
EventId Simulator::Schedule (Time const &time, MEM mem_ptr, OBJ obj, T1 a1) 
mathieu@142
   654
{
mathieu@3808
   655
  return DoSchedule (time, MakeEvent (mem_ptr, obj, a1));
mathieu@142
   656
}
mathieu@142
   657
mathieu@1295
   658
template <typename MEM, typename OBJ, 
mathieu@948
   659
          typename T1, typename T2>
mathieu@1295
   660
EventId Simulator::Schedule (Time const &time, MEM mem_ptr, OBJ obj, T1 a1, T2 a2)
mathieu@142
   661
{
mathieu@3808
   662
  return DoSchedule (time, MakeEvent (mem_ptr, obj, a1, a2));
mathieu@142
   663
}
mathieu@142
   664
mathieu@1295
   665
template <typename MEM, typename OBJ,
mathieu@948
   666
          typename T1, typename T2, typename T3>
mathieu@1295
   667
EventId Simulator::Schedule (Time const &time, MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3) 
mathieu@142
   668
{
mathieu@3808
   669
  return DoSchedule (time, MakeEvent (mem_ptr, obj, a1, a2, a3));
mathieu@142
   670
}
mathieu@142
   671
mathieu@1295
   672
template <typename MEM, typename OBJ, 
mathieu@948
   673
          typename T1, typename T2, typename T3, typename T4>
mathieu@1295
   674
EventId Simulator::Schedule (Time const &time, MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4) 
mathieu@142
   675
{
mathieu@3808
   676
  return DoSchedule (time, MakeEvent (mem_ptr, obj, a1, a2, a3, a4));
mathieu@142
   677
}
mathieu@142
   678
mathieu@1295
   679
template <typename MEM, typename OBJ, 
mathieu@948
   680
          typename T1, typename T2, typename T3, typename T4, typename T5>
mathieu@1295
   681
EventId Simulator::Schedule (Time const &time, MEM mem_ptr, OBJ obj, 
mathieu@1295
   682
                             T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) 
mathieu@142
   683
{
mathieu@3808
   684
  return DoSchedule (time, MakeEvent (mem_ptr, obj, a1, a2, a3, a4, a5));
mathieu@142
   685
}
mathieu@142
   686
mathieu@947
   687
template <typename U1, typename T1>
mathieu@947
   688
EventId Simulator::Schedule (Time const &time, void (*f) (U1), T1 a1) 
mathieu@142
   689
{
mathieu@3808
   690
  return DoSchedule (time, MakeEvent (f, a1));
mathieu@142
   691
}
mathieu@142
   692
mathieu@947
   693
template <typename U1, typename U2, 
mathieu@947
   694
          typename T1, typename T2>
mathieu@947
   695
EventId Simulator::Schedule (Time const &time, void (*f) (U1,U2), T1 a1, T2 a2) 
mathieu@142
   696
{
mathieu@3808
   697
  return DoSchedule (time, MakeEvent (f, a1, a2));
mathieu@142
   698
}
mathieu@142
   699
mathieu@947
   700
template <typename U1, typename U2, typename U3,
mathieu@947
   701
          typename T1, typename T2, typename T3>
mathieu@947
   702
EventId Simulator::Schedule (Time const &time, void (*f) (U1,U2,U3), T1 a1, T2 a2, T3 a3)
mathieu@142
   703
{
mathieu@3808
   704
  return DoSchedule (time, MakeEvent (f, a1, a2, a3));
mathieu@142
   705
}
mathieu@142
   706
mathieu@947
   707
template <typename U1, typename U2, typename U3, typename U4,
mathieu@947
   708
          typename T1, typename T2, typename T3, typename T4>
mathieu@947
   709
EventId Simulator::Schedule (Time const &time, void (*f) (U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4) 
mathieu@142
   710
{
mathieu@3808
   711
  return DoSchedule (time, MakeEvent (f, a1, a2, a3, a4));
mathieu@142
   712
}
mathieu@142
   713
mathieu@947
   714
template <typename U1, typename U2, typename U3, typename U4, typename U5,
mathieu@947
   715
          typename T1, typename T2, typename T3, typename T4, typename T5>
mathieu@947
   716
EventId Simulator::Schedule (Time const &time, void (*f) (U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) 
mathieu@142
   717
{
mathieu@3808
   718
  return DoSchedule (time, MakeEvent (f, a1, a2, a3, a4, a5));
mathieu@75
   719
}
mathieu@75
   720
mathieu@146
   721
mathieu@146
   722
mathieu@146
   723
mathieu@1295
   724
template <typename MEM, typename OBJ>
mathieu@963
   725
EventId
mathieu@1295
   726
Simulator::ScheduleNow (MEM mem_ptr, OBJ obj) 
mathieu@146
   727
{
mathieu@3808
   728
  return DoScheduleNow (MakeEvent (mem_ptr, obj));
mathieu@146
   729
}
mathieu@146
   730
mathieu@146
   731
mathieu@1295
   732
template <typename MEM, typename OBJ, 
mathieu@948
   733
          typename T1>
mathieu@963
   734
EventId
mathieu@1295
   735
Simulator::ScheduleNow (MEM mem_ptr, OBJ obj, T1 a1) 
mathieu@146
   736
{
mathieu@3808
   737
  return DoScheduleNow (MakeEvent (mem_ptr, obj, a1));
mathieu@146
   738
}
mathieu@146
   739
mathieu@1295
   740
template <typename MEM, typename OBJ, 
mathieu@948
   741
          typename T1, typename T2>
mathieu@963
   742
EventId
mathieu@1295
   743
Simulator::ScheduleNow (MEM mem_ptr, OBJ obj, T1 a1, T2 a2) 
mathieu@146
   744
{
mathieu@3808
   745
  return DoScheduleNow (MakeEvent (mem_ptr, obj, a1, a2));
mathieu@146
   746
}
mathieu@146
   747
mathieu@1295
   748
template <typename MEM, typename OBJ, 
mathieu@948
   749
          typename T1, typename T2, typename T3>
mathieu@963
   750
EventId
mathieu@1295
   751
Simulator::ScheduleNow (MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3) 
mathieu@146
   752
{
mathieu@3808
   753
  return DoScheduleNow (MakeEvent (mem_ptr, obj, a1, a2, a3));
mathieu@146
   754
}
mathieu@146
   755
mathieu@1295
   756
template <typename MEM, typename OBJ, 
mathieu@948
   757
          typename T1, typename T2, typename T3, typename T4>
mathieu@963
   758
EventId
mathieu@1295
   759
Simulator::ScheduleNow (MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4) 
mathieu@146
   760
{
mathieu@3808
   761
  return DoScheduleNow (MakeEvent (mem_ptr, obj, a1, a2, a3, a4));
mathieu@146
   762
}
mathieu@146
   763
mathieu@1295
   764
template <typename MEM, typename OBJ, 
mathieu@948
   765
          typename T1, typename T2, typename T3, typename T4, typename T5>
mathieu@963
   766
EventId
mathieu@1295
   767
Simulator::ScheduleNow (MEM mem_ptr, OBJ obj, 
mathieu@690
   768
                        T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) 
mathieu@146
   769
{
mathieu@3808
   770
  return DoScheduleNow (MakeEvent (mem_ptr, obj, a1, a2, a3, a4, a5));
mathieu@146
   771
}
mathieu@146
   772
mathieu@948
   773
template <typename U1,
mathieu@948
   774
          typename T1>
mathieu@963
   775
EventId
mathieu@948
   776
Simulator::ScheduleNow (void (*f) (U1), T1 a1) 
mathieu@146
   777
{
mathieu@3808
   778
  return DoScheduleNow (MakeEvent (f, a1));
mathieu@146
   779
}
mathieu@146
   780
mathieu@948
   781
template <typename U1, typename U2,
mathieu@948
   782
          typename T1, typename T2>
mathieu@963
   783
EventId
mathieu@948
   784
Simulator::ScheduleNow (void (*f) (U1,U2), T1 a1, T2 a2) 
mathieu@146
   785
{
mathieu@3808
   786
  return DoScheduleNow (MakeEvent (f, a1, a2));
mathieu@146
   787
}
mathieu@146
   788
mathieu@948
   789
template <typename U1, typename U2, typename U3,
mathieu@948
   790
          typename T1, typename T2, typename T3>
mathieu@963
   791
EventId
mathieu@948
   792
Simulator::ScheduleNow (void (*f) (U1,U2,U3), T1 a1, T2 a2, T3 a3)
mathieu@146
   793
{
mathieu@3808
   794
  return DoScheduleNow (MakeEvent (f, a1, a2, a3));
mathieu@146
   795
}
mathieu@146
   796
mathieu@948
   797
template <typename U1, typename U2, typename U3, typename U4,
mathieu@948
   798
          typename T1, typename T2, typename T3, typename T4>
mathieu@963
   799
EventId
mathieu@948
   800
Simulator::ScheduleNow (void (*f) (U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4) 
mathieu@146
   801
{
mathieu@3808
   802
  return DoScheduleNow (MakeEvent (f, a1, a2, a3, a4));
mathieu@146
   803
}
mathieu@146
   804
mathieu@948
   805
template <typename U1, typename U2, typename U3, typename U4, typename U5,
mathieu@948
   806
          typename T1, typename T2, typename T3, typename T4, typename T5>
mathieu@963
   807
EventId
mathieu@948
   808
Simulator::ScheduleNow (void (*f) (U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) 
mathieu@146
   809
{
mathieu@3808
   810
  return DoScheduleNow (MakeEvent (f, a1, a2, a3, a4, a5));
mathieu@146
   811
}
mathieu@146
   812
mathieu@146
   813
mathieu@146
   814
mathieu@1295
   815
template <typename MEM, typename OBJ>
mathieu@963
   816
EventId
mathieu@1295
   817
Simulator::ScheduleDestroy (MEM mem_ptr, OBJ obj) 
mathieu@146
   818
{
mathieu@3808
   819
  return DoScheduleDestroy (MakeEvent (mem_ptr, obj));
mathieu@146
   820
}
mathieu@146
   821
mathieu@146
   822
mathieu@1295
   823
template <typename MEM, typename OBJ, 
mathieu@948
   824
          typename T1>
mathieu@963
   825
EventId
mathieu@1295
   826
Simulator::ScheduleDestroy (MEM mem_ptr, OBJ obj, T1 a1) 
mathieu@146
   827
{
mathieu@3808
   828
  return DoScheduleDestroy (MakeEvent (mem_ptr, obj, a1));
mathieu@146
   829
}
mathieu@146
   830
mathieu@1295
   831
template <typename MEM, typename OBJ, 
mathieu@948
   832
          typename T1, typename T2>
mathieu@963
   833
EventId
mathieu@1295
   834
Simulator::ScheduleDestroy (MEM mem_ptr, OBJ obj, T1 a1, T2 a2) 
mathieu@146
   835
{
mathieu@3808
   836
  return DoScheduleDestroy (MakeEvent (mem_ptr, obj, a1, a2));
mathieu@146
   837
}
mathieu@146
   838
mathieu@1295
   839
template <typename MEM, typename OBJ, 
mathieu@948
   840
          typename T1, typename T2, typename T3>
mathieu@963
   841
EventId
mathieu@1295
   842
Simulator::ScheduleDestroy (MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3) 
mathieu@146
   843
{
mathieu@3808
   844
  return DoScheduleDestroy (MakeEvent (mem_ptr, obj, a1, a2, a3));
mathieu@146
   845
}
mathieu@146
   846
mathieu@1295
   847
template <typename MEM, typename OBJ,
mathieu@948
   848
          typename T1, typename T2, typename T3, typename T4>
mathieu@963
   849
EventId
mathieu@1295
   850
Simulator::ScheduleDestroy (MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4) 
mathieu@146
   851
{
mathieu@3808
   852
  return DoScheduleDestroy (MakeEvent (mem_ptr, obj, a1, a2, a3, a4));
mathieu@146
   853
}
mathieu@146
   854
mathieu@1295
   855
template <typename MEM, typename OBJ, 
mathieu@948
   856
          typename T1, typename T2, typename T3, typename T4, typename T5>
mathieu@963
   857
EventId
mathieu@1295
   858
Simulator::ScheduleDestroy (MEM mem_ptr, OBJ obj, 
mathieu@690
   859
                            T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) 
mathieu@146
   860
{
mathieu@3808
   861
  return DoScheduleDestroy (MakeEvent (mem_ptr, obj, a1, a2, a3, a4, a5));
mathieu@146
   862
}
mathieu@146
   863
mathieu@948
   864
template <typename U1,
mathieu@948
   865
          typename T1>
mathieu@963
   866
EventId
mathieu@948
   867
Simulator::ScheduleDestroy (void (*f) (U1), T1 a1) 
mathieu@146
   868
{
mathieu@3808
   869
  return DoScheduleDestroy (MakeEvent (f, a1));
mathieu@146
   870
}
mathieu@146
   871
mathieu@948
   872
template <typename U1, typename U2,
mathieu@948
   873
          typename T1, typename T2>
mathieu@963
   874
EventId
mathieu@948
   875
Simulator::ScheduleDestroy (void (*f) (U1,U2), T1 a1, T2 a2) 
mathieu@146
   876
{
mathieu@3808
   877
  return DoScheduleDestroy (MakeEvent (f, a1, a2));
mathieu@146
   878
}
mathieu@146
   879
mathieu@948
   880
template <typename U1, typename U2, typename U3,
mathieu@948
   881
          typename T1, typename T2, typename T3>
mathieu@963
   882
EventId
mathieu@948
   883
Simulator::ScheduleDestroy (void (*f) (U1,U2,U3), T1 a1, T2 a2, T3 a3)
mathieu@146
   884
{
mathieu@3808
   885
  return DoScheduleDestroy (MakeEvent (f, a1, a2, a3));
mathieu@146
   886
}
mathieu@146
   887
mathieu@948
   888
template <typename U1, typename U2, typename U3, typename U4,
mathieu@948
   889
          typename T1, typename T2, typename T3, typename T4>
mathieu@963
   890
EventId
mathieu@948
   891
Simulator::ScheduleDestroy (void (*f) (U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4) 
mathieu@146
   892
{
mathieu@3808
   893
  return DoScheduleDestroy (MakeEvent (f, a1, a2, a3, a4));
mathieu@146
   894
}
mathieu@146
   895
mathieu@948
   896
template <typename U1, typename U2, typename U3, typename U4, typename U5,
mathieu@948
   897
          typename T1, typename T2, typename T3, typename T4, typename T5>
mathieu@963
   898
EventId
mathieu@948
   899
Simulator::ScheduleDestroy (void (*f) (U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) 
mathieu@146
   900
{
mathieu@3808
   901
  return DoScheduleDestroy (MakeEvent (f, a1, a2, a3, a4, a5));
mathieu@146
   902
}
mathieu@146
   903
mathieu@3808
   904
} // namespace ns3
mathieu@75
   905
mathieu@9
   906
#endif /* SIMULATOR_H */