A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
simulator.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2005 INRIA
4  *
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;
8  *
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.
13  *
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
17  *
18  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19  */
20 
21 #ifndef SIMULATOR_H
22 #define SIMULATOR_H
23 
24 #include "event-id.h"
25 #include "event-impl.h"
26 #include "make-event.h"
27 #include "nstime.h"
28 
29 #include "object-factory.h"
30 
31 #include <stdint.h>
32 #include <string>
33 
40 namespace ns3 {
41 
42 class SimulatorImpl;
43 class Scheduler;
44 
70 class Simulator
71 {
72 public:
85  static void SetImplementation (Ptr<SimulatorImpl> impl);
86 
105 
114  static void SetScheduler (ObjectFactory schedulerFactory);
115 
125  static void Destroy (void);
126 
136  static bool IsFinished (void);
137 
148  static void Run (void);
149 
158  static void Stop (void);
159 
169  static void Stop (const Time &delay);
170 
191  template <typename MEM, typename OBJ>
192  static EventId Schedule (Time const &delay, MEM mem_ptr, OBJ obj);
193 
205  template <typename MEM, typename OBJ, typename T1>
206  static EventId Schedule (Time const &delay, MEM mem_ptr, OBJ obj, T1 a1);
207 
221  template <typename MEM, typename OBJ, typename T1, typename T2>
222  static EventId Schedule (Time const &delay, MEM mem_ptr, OBJ obj, T1 a1, T2 a2);
223 
239  template <typename MEM, typename OBJ,
240  typename T1, typename T2, typename T3>
241  static EventId Schedule (Time const &delay, MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3);
242 
260  template <typename MEM, typename OBJ,
261  typename T1, typename T2, typename T3, typename T4>
262  static EventId Schedule (Time const &delay, MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4);
263 
283  template <typename MEM, typename OBJ,
284  typename T1, typename T2, typename T3, typename T4, typename T5>
285  static EventId Schedule (Time const &delay, MEM mem_ptr, OBJ obj,
286  T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
299  static EventId Schedule (Time const &delay, void (*f)(void));
300 
310  template <typename U1, typename T1>
311  static EventId Schedule (Time const &delay, void (*f)(U1), T1 a1);
312 
325  template <typename U1, typename U2,
326  typename T1, typename T2>
327  static EventId Schedule (Time const &delay, void (*f)(U1,U2), T1 a1, T2 a2);
328 
344  template <typename U1, typename U2, typename U3,
345  typename T1, typename T2, typename T3>
346  static EventId Schedule (Time const &delay, void (*f)(U1,U2,U3), T1 a1, T2 a2, T3 a3);
347 
366  template <typename U1, typename U2, typename U3, typename U4,
367  typename T1, typename T2, typename T3, typename T4>
368  static EventId Schedule (Time const &delay, void (*f)(U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4);
369 
391  template <typename U1, typename U2, typename U3, typename U4, typename U5,
392  typename T1, typename T2, typename T3, typename T4, typename T5>
393  static EventId Schedule (Time const &delay, void (*f)(U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
394 
416  template <typename MEM, typename OBJ>
417  static void ScheduleWithContext (uint32_t context, Time const &delay, MEM mem_ptr, OBJ obj);
418 
430  template <typename MEM, typename OBJ, typename T1>
431  static void ScheduleWithContext (uint32_t context, Time const &delay, MEM mem_ptr, OBJ obj, T1 a1);
432 
446  template <typename MEM, typename OBJ, typename T1, typename T2>
447  static void ScheduleWithContext (uint32_t context, Time const &delay, MEM mem_ptr, OBJ obj, T1 a1, T2 a2);
448 
464  template <typename MEM, typename OBJ,
465  typename T1, typename T2, typename T3>
466  static void ScheduleWithContext (uint32_t context, Time const &delay, MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3);
467 
485  template <typename MEM, typename OBJ,
486  typename T1, typename T2, typename T3, typename T4>
487  static void ScheduleWithContext (uint32_t context, Time const &delay, MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4);
488 
508  template <typename MEM, typename OBJ,
509  typename T1, typename T2, typename T3, typename T4, typename T5>
510  static void ScheduleWithContext (uint32_t context, Time const &delay, MEM mem_ptr, OBJ obj,
511  T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
525  static void ScheduleWithContext (uint32_t context, Time const &delay, void (*f)(void));
526 
536  template <typename U1,
537  typename T1>
538  static void ScheduleWithContext (uint32_t context, Time const &delay, void (*f)(U1), T1 a1);
539 
552  template <typename U1, typename U2,
553  typename T1, typename T2>
554  static void ScheduleWithContext (uint32_t context, Time const &delay, void (*f)(U1,U2), T1 a1, T2 a2);
555 
571  template <typename U1, typename U2, typename U3,
572  typename T1, typename T2, typename T3>
573  static void ScheduleWithContext (uint32_t context, Time const &delay, void (*f)(U1,U2,U3), T1 a1, T2 a2, T3 a3);
574 
593  template <typename U1, typename U2, typename U3, typename U4,
594  typename T1, typename T2, typename T3, typename T4>
595  static void ScheduleWithContext (uint32_t context, Time const &delay, void (*f)(U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4);
596 
618  template <typename U1, typename U2, typename U3, typename U4, typename U5,
619  typename T1, typename T2, typename T3, typename T4, typename T5>
620  static void ScheduleWithContext (uint32_t context, Time const &delay, void (*f)(U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
621 
639  template <typename MEM, typename OBJ>
640  static EventId ScheduleNow (MEM mem_ptr, OBJ obj);
641 
652  template <typename MEM, typename OBJ,
653  typename T1>
654  static EventId ScheduleNow (MEM mem_ptr, OBJ obj, T1 a1);
655 
668  template <typename MEM, typename OBJ,
669  typename T1, typename T2>
670  static EventId ScheduleNow (MEM mem_ptr, OBJ obj, T1 a1, T2 a2);
671 
686  template <typename MEM, typename OBJ,
687  typename T1, typename T2, typename T3>
688  static EventId ScheduleNow (MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3);
689 
706  template <typename MEM, typename OBJ,
707  typename T1, typename T2, typename T3, typename T4>
708  static EventId ScheduleNow (MEM mem_ptr, OBJ obj,
709  T1 a1, T2 a2, T3 a3, T4 a4);
728  template <typename MEM, typename OBJ,
729  typename T1, typename T2, typename T3, typename T4, typename T5>
730  static EventId ScheduleNow (MEM mem_ptr, OBJ obj,
731  T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
740  static EventId ScheduleNow (void (*f)(void));
741 
750  template <typename U1,
751  typename T1>
752  static EventId ScheduleNow (void (*f)(U1), T1 a1);
753 
765  template <typename U1, typename U2,
766  typename T1, typename T2>
767  static EventId ScheduleNow (void (*f)(U1,U2), T1 a1, T2 a2);
768 
783  template <typename U1, typename U2, typename U3,
784  typename T1, typename T2, typename T3>
785  static EventId ScheduleNow (void (*f)(U1,U2,U3), T1 a1, T2 a2, T3 a3);
786 
804  template <typename U1, typename U2, typename U3, typename U4,
805  typename T1, typename T2, typename T3, typename T4>
806  static EventId ScheduleNow (void (*f)(U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4);
807 
828  template <typename U1, typename U2, typename U3, typename U4, typename U5,
829  typename T1, typename T2, typename T3, typename T4, typename T5>
830  static EventId ScheduleNow (void (*f)(U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
831 
850  template <typename MEM, typename OBJ>
851  static EventId ScheduleDestroy (MEM mem_ptr, OBJ obj);
852 
863  template <typename MEM, typename OBJ,
864  typename T1>
865  static EventId ScheduleDestroy (MEM mem_ptr, OBJ obj, T1 a1);
866 
879  template <typename MEM, typename OBJ,
880  typename T1, typename T2>
881  static EventId ScheduleDestroy (MEM mem_ptr, OBJ obj, T1 a1, T2 a2);
882 
897  template <typename MEM, typename OBJ,
898  typename T1, typename T2, typename T3>
899  static EventId ScheduleDestroy (MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3);
900 
917  template <typename MEM, typename OBJ,
918  typename T1, typename T2, typename T3, typename T4>
919  static EventId ScheduleDestroy (MEM mem_ptr, OBJ obj,
920  T1 a1, T2 a2, T3 a3, T4 a4);
939  template <typename MEM, typename OBJ,
940  typename T1, typename T2, typename T3, typename T4, typename T5>
941  static EventId ScheduleDestroy (MEM mem_ptr, OBJ obj,
942  T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
950  static EventId ScheduleDestroy (void (*f)(void));
951 
960  template <typename U1,
961  typename T1>
962  static EventId ScheduleDestroy (void (*f)(U1), T1 a1);
963 
975  template <typename U1, typename U2,
976  typename T1, typename T2>
977  static EventId ScheduleDestroy (void (*f)(U1,U2), T1 a1, T2 a2);
978 
993  template <typename U1, typename U2, typename U3,
994  typename T1, typename T2, typename T3>
995  static EventId ScheduleDestroy (void (*f)(U1,U2,U3), T1 a1, T2 a2, T3 a3);
996 
1014  template <typename U1, typename U2, typename U3, typename U4,
1015  typename T1, typename T2, typename T3, typename T4>
1016  static EventId ScheduleDestroy (void (*f)(U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4);
1017 
1038  template <typename U1, typename U2, typename U3, typename U4, typename U5,
1039  typename T1, typename T2, typename T3, typename T4, typename T5>
1040  static EventId ScheduleDestroy (void (*f)(U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
1041 
1056  static void Remove (const EventId &id);
1057 
1071  static void Cancel (const EventId &id);
1072 
1087  static bool IsExpired (const EventId &id);
1088 
1094  static Time Now (void);
1095 
1104  static Time GetDelayLeft (const EventId &id);
1105 
1114  static Time GetMaximumSimulationTime (void);
1115 
1121  static uint32_t GetContext (void);
1122 
1130  static EventId Schedule (const Time &delay, const Ptr<EventImpl> &event);
1131 
1141  static void ScheduleWithContext (uint32_t context, const Time &delay, EventImpl *event);
1142 
1150  static EventId ScheduleDestroy (const Ptr<EventImpl> &event);
1151 
1158  static EventId ScheduleNow (const Ptr<EventImpl> &event);
1159 
1167  static uint32_t GetSystemId (void);
1168 
1169 private:
1171  Simulator ();
1173  ~Simulator ();
1174 
1181  static EventId DoSchedule (Time const &delay, EventImpl *event);
1187  static EventId DoScheduleNow (EventImpl *event);
1193  static EventId DoScheduleDestroy (EventImpl *event);
1194 };
1195 
1209 Time Now (void);
1210 
1211 } // namespace ns3
1212 
1213 
1214 /********************************************************************
1215  * Implementation of the templates declared above.
1216  ********************************************************************/
1217 
1218 namespace ns3 {
1219 
1220 template <typename MEM, typename OBJ>
1221 EventId Simulator::Schedule (Time const &delay, MEM mem_ptr, OBJ obj)
1222 {
1223  return DoSchedule (delay, MakeEvent (mem_ptr, obj));
1224 }
1225 
1226 
1227 template <typename MEM, typename OBJ,
1228  typename T1>
1229 EventId Simulator::Schedule (Time const &delay, MEM mem_ptr, OBJ obj, T1 a1)
1230 {
1231  return DoSchedule (delay, MakeEvent (mem_ptr, obj, a1));
1232 }
1233 
1234 template <typename MEM, typename OBJ,
1235  typename T1, typename T2>
1236 EventId Simulator::Schedule (Time const &delay, MEM mem_ptr, OBJ obj, T1 a1, T2 a2)
1237 {
1238  return DoSchedule (delay, MakeEvent (mem_ptr, obj, a1, a2));
1239 }
1240 
1241 template <typename MEM, typename OBJ,
1242  typename T1, typename T2, typename T3>
1243 EventId Simulator::Schedule (Time const &delay, MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3)
1244 {
1245  return DoSchedule (delay, MakeEvent (mem_ptr, obj, a1, a2, a3));
1246 }
1247 
1248 template <typename MEM, typename OBJ,
1249  typename T1, typename T2, typename T3, typename T4>
1250 EventId Simulator::Schedule (Time const &delay, MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4)
1251 {
1252  return DoSchedule (delay, MakeEvent (mem_ptr, obj, a1, a2, a3, a4));
1253 }
1254 
1255 template <typename MEM, typename OBJ,
1256  typename T1, typename T2, typename T3, typename T4, typename T5>
1257 EventId Simulator::Schedule (Time const &delay, MEM mem_ptr, OBJ obj,
1258  T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
1259 {
1260  return DoSchedule (delay, MakeEvent (mem_ptr, obj, a1, a2, a3, a4, a5));
1261 }
1262 
1263 template <typename U1,
1264  typename T1>
1265 EventId Simulator::Schedule (Time const &delay, void (*f)(U1), T1 a1)
1266 {
1267  return DoSchedule (delay, MakeEvent (f, a1));
1268 }
1269 
1270 template <typename U1, typename U2,
1271  typename T1, typename T2>
1272 EventId Simulator::Schedule (Time const &delay, void (*f)(U1,U2), T1 a1, T2 a2)
1273 {
1274  return DoSchedule (delay, MakeEvent (f, a1, a2));
1275 }
1276 
1277 template <typename U1, typename U2, typename U3,
1278  typename T1, typename T2, typename T3>
1279 EventId Simulator::Schedule (Time const &delay, void (*f)(U1,U2,U3), T1 a1, T2 a2, T3 a3)
1280 {
1281  return DoSchedule (delay, MakeEvent (f, a1, a2, a3));
1282 }
1283 
1284 template <typename U1, typename U2, typename U3, typename U4,
1285  typename T1, typename T2, typename T3, typename T4>
1286 EventId Simulator::Schedule (Time const &delay, void (*f)(U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4)
1287 {
1288  return DoSchedule (delay, MakeEvent (f, a1, a2, a3, a4));
1289 }
1290 
1291 template <typename U1, typename U2, typename U3, typename U4, typename U5,
1292  typename T1, typename T2, typename T3, typename T4, typename T5>
1293 EventId Simulator::Schedule (Time const &delay, void (*f)(U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
1294 {
1295  return DoSchedule (delay, MakeEvent (f, a1, a2, a3, a4, a5));
1296 }
1297 
1298 
1299 
1300 
1301 template <typename MEM, typename OBJ>
1302 void Simulator::ScheduleWithContext (uint32_t context, Time const &delay, MEM mem_ptr, OBJ obj)
1303 {
1304  ScheduleWithContext (context, delay, MakeEvent (mem_ptr, obj));
1305 }
1306 
1307 
1308 template <typename MEM, typename OBJ,
1309  typename T1>
1310 void Simulator::ScheduleWithContext (uint32_t context, Time const &delay, MEM mem_ptr, OBJ obj, T1 a1)
1311 {
1312  return ScheduleWithContext (context, delay, MakeEvent (mem_ptr, obj, a1));
1313 }
1314 
1315 template <typename MEM, typename OBJ,
1316  typename T1, typename T2>
1317 void Simulator::ScheduleWithContext (uint32_t context, Time const &delay, MEM mem_ptr, OBJ obj, T1 a1, T2 a2)
1318 {
1319  return ScheduleWithContext (context, delay, MakeEvent (mem_ptr, obj, a1, a2));
1320 }
1321 
1322 template <typename MEM, typename OBJ,
1323  typename T1, typename T2, typename T3>
1324 void Simulator::ScheduleWithContext (uint32_t context, Time const &delay, MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3)
1325 {
1326  return ScheduleWithContext (context, delay, MakeEvent (mem_ptr, obj, a1, a2, a3));
1327 }
1328 
1329 template <typename MEM, typename OBJ,
1330  typename T1, typename T2, typename T3, typename T4>
1331 void Simulator::ScheduleWithContext (uint32_t context, Time const &delay, MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4)
1332 {
1333  return ScheduleWithContext (context, delay, MakeEvent (mem_ptr, obj, a1, a2, a3, a4));
1334 }
1335 
1336 template <typename MEM, typename OBJ,
1337  typename T1, typename T2, typename T3, typename T4, typename T5>
1338 void Simulator::ScheduleWithContext (uint32_t context, Time const &delay, MEM mem_ptr, OBJ obj,
1339  T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
1340 {
1341  return ScheduleWithContext (context, delay, MakeEvent (mem_ptr, obj, a1, a2, a3, a4, a5));
1342 }
1343 
1344 template <typename U1,
1345  typename T1>
1346 void Simulator::ScheduleWithContext (uint32_t context, Time const &delay, void (*f)(U1), T1 a1)
1347 {
1348  return ScheduleWithContext (context, delay, MakeEvent (f, a1));
1349 }
1350 
1351 template <typename U1, typename U2,
1352  typename T1, typename T2>
1353 void Simulator::ScheduleWithContext (uint32_t context, Time const &delay, void (*f)(U1,U2), T1 a1, T2 a2)
1354 {
1355  return ScheduleWithContext (context, delay, MakeEvent (f, a1, a2));
1356 }
1357 
1358 template <typename U1, typename U2, typename U3,
1359  typename T1, typename T2, typename T3>
1360 void Simulator::ScheduleWithContext (uint32_t context, Time const &delay, void (*f)(U1,U2,U3), T1 a1, T2 a2, T3 a3)
1361 {
1362  return ScheduleWithContext (context, delay, MakeEvent (f, a1, a2, a3));
1363 }
1364 
1365 template <typename U1, typename U2, typename U3, typename U4,
1366  typename T1, typename T2, typename T3, typename T4>
1367 void Simulator::ScheduleWithContext (uint32_t context, Time const &delay, void (*f)(U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4)
1368 {
1369  return ScheduleWithContext (context, delay, MakeEvent (f, a1, a2, a3, a4));
1370 }
1371 
1372 template <typename U1, typename U2, typename U3, typename U4, typename U5,
1373  typename T1, typename T2, typename T3, typename T4, typename T5>
1374 void Simulator::ScheduleWithContext (uint32_t context, Time const &delay, void (*f)(U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
1375 {
1376  return ScheduleWithContext (context, delay, MakeEvent (f, a1, a2, a3, a4, a5));
1377 }
1378 
1379 
1380 
1381 
1382 template <typename MEM, typename OBJ>
1383 EventId
1384 Simulator::ScheduleNow (MEM mem_ptr, OBJ obj)
1385 {
1386  return DoScheduleNow (MakeEvent (mem_ptr, obj));
1387 }
1388 
1389 
1390 template <typename MEM, typename OBJ,
1391  typename T1>
1392 EventId
1393 Simulator::ScheduleNow (MEM mem_ptr, OBJ obj, T1 a1)
1394 {
1395  return DoScheduleNow (MakeEvent (mem_ptr, obj, a1));
1396 }
1397 
1398 template <typename MEM, typename OBJ,
1399  typename T1, typename T2>
1400 EventId
1401 Simulator::ScheduleNow (MEM mem_ptr, OBJ obj, T1 a1, T2 a2)
1402 {
1403  return DoScheduleNow (MakeEvent (mem_ptr, obj, a1, a2));
1404 }
1405 
1406 template <typename MEM, typename OBJ,
1407  typename T1, typename T2, typename T3>
1408 EventId
1409 Simulator::ScheduleNow (MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3)
1410 {
1411  return DoScheduleNow (MakeEvent (mem_ptr, obj, a1, a2, a3));
1412 }
1413 
1414 template <typename MEM, typename OBJ,
1415  typename T1, typename T2, typename T3, typename T4>
1416 EventId
1417 Simulator::ScheduleNow (MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4)
1418 {
1419  return DoScheduleNow (MakeEvent (mem_ptr, obj, a1, a2, a3, a4));
1420 }
1421 
1422 template <typename MEM, typename OBJ,
1423  typename T1, typename T2, typename T3, typename T4, typename T5>
1424 EventId
1425 Simulator::ScheduleNow (MEM mem_ptr, OBJ obj,
1426  T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
1427 {
1428  return DoScheduleNow (MakeEvent (mem_ptr, obj, a1, a2, a3, a4, a5));
1429 }
1430 
1431 template <typename U1,
1432  typename T1>
1433 EventId
1434 Simulator::ScheduleNow (void (*f)(U1), T1 a1)
1435 {
1436  return DoScheduleNow (MakeEvent (f, a1));
1437 }
1438 
1439 template <typename U1, typename U2,
1440  typename T1, typename T2>
1441 EventId
1442 Simulator::ScheduleNow (void (*f)(U1,U2), T1 a1, T2 a2)
1443 {
1444  return DoScheduleNow (MakeEvent (f, a1, a2));
1445 }
1446 
1447 template <typename U1, typename U2, typename U3,
1448  typename T1, typename T2, typename T3>
1449 EventId
1450 Simulator::ScheduleNow (void (*f)(U1,U2,U3), T1 a1, T2 a2, T3 a3)
1451 {
1452  return DoScheduleNow (MakeEvent (f, a1, a2, a3));
1453 }
1454 
1455 template <typename U1, typename U2, typename U3, typename U4,
1456  typename T1, typename T2, typename T3, typename T4>
1457 EventId
1458 Simulator::ScheduleNow (void (*f)(U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4)
1459 {
1460  return DoScheduleNow (MakeEvent (f, a1, a2, a3, a4));
1461 }
1462 
1463 template <typename U1, typename U2, typename U3, typename U4, typename U5,
1464  typename T1, typename T2, typename T3, typename T4, typename T5>
1465 EventId
1466 Simulator::ScheduleNow (void (*f)(U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
1467 {
1468  return DoScheduleNow (MakeEvent (f, a1, a2, a3, a4, a5));
1469 }
1470 
1471 
1472 
1473 template <typename MEM, typename OBJ>
1474 EventId
1475 Simulator::ScheduleDestroy (MEM mem_ptr, OBJ obj)
1476 {
1477  return DoScheduleDestroy (MakeEvent (mem_ptr, obj));
1478 }
1479 
1480 
1481 template <typename MEM, typename OBJ,
1482  typename T1>
1483 EventId
1484 Simulator::ScheduleDestroy (MEM mem_ptr, OBJ obj, T1 a1)
1485 {
1486  return DoScheduleDestroy (MakeEvent (mem_ptr, obj, a1));
1487 }
1488 
1489 template <typename MEM, typename OBJ,
1490  typename T1, typename T2>
1491 EventId
1492 Simulator::ScheduleDestroy (MEM mem_ptr, OBJ obj, T1 a1, T2 a2)
1493 {
1494  return DoScheduleDestroy (MakeEvent (mem_ptr, obj, a1, a2));
1495 }
1496 
1497 template <typename MEM, typename OBJ,
1498  typename T1, typename T2, typename T3>
1499 EventId
1500 Simulator::ScheduleDestroy (MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3)
1501 {
1502  return DoScheduleDestroy (MakeEvent (mem_ptr, obj, a1, a2, a3));
1503 }
1504 
1505 template <typename MEM, typename OBJ,
1506  typename T1, typename T2, typename T3, typename T4>
1507 EventId
1508 Simulator::ScheduleDestroy (MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4)
1509 {
1510  return DoScheduleDestroy (MakeEvent (mem_ptr, obj, a1, a2, a3, a4));
1511 }
1512 
1513 template <typename MEM, typename OBJ,
1514  typename T1, typename T2, typename T3, typename T4, typename T5>
1515 EventId
1516 Simulator::ScheduleDestroy (MEM mem_ptr, OBJ obj,
1517  T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
1518 {
1519  return DoScheduleDestroy (MakeEvent (mem_ptr, obj, a1, a2, a3, a4, a5));
1520 }
1521 
1522 template <typename U1,
1523  typename T1>
1524 EventId
1525 Simulator::ScheduleDestroy (void (*f)(U1), T1 a1)
1526 {
1527  return DoScheduleDestroy (MakeEvent (f, a1));
1528 }
1529 
1530 template <typename U1, typename U2,
1531  typename T1, typename T2>
1532 EventId
1533 Simulator::ScheduleDestroy (void (*f)(U1,U2), T1 a1, T2 a2)
1534 {
1535  return DoScheduleDestroy (MakeEvent (f, a1, a2));
1536 }
1537 
1538 template <typename U1, typename U2, typename U3,
1539  typename T1, typename T2, typename T3>
1540 EventId
1541 Simulator::ScheduleDestroy (void (*f)(U1,U2,U3), T1 a1, T2 a2, T3 a3)
1542 {
1543  return DoScheduleDestroy (MakeEvent (f, a1, a2, a3));
1544 }
1545 
1546 template <typename U1, typename U2, typename U3, typename U4,
1547  typename T1, typename T2, typename T3, typename T4>
1548 EventId
1549 Simulator::ScheduleDestroy (void (*f)(U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4)
1550 {
1551  return DoScheduleDestroy (MakeEvent (f, a1, a2, a3, a4));
1552 }
1553 
1554 template <typename U1, typename U2, typename U3, typename U4, typename U5,
1555  typename T1, typename T2, typename T3, typename T4, typename T5>
1556 EventId
1557 Simulator::ScheduleDestroy (void (*f)(U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
1558 {
1559  return DoScheduleDestroy (MakeEvent (f, a1, a2, a3, a4, a5));
1560 }
1561 
1562 } // namespace ns3
1563 
1564 #endif /* SIMULATOR_H */
static Time GetDelayLeft(const EventId &id)
Get the remaining time until this event will execute.
Definition: simulator.cc:232
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:73
Control the scheduling of simulation events.
Definition: simulator.h:70
ns3::EventImpl declarations.
static void SetImplementation(Ptr< SimulatorImpl > impl)
Definition: simulator.cc:364
static EventId DoScheduleDestroy(EventImpl *event)
Implementation of the various ScheduleDestroy methods.
Definition: simulator.cc:270
static Ptr< SimulatorImpl > GetImplementation(void)
Get the SimulatorImpl singleton.
Definition: simulator.cc:390
static uint32_t GetSystemId(void)
Get the system id of this simulator.
Definition: simulator.cc:349
static uint32_t GetContext(void)
Get the current simulation context.
Definition: simulator.cc:343
ns3::ObjectFactory class declaration.
static void Run(void)
Run the simulation.
Definition: simulator.cc:200
static void Cancel(const EventId &id)
Set the cancel bit on this event: the event's associated function will not be invoked when it expires...
Definition: simulator.cc:311
static EventId Schedule(Time const &delay, MEM mem_ptr, OBJ obj)
Schedule an event to expire after delay.
Definition: simulator.h:1221
ns3::MakeEvent function declarations and template implementation.
Declaration of classes ns3::Time and ns3::TimeWithUnit, and the TimeValue implementation classes...
~Simulator()
Destructor.
static EventId DoSchedule(Time const &delay, EventImpl *event)
Implementation of the various Schedule methods.
Definition: simulator.cc:260
static void Destroy(void)
Execute the events scheduled with ScheduleDestroy().
Definition: simulator.cc:164
double f(double x, void *params)
Definition: 80211b.c:60
static void Remove(const EventId &id)
Remove an event from the event list.
Definition: simulator.cc:301
static bool IsExpired(const EventId &id)
Check if an event has already run or been cancelled.
Definition: simulator.cc:321
Simulator()
Default constructor.
static EventId ScheduleNow(MEM mem_ptr, OBJ obj)
Schedule an event to expire Now.
Definition: simulator.h:1384
static void SetScheduler(ObjectFactory schedulerFactory)
Set the scheduler type with an ObjectFactory.
Definition: simulator.cc:186
static Time Now(void)
Return the current simulation virtual time.
Definition: simulator.cc:223
Instantiate subclasses of ns3::Object.
static void ScheduleWithContext(uint32_t context, Time const &delay, MEM mem_ptr, OBJ obj)
Schedule an event with the given context.
Definition: simulator.h:1302
A simulation event.
Definition: event-impl.h:44
static EventId DoScheduleNow(EventImpl *event)
Implementation of the various ScheduleNow methods.
Definition: simulator.cc:265
An identifier for simulation events.
Definition: event-id.h:53
static void Stop(void)
Tell the Simulator the calling event should be the last one executed.
Definition: simulator.cc:208
static bool IsFinished(void)
Check if the simulation should finish.
Definition: simulator.cc:193
static EventId ScheduleDestroy(MEM mem_ptr, OBJ obj)
Schedule an event to expire when Simulator::Destroy is called.
Definition: simulator.h:1475
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
Definition: simulator.cc:330
ns3::EventId declarations.
static Time GetMaximumSimulationTime(void)
Get the maximum representable simulation time.
Definition: simulator.cc:336
EventImpl * MakeEvent(void(*f)(void))
Make an EventImpl from a function pointer taking varying numbers of arguments.
Definition: make-event.cc:34