View | Details | Raw Unified | Return to bug 2457
Collapse All | Expand All

(-)a/src/core/model/callback.h (-207 / +35 lines)
 Lines 56-95    Link Here 
56
 */
56
 */
57
/**
57
/**
58
 * \ingroup callback
58
 * \ingroup callback
59
 * \defgroup makecallbackmemptr MakeCallback from member function pointer
60
 *
61
 * Build Callbacks for class method members which take varying numbers
62
 * of arguments and potentially returning a value.
63
 *
64
 * Generally the \c MakeCallback functions are invoked with the
65
 * method function address first, followed by the \c this pointer:
66
 * \code
67
 *   MakeCallback ( & MyClass::Handler, this);
68
 * \endcode
69
 *
70
 * There is not a version with bound arguments.  You may be able to
71
 * get the same result by using \c MakeBoundCallback with a \c static
72
 * member function, as in:
73
 * \code
74
 *   MakeBoundCallback ( & MyClass::StaticHandler, this);
75
 * \endcode
76
 * This still leaves two argument slots available for binding.
77
 */
78
/**
79
 * \ingroup callback
80
 * \defgroup makecallbackfnptr MakeCallback from function pointers
81
 *
82
 * Build Callbacks for functions which take varying numbers of arguments
83
 * and potentially returning a value.
84
 */
85
/**
86
 * \ingroup callback
87
 * \defgroup makenullcallback MakeCallback with no arguments
88
 *
89
 * Define empty (Null) callbacks as placeholders for unset callback variables.
90
 */
91
/**
92
 * \ingroup callback
93
 * \defgroup makeboundcallback MakeBoundCallback from functions bound with up to three arguments.
59
 * \defgroup makeboundcallback MakeBoundCallback from functions bound with up to three arguments.
94
 *
60
 *
95
 * Build bound Callbacks which take varying numbers of arguments,
61
 * Build bound Callbacks which take varying numbers of arguments,
 Lines 104-110    Link Here 
104
70
105
  
71
  
106
/**
72
/**
107
 * \ingroup makecallbackmemptr
73
 * \ingroup callbackimpl
108
 *
74
 *
109
 * Trait class to convert a pointer into a reference,
75
 * Trait class to convert a pointer into a reference,
110
 * used by MemPtrCallBackImpl
76
 * used by MemPtrCallBackImpl
 Lines 113-119    Link Here 
113
struct CallbackTraits;
79
struct CallbackTraits;
114
80
115
/**
81
/**
116
 * \ingroup makecallbackmemptr
82
 * \ingroup callbackimpl
117
 *
83
 *
118
 * Trait class to convert a pointer into a reference,
84
 * Trait class to convert a pointer into a reference,
119
 * used by MemPtrCallBackImpl
85
 * used by MemPtrCallBackImpl
 Lines 581-587    Link Here 
581
};
547
};
582
548
583
/**
549
/**
584
 * \ingroup makecallbackmemptr
550
 * \ingroup callbackimpl
585
 * CallbackImpl for pointer to member functions
551
 * CallbackImpl for pointer to member functions
586
 */
552
 */
587
template <typename OBJ_PTR, typename MEM_PTR, typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>
553
template <typename OBJ_PTR, typename MEM_PTR, typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>
 Lines 1474-1677    Link Here 
1474
}
1440
}
1475
1441
1476
/**
1442
/**
1477
 * \ingroup makecallbackmemptr
1478
 * @{
1443
 * @{
1479
 */
1444
 */
1480
/**
1445
/**
1446
 * Build Callbacks for class method members which take varying numbers
1447
 * of arguments and potentially returning a value.
1448
 *
1481
 * \param [in] memPtr Class method member pointer
1449
 * \param [in] memPtr Class method member pointer
1482
 * \param [in] objPtr Class instance
1450
 * \param [in] objPtr Class instance
1483
 * \return A wrapper Callback
1451
 * \return A wrapper Callback
1484
 * 
1452
 * 
1485
 * Build Callbacks for class method members which take varying numbers of arguments
1453
 * This \c MakeCallback is invoked with the
1486
 * and potentially returning a value.
1454
 * method function address first, followed by the \c this pointer:
1487
 */     
1455
 * \code
1488
template <typename T, typename OBJ, typename R>
1456
 *   MakeCallback ( & MyClass::Handler, this);
1489
Callback<R> MakeCallback (R (T::*memPtr)(void), OBJ objPtr) {
1457
 * \endcode
1490
  return Callback<R> (objPtr, memPtr);
1458
 *
1459
 * There is not a version with bound arguments.  You may be able to
1460
 * get the same result by using \c MakeBoundCallback with a \c static
1461
 * member function, as in:
1462
 * \code
1463
 *   MakeBoundCallback ( & MyClass::StaticHandler, this);
1464
 * \endcode
1465
 * This still leaves two argument slots available for binding.
1466
 */
1467
template <typename T, typename OBJ, typename R, typename... Ts>
1468
Callback<R,Ts...> MakeCallback (R (T::*memPtr)(Ts...), OBJ objPtr) {
1469
  return Callback<R,Ts...> (objPtr, memPtr);
1491
}
1470
}
1492
template <typename T, typename OBJ, typename R>
1471
template <typename T, typename OBJ, typename R, typename... Ts>
1493
Callback<R> MakeCallback (R (T::*memPtr)() const, OBJ objPtr) {
1472
Callback<R,Ts...> MakeCallback (R (T::*memPtr)(Ts...) const, OBJ objPtr) {
1494
  return Callback<R> (objPtr, memPtr);
1473
  return Callback<R,Ts...> (objPtr, memPtr);
1495
}
1496
template <typename T, typename OBJ, typename R, typename T1>
1497
Callback<R,T1> MakeCallback (R (T::*memPtr)(T1), OBJ objPtr) {
1498
  return Callback<R,T1> (objPtr, memPtr);
1499
}
1500
template <typename T, typename OBJ, typename R, typename T1>
1501
Callback<R,T1> MakeCallback (R (T::*memPtr)(T1) const, OBJ objPtr) {
1502
  return Callback<R,T1> (objPtr, memPtr);
1503
}
1504
template <typename T, typename OBJ, typename R, typename T1, typename T2>
1505
Callback<R,T1,T2> MakeCallback (R (T::*memPtr)(T1,T2), OBJ objPtr) {
1506
  return Callback<R,T1,T2> (objPtr, memPtr);
1507
}
1508
template <typename T, typename OBJ, typename R, typename T1, typename T2>
1509
Callback<R,T1,T2> MakeCallback (R (T::*memPtr)(T1,T2) const, OBJ objPtr) {
1510
  return Callback<R,T1,T2> (objPtr, memPtr);
1511
}
1512
template <typename T, typename OBJ, typename R, typename T1,typename T2, typename T3>
1513
Callback<R,T1,T2,T3> MakeCallback (R (T::*memPtr)(T1,T2,T3), OBJ objPtr) {
1514
  return Callback<R,T1,T2,T3> (objPtr, memPtr);
1515
}
1516
template <typename T, typename OBJ, typename R, typename T1,typename T2, typename T3>
1517
Callback<R,T1,T2,T3> MakeCallback (R (T::*memPtr)(T1,T2,T3) const, OBJ objPtr) {
1518
  return Callback<R,T1,T2,T3> (objPtr, memPtr);
1519
}
1520
template <typename T, typename OBJ, typename R, typename T1, typename T2, typename T3, typename T4>
1521
Callback<R,T1,T2,T3,T4> MakeCallback (R (T::*memPtr)(T1,T2,T3,T4), OBJ objPtr) {
1522
  return Callback<R,T1,T2,T3,T4> (objPtr, memPtr);
1523
}
1524
template <typename T, typename OBJ, typename R, typename T1, typename T2, typename T3, typename T4>
1525
Callback<R,T1,T2,T3,T4> MakeCallback (R (T::*memPtr)(T1,T2,T3,T4) const, OBJ objPtr) {
1526
  return Callback<R,T1,T2,T3,T4> (objPtr, memPtr);
1527
}
1528
template <typename T, typename OBJ, typename R, typename T1, typename T2, typename T3, typename T4,typename T5>
1529
Callback<R,T1,T2,T3,T4,T5> MakeCallback (R (T::*memPtr)(T1,T2,T3,T4,T5), OBJ objPtr) {
1530
  return Callback<R,T1,T2,T3,T4,T5> (objPtr, memPtr);
1531
}
1532
template <typename T, typename OBJ, typename R, typename T1, typename T2, typename T3, typename T4,typename T5>
1533
Callback<R,T1,T2,T3,T4,T5> MakeCallback (R (T::*memPtr)(T1,T2,T3,T4,T5) const, OBJ objPtr) {
1534
  return Callback<R,T1,T2,T3,T4,T5> (objPtr, memPtr);
1535
}
1536
template <typename T, typename OBJ, typename R, typename T1, typename T2, typename T3, typename T4,typename T5,typename T6>
1537
Callback<R,T1,T2,T3,T4,T5,T6> MakeCallback (R (T::*memPtr)(T1,T2,T3,T4,T5,T6), OBJ objPtr) {
1538
  return Callback<R,T1,T2,T3,T4,T5,T6> (objPtr, memPtr);
1539
}
1540
template <typename T, typename OBJ, typename R, typename T1, typename T2, typename T3, typename T4,typename T5, typename T6>
1541
Callback<R,T1,T2,T3,T4,T5,T6> MakeCallback (R (T::*memPtr)(T1,T2,T3,T4,T5,T6) const, OBJ objPtr) {
1542
  return Callback<R,T1,T2,T3,T4,T5,T6> (objPtr, memPtr);
1543
}
1544
template <typename T, typename OBJ, typename R, typename T1, typename T2, typename T3, typename T4,typename T5,typename T6, typename T7>
1545
Callback<R,T1,T2,T3,T4,T5,T6,T7> MakeCallback (R (T::*memPtr)(T1,T2,T3,T4,T5,T6,T7), OBJ objPtr) {
1546
  return Callback<R,T1,T2,T3,T4,T5,T6,T7> (objPtr, memPtr);
1547
}
1548
template <typename T, typename OBJ, typename R, typename T1, typename T2, typename T3, typename T4,typename T5, typename T6, typename T7>
1549
Callback<R,T1,T2,T3,T4,T5,T6,T7> MakeCallback (R (T::*memPtr)(T1,T2,T3,T4,T5,T6,T7) const, OBJ objPtr) {
1550
  return Callback<R,T1,T2,T3,T4,T5,T6,T7> (objPtr, memPtr);
1551
}
1552
template <typename T, typename OBJ, typename R, typename T1, typename T2, typename T3, typename T4,typename T5,typename T6, typename T7, typename T8>
1553
Callback<R,T1,T2,T3,T4,T5,T6,T7,T8> MakeCallback (R (T::*memPtr)(T1,T2,T3,T4,T5,T6,T7,T8), OBJ objPtr) {
1554
  return Callback<R,T1,T2,T3,T4,T5,T6,T7,T8> (objPtr, memPtr);
1555
}
1556
template <typename T, typename OBJ, typename R, typename T1, typename T2, typename T3, typename T4,typename T5, typename T6, typename T7, typename T8>
1557
Callback<R,T1,T2,T3,T4,T5,T6,T7,T8> MakeCallback (R (T::*memPtr)(T1,T2,T3,T4,T5,T6,T7,T8) const, OBJ objPtr) {
1558
  return Callback<R,T1,T2,T3,T4,T5,T6,T7,T8> (objPtr, memPtr);
1559
}
1560
template <typename T, typename OBJ, typename R, typename T1, typename T2, typename T3, typename T4,typename T5,typename T6, typename T7, typename T8, typename T9>
1561
Callback<R,T1,T2,T3,T4,T5,T6,T7,T8,T9> MakeCallback (R (T::*memPtr)(T1,T2,T3,T4,T5,T6,T7,T8,T9), OBJ objPtr) {
1562
  return Callback<R,T1,T2,T3,T4,T5,T6,T7,T8,T9> (objPtr, memPtr);
1563
}
1564
template <typename T, typename OBJ, typename R, typename T1, typename T2, typename T3, typename T4,typename T5, typename T6, typename T7, typename T8, typename T9>
1565
Callback<R,T1,T2,T3,T4,T5,T6,T7,T8,T9> MakeCallback (R (T::*memPtr)(T1,T2,T3,T4,T5,T6,T7,T8,T9) const, OBJ objPtr) {
1566
  return Callback<R,T1,T2,T3,T4,T5,T6,T7,T8,T9> (objPtr, memPtr);
1567
}
1474
}
1568
/**@}*/
1475
/**@}*/
1569
1476
1570
/**
1477
/**
1571
 * \ingroup makecallbackfnptr
1478
 * \ingroup makecallbackfnptr
1572
 * @{
1573
 */
1574
/**
1575
 * \param [in] fnPtr Function pointer
1479
 * \param [in] fnPtr Function pointer
1576
 * \return A wrapper Callback
1480
 * \return A wrapper Callback
1577
 * 
1481
 * 
1578
 * Build Callbacks for functions which take varying numbers of arguments
1482
 * Build Callbacks for functions which take varying numbers of arguments
1579
 * and potentially returning a value.
1483
 * and potentially returning a value.
1580
 */
1484
 */
1581
template <typename R>
1485
template <typename R, typename... Ts>
1582
Callback<R> MakeCallback (R (*fnPtr)()) {
1486
Callback<R,Ts...> MakeCallback (R (*fnPtr)(Ts...)) {
1583
  return Callback<R> (fnPtr, true, true);
1487
  return Callback<R,Ts...> (fnPtr, true, true);
1584
}
1488
}
1585
template <typename R, typename T1>
1489
1586
Callback<R,T1> MakeCallback (R (*fnPtr)(T1)) {
1587
  return Callback<R,T1> (fnPtr, true, true);
1588
}
1589
template <typename R, typename T1, typename T2>
1590
Callback<R,T1,T2> MakeCallback (R (*fnPtr)(T1,T2)) {
1591
  return Callback<R,T1,T2> (fnPtr, true, true);
1592
}
1593
template <typename R, typename T1, typename T2,typename T3>
1594
Callback<R,T1,T2,T3> MakeCallback (R (*fnPtr)(T1,T2,T3)) {
1595
  return Callback<R,T1,T2,T3> (fnPtr, true, true);
1596
}
1597
template <typename R, typename T1, typename T2,typename T3,typename T4>
1598
Callback<R,T1,T2,T3,T4> MakeCallback (R (*fnPtr)(T1,T2,T3,T4)) {
1599
  return Callback<R,T1,T2,T3,T4> (fnPtr, true, true);
1600
}
1601
template <typename R, typename T1, typename T2,typename T3,typename T4,typename T5>
1602
Callback<R,T1,T2,T3,T4,T5> MakeCallback (R (*fnPtr)(T1,T2,T3,T4,T5)) {
1603
  return Callback<R,T1,T2,T3,T4,T5> (fnPtr, true, true);
1604
}
1605
template <typename R, typename T1, typename T2,typename T3,typename T4,typename T5,typename T6>
1606
Callback<R,T1,T2,T3,T4,T5,T6> MakeCallback (R (*fnPtr)(T1,T2,T3,T4,T5,T6)) {
1607
  return Callback<R,T1,T2,T3,T4,T5,T6> (fnPtr, true, true);
1608
}
1609
template <typename R, typename T1, typename T2,typename T3,typename T4,typename T5,typename T6, typename T7>
1610
Callback<R,T1,T2,T3,T4,T5,T6,T7> MakeCallback (R (*fnPtr)(T1,T2,T3,T4,T5,T6,T7)) {
1611
  return Callback<R,T1,T2,T3,T4,T5,T6,T7> (fnPtr, true, true);
1612
}
1613
template <typename R, typename T1, typename T2,typename T3,typename T4,typename T5,typename T6, typename T7, typename T8>
1614
Callback<R,T1,T2,T3,T4,T5,T6,T7,T8> MakeCallback (R (*fnPtr)(T1,T2,T3,T4,T5,T6,T7,T8)) {
1615
  return Callback<R,T1,T2,T3,T4,T5,T6,T7,T8> (fnPtr, true, true);
1616
}
1617
template <typename R, typename T1, typename T2,typename T3,typename T4,typename T5,typename T6, typename T7, typename T8, typename T9>
1618
Callback<R,T1,T2,T3,T4,T5,T6,T7,T8,T9> MakeCallback (R (*fnPtr)(T1,T2,T3,T4,T5,T6,T7,T8,T9)) {
1619
  return Callback<R,T1,T2,T3,T4,T5,T6,T7,T8,T9> (fnPtr, true, true);
1620
}
1621
/**@}*/
1622
1490
1623
/**
1491
/**
1624
 * \ingroup makenullcallback
1492
 * \ingroup callback
1625
 * @{
1626
 */
1627
/**
1628
 * \return A wrapper Callback
1493
 * \return A wrapper Callback
1629
 *
1494
 *
1630
 * Build null Callbacks which take no arguments,
1495
 * Build null Callbacks which take no arguments,
1631
 * for varying number of template arguments,
1496
 * for varying number of template arguments,
1632
 * and potentially returning a value.
1497
 * and potentially returning a value.
1633
 */     
1498
 */
1634
template <typename R>
1499
template <typename R, typename... Ts>
1635
Callback<R> MakeNullCallback (void) {
1500
Callback<R,Ts...> MakeNullCallback (void) {
1636
  return Callback<R> ();
1501
  return Callback<R,Ts...> ();
1637
}
1502
}
1638
template <typename R, typename T1>
1639
Callback<R,T1> MakeNullCallback (void) {
1640
  return Callback<R,T1> ();
1641
}
1642
template <typename R, typename T1, typename T2>
1643
Callback<R,T1,T2> MakeNullCallback (void) {
1644
  return Callback<R,T1,T2> ();
1645
}
1646
template <typename R, typename T1, typename T2,typename T3>
1647
Callback<R,T1,T2,T3> MakeNullCallback (void) {
1648
  return Callback<R,T1,T2,T3> ();
1649
}
1650
template <typename R, typename T1, typename T2,typename T3,typename T4>
1651
Callback<R,T1,T2,T3,T4> MakeNullCallback (void) {
1652
  return Callback<R,T1,T2,T3,T4> ();
1653
}
1654
template <typename R, typename T1, typename T2,typename T3,typename T4,typename T5>
1655
Callback<R,T1,T2,T3,T4,T5> MakeNullCallback (void) {
1656
  return Callback<R,T1,T2,T3,T4,T5> ();
1657
}
1658
template <typename R, typename T1, typename T2,typename T3,typename T4,typename T5,typename T6>
1659
Callback<R,T1,T2,T3,T4,T5,T6> MakeNullCallback (void) {
1660
  return Callback<R,T1,T2,T3,T4,T5,T6> ();
1661
}
1662
template <typename R, typename T1, typename T2,typename T3,typename T4,typename T5,typename T6, typename T7>
1663
Callback<R,T1,T2,T3,T4,T5,T6,T7> MakeNullCallback (void) {
1664
  return Callback<R,T1,T2,T3,T4,T5,T6,T7> ();
1665
}
1666
template <typename R, typename T1, typename T2,typename T3,typename T4,typename T5,typename T6, typename T7, typename T8>
1667
Callback<R,T1,T2,T3,T4,T5,T6,T7,T8> MakeNullCallback (void) {
1668
  return Callback<R,T1,T2,T3,T4,T5,T6,T7,T8> ();
1669
}
1670
template <typename R, typename T1, typename T2,typename T3,typename T4,typename T5,typename T6, typename T7, typename T8, typename T9>
1671
Callback<R,T1,T2,T3,T4,T5,T6,T7,T8,T9> MakeNullCallback (void) {
1672
  return Callback<R,T1,T2,T3,T4,T5,T6,T7,T8,T9> ();
1673
}
1674
/**@}*/
1675
1503
1676
1504
1677
/**
1505
/**
(-)a/src/core/model/make-event.h (-758 / +19 lines)
 Lines 20-805    Link Here 
20
#ifndef MAKE_EVENT_H
20
#ifndef MAKE_EVENT_H
21
#define MAKE_EVENT_H
21
#define MAKE_EVENT_H
22
22
23
#include "event-impl.h"
24
#include <functional>
25
23
/**
26
/**
24
 * \file
27
 * \file
25
 * \ingroup events
28
 * \ingroup events
26
 * ns3::MakeEvent function declarations and template implementation.
29
 * ns3::MakeEvent function template.
27
 */
30
 */
28
31
29
namespace ns3 {
32
namespace ns3 {
30
33
31
class EventImpl;
32
33
/**
34
/**
34
 * \ingroup events
35
 * \ingroup events
35
 * \defgroup makeeventmemptr MakeEvent from Member Function Pointer.
36
 * Create EventImpl instance from a callable object.
36
 *
37
 *
37
 * Create EventImpl instances from class member functions which take
38
 * \tparam Ts \deduced Argument types.
38
 * varying numbers of arguments.
39
 * \param [in] args Callable object and bound arguments, forwarded to std::bind.
39
 */
40
/**
41
 * \ingroup makeeventmemptr
42
 * @{
43
 */
44
/**
45
 * Make an EventImpl from class method members which take
46
 * varying numbers of arguments.
47
 *
48
 * \tparam MEM \deduced The class method function signature.
49
 * \tparam OBJ \deduced The class type holding the method.
50
 * \param [in] mem_ptr Class method member function pointer
51
 * \param [in] obj Class instance.
52
 * \returns The constructed EventImpl.
40
 * \returns The constructed EventImpl.
53
 */
41
 */
54
template <typename MEM, typename OBJ>
42
template <typename... Ts>
55
EventImpl * MakeEvent (MEM mem_ptr, OBJ obj);
43
EventImpl * MakeEvent (Ts&&... args)
56
57
/**
58
 * \copybrief MakeEvent(MEM,OBJ)
59
 * \tparam MEM \deduced The class method function signature.
60
 * \tparam OBJ \deduced The class type holding the method.
61
 * \tparam T1 \deduced Type of the argument to the underlying function.
62
 * \param [in] mem_ptr Class method member function pointer
63
 * \param [in] obj Class instance.
64
 * \param [in] a1 Argument value to be bound to the underlying function.
65
 * \returns The constructed EventImpl.
66
 */
67
template <typename MEM, typename OBJ,
68
          typename T1>
69
EventImpl * MakeEvent (MEM mem_ptr, OBJ obj, T1 a1);
70
71
/**
72
 * \copybrief MakeEvent(MEM,OBJ)
73
 * \tparam MEM \deduced The class method function signature.
74
 * \tparam OBJ \deduced The class type holding the method.
75
 * \tparam T1 \deduced Type of the first argument to the underlying function.
76
 * \tparam T2 \deduced Type of the second argument to the underlying function.
77
 * \param [in] mem_ptr Class method member function pointer
78
 * \param [in] obj Class instance.
79
 * \param [in] a1 First argument value to be bound to the underlying function.
80
 * \param [in] a2 Second argument value to be bound to the underlying function.
81
 * \returns The constructed EventImpl.
82
 */
83
template <typename MEM, typename OBJ,
84
          typename T1, typename T2>
85
EventImpl * MakeEvent (MEM mem_ptr, OBJ obj, T1 a1, T2 a2);
86
87
/**
88
 * \copybrief MakeEvent(MEM,OBJ)
89
 * \tparam MEM \deduced The class method function signature.
90
 * \tparam OBJ \deduced The class type holding the method.
91
 * \tparam T1 \deduced Type of the first argument to the underlying function.
92
 * \tparam T2 \deduced Type of the second argument to the underlying function.
93
 * \tparam T3 \deduced Type of the third argument to the underlying function.
94
 * \param [in] mem_ptr Class method member function pointer
95
 * \param [in] obj Class instance.
96
 * \param [in] a1 First argument value to be bound to the underlying function.
97
 * \param [in] a2 Second argument value to be bound to the underlying function.
98
 * \param [in] a3 Third argument value to be bound to the underlying function.
99
 * \returns The constructed EventImpl.
100
 */
101
template <typename MEM, typename OBJ,
102
          typename T1, typename T2, typename T3>
103
EventImpl * MakeEvent (MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3);
104
105
/**
106
 * \copybrief MakeEvent(MEM,OBJ)
107
 * \tparam MEM \deduced The class method function signature.
108
 * \tparam OBJ \deduced The class type holding the method.
109
 * \tparam T1 \deduced Type of the first argument to the underlying function.
110
 * \tparam T2 \deduced Type of the second argument to the underlying function.
111
 * \tparam T3 \deduced Type of the third argument to the underlying function.
112
 * \tparam T4 \deduced Type of the fourth argument to the underlying function.
113
 * \param [in] mem_ptr Class method member function pointer
114
 * \param [in] obj Class instance.
115
 * \param [in] a1 First argument value to be bound to the underlying function.
116
 * \param [in] a2 Second argument value to be bound to the underlying function.
117
 * \param [in] a3 Third argument value to be bound to the underlying function.
118
 * \param [in] a4 Fourth argument value to be bound to the underlying function.
119
 * \returns The constructed EventImpl.
120
 */
121
template <typename MEM, typename OBJ,
122
          typename T1, typename T2, typename T3, typename T4>
123
EventImpl * MakeEvent (MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4);
124
125
/**
126
 * \copybrief MakeEvent(MEM,OBJ)
127
 * \tparam MEM \deduced The class method function signature.
128
 * \tparam OBJ \deduced The class type holding the method.
129
 * \tparam T1 \deduced Type of the first argument to the underlying function.
130
 * \tparam T2 \deduced Type of the second argument to the underlying function.
131
 * \tparam T3 \deduced Type of the third argument to the underlying function.
132
 * \tparam T4 \deduced Type of the fourth argument to the underlying function.
133
 * \tparam T5 \deduced Type of the fifth argument to the underlying function.
134
 * \param [in] mem_ptr Class method member function pointer
135
 * \param [in] obj Class instance.
136
 * \param [in] a1 First argument value to be bound to the underlying function.
137
 * \param [in] a2 Second argument value to be bound to the underlying function.
138
 * \param [in] a3 Third argument value to be bound to the underlying function.
139
 * \param [in] a4 Fourth argument value to be bound to the underlying function.
140
 * \param [in] a5 Fifh argument value to be bound to the underlying function.
141
 * \returns The constructed EventImpl.
142
 */
143
template <typename MEM, typename OBJ,
144
          typename T1, typename T2, typename T3, typename T4, typename T5>
145
EventImpl * MakeEvent (MEM mem_ptr, OBJ obj,
146
                       T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
147
148
/**
149
 * \copybrief MakeEvent(MEM,OBJ)
150
 * \tparam MEM The class method function signature.
151
 * \tparam OBJ The class type holding the method.
152
 * \tparam T1 Type of the first argument to the underlying function.
153
 * \tparam T2 Type of the second argument to the underlying function.
154
 * \tparam T3 Type of the third argument to the underlying function.
155
 * \tparam T4 Type of the fourth argument to the underlying function.
156
 * \tparam T5 Type of the fifth argument to the underlying function.
157
 * \tparam T6 Type of the sixth argument to the underlying function.
158
 * \param mem_ptr Class method member function pointer
159
 * \param obj Class instance.
160
 * \param a1 First argument value to be bound to the underlying function.
161
 * \param a2 Second argument value to be bound to the underlying function.
162
 * \param a3 Third argument value to be bound to the underlying function.
163
 * \param a4 Fourth argument value to be bound to the underlying function.
164
 * \param a5 Fifth argument value to be bound to the underlying function.
165
 * \param a6 Sixth argument value to be bound to the underlying function.
166
 * \returns The constructed EventImpl.
167
 */
168
template <typename MEM, typename OBJ,
169
          typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
170
EventImpl * MakeEvent (MEM mem_ptr, OBJ obj,
171
                       T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6);
172
173
/**@}*/
174
  
175
/**
176
 * \ingroup events
177
 * \defgroup makeeventfnptr MakeEvent from Function Pointers.
178
 *
179
 * Create EventImpl instances from function pointers which take
180
 * varying numbers of arguments.
181
 *
182
 * @{
183
 */
184
/**
185
 * Make an EventImpl from a function pointer taking varying numbers
186
 * of arguments.
187
 *
188
 * \param [in] f The function pointer.
189
 * \returns The constructed EventImpl.
190
 */
191
EventImpl * MakeEvent (void (*f)(void));
192
193
/**
194
 * \copybrief MakeEvent(void(*f)(void))
195
 * \tparam U1 \deduced Formal type of the argument to the function.
196
 * \tparam T1 \deduced Actual type of the argument to the function.
197
 * \param [in] f The function pointer.
198
 * \param [in] a1 Argument to be bound to the function.
199
 * \returns The constructed EventImpl.
200
 */
201
template <typename U1,
202
          typename T1>
203
EventImpl * MakeEvent (void (*f)(U1), T1 a1);
204
205
/**
206
 * \copybrief MakeEvent(void(*f)(void))
207
 * \tparam U1 \deduced Formal type of the first argument to the function.
208
 * \tparam U2 \deduced Formal type of the second argument to the function.
209
 * \tparam T1 \deduced Actual type of the first argument to the function.
210
 * \tparam T2 \deduced Actual type of the second argument to the function.
211
 * \param [in] f The function pointer.
212
 * \param [in] a1 First argument to be bound to the function.
213
 * \param [in] a2 Second argument to be bound to the function.
214
 * \returns The constructed EventImpl.
215
 */
216
template <typename U1, typename U2,
217
          typename T1, typename T2>
218
EventImpl * MakeEvent (void (*f)(U1,U2), T1 a1, T2 a2);
219
220
/**
221
 * \copybrief MakeEvent(void(*f)(void))
222
 * \tparam U1 \deduced Formal type of the first argument to the function.
223
 * \tparam U2 \deduced Formal type of the second argument to the function.
224
 * \tparam U3 \deduced Formal type of the third argument to the function.
225
 * \tparam T1 \deduced Actual type of the first argument to the function.
226
 * \tparam T2 \deduced Actual type of the second argument to the function.
227
 * \tparam T3 \deduced Actual type of the third argument to the function.
228
 * \param [in] f The function pointer.
229
 * \param [in] a1 First argument to be bound to the function.
230
 * \param [in] a2 Second argument to be bound to the function.
231
 * \param [in] a3 Third argument to be bound to the function.
232
 * \returns The constructed EventImpl.
233
 */
234
template <typename U1, typename U2, typename U3,
235
          typename T1, typename T2, typename T3>
236
EventImpl * MakeEvent (void (*f)(U1,U2,U3), T1 a1, T2 a2, T3 a3);
237
238
/**
239
 * \copybrief MakeEvent(void(*f)(void))
240
 * \tparam U1 \deduced Formal type of the first argument to the function.
241
 * \tparam U2 \deduced Formal type of the second argument to the function.
242
 * \tparam U3 \deduced Formal type of the third argument to the function.
243
 * \tparam U4 \deduced Formal type of the fourth argument to the function.
244
 * \tparam T1 \deduced Actual type of the first argument to the function.
245
 * \tparam T2 \deduced Actual type of the second argument to the function.
246
 * \tparam T3 \deduced Actual type of the third argument to the function.
247
 * \tparam T4 \deduced Actual type of the fourth argument to the function.
248
 * \param [in] f The function pointer.
249
 * \param [in] a1 First argument to be bound to the function.
250
 * \param [in] a2 Second argument to be bound to the function.
251
 * \param [in] a3 Third argument to be bound to the function.
252
 * \param [in] a4 Fourth argument to be bound to the function.
253
 * \returns The constructed EventImpl.
254
 */
255
template <typename U1, typename U2, typename U3, typename U4,
256
          typename T1, typename T2, typename T3, typename T4>
257
EventImpl * MakeEvent (void (*f)(U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4);
258
259
/**
260
 * \copybrief MakeEvent(void(*f)(void))
261
 * \tparam U1 \deduced Formal type of the first argument to the function.
262
 * \tparam U2 \deduced Formal type of the second argument to the function.
263
 * \tparam U3 \deduced Formal type of the third argument to the function.
264
 * \tparam U4 \deduced Formal type of the fourth argument to the function.
265
 * \tparam U5 \deduced Formal type of the fifth argument to the function.
266
 * \tparam T1 \deduced Actual type of the first argument to the function.
267
 * \tparam T2 \deduced Actual type of the second argument to the function.
268
 * \tparam T3 \deduced Actual type of the third argument to the function.
269
 * \tparam T4 \deduced Actual type of the fourth argument to the function.
270
 * \tparam T5 \deduced Actual type of the fifth argument to the function.
271
 * \param [in] f The function pointer.
272
 * \param [in] a1 First argument to be bound to the function.
273
 * \param [in] a2 Second argument to be bound to the function.
274
 * \param [in] a3 Third argument to be bound to the function.
275
 * \param [in] a4 Fourth argument to be bound to the function.
276
 * \param [in] a5 Fifth argument to be bound to the function.
277
 * \returns The constructed EventImpl.
278
 */
279
template <typename U1, typename U2, typename U3, typename U4, typename U5,
280
          typename T1, typename T2, typename T3, typename T4, typename T5>
281
EventImpl * MakeEvent (void (*f)(U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
282
283
/**
284
 * \copybrief MakeEvent(void(*f)(void))
285
 * \tparam U1 Formal type of the first argument to the function.
286
 * \tparam U2 Formal type of the second argument to the function.
287
 * \tparam U3 Formal type of the third argument to the function.
288
 * \tparam U4 Formal type of the fourth argument to the function.
289
 * \tparam U5 Formal type of the fifth argument to the function.
290
 * \tparam U6 Formal type of the sixth argument to the function.
291
 * \tparam T1 Actual type of the first argument to the function.
292
 * \tparam T2 Actual type of the second argument to the function.
293
 * \tparam T3 Actual type of the third argument to the function.
294
 * \tparam T4 Actual type of the fourth argument to the function.
295
 * \tparam T5 Actual type of the fifth argument to the function.
296
 * \tparam T6 Actual type of the sixth argument to the function.
297
 * \param f The function pointer.
298
 * \param a1 First argument to be bound to the function.
299
 * \param a2 Second argument to be bound to the function.
300
 * \param a3 Third argument to be bound to the function.
301
 * \param a4 Fourth argument to be bound to the function.
302
 * \param a5 Fifth argument to be bound to the function.
303
 * \param a6 Sixth argument to be bound to the function.
304
 * \returns The constructed EventImpl.
305
 */
306
template <typename U1, typename U2, typename U3, typename U4, typename U5, typename U6,
307
          typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
308
EventImpl * MakeEvent (void (*f)(U1,U2,U3,U4,U5,U6), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6);
309
/**@}*/
310
311
} // namespace ns3
312
313
/********************************************************************
314
 *  Implementation of the templates declared above.
315
 ********************************************************************/
316
317
#include "event-impl.h"
318
#include "type-traits.h"
319
320
namespace ns3 {
321
322
/**
323
 * \ingroup makeeventmemptr
324
 * Helper for the MakeEvent functions which take a class method.
325
 *
326
 * This helper converts a pointer to a reference.
327
 *
328
 * This is the generic template declaration (with empty body).
329
 *
330
 * \tparam T \explicit The class type.
331
 */
332
template <typename T>
333
struct EventMemberImplObjTraits;
334
335
/**
336
 * \ingroup makeeventmemptr
337
 * Helper for the MakeEvent functions which take a class method.
338
 *
339
 * This helper converts a pointer to a reference.
340
 *
341
 * This is the specialization for pointer types.
342
 *
343
 * \tparam T \explicit The class type.
344
 */
345
template <typename T>
346
struct EventMemberImplObjTraits<T *>
347
{
44
{
348
  /**
45
  class EventMemberImpl : public EventImpl
349
   * \param [in] p Object pointer.
350
   * \return A reference to the object pointed to by p.
351
   */
352
  static T &GetReference (T *p)
353
  {
354
    return *p;
355
  }
356
};
357
358
template <typename MEM, typename OBJ>
359
EventImpl * MakeEvent (MEM mem_ptr, OBJ obj)
360
{
361
  // zero argument version
362
  class EventMemberImpl0 : public EventImpl
363
  {
46
  {
364
public:
47
public:
365
    EventMemberImpl0 (OBJ obj, MEM function)
48
    EventMemberImpl (Ts&&... args)
366
      : m_obj (obj),
49
      : m_function (std::bind (std::forward<Ts> (args)...))
367
        m_function (function)
368
    {
50
    {
369
    }
51
    }
370
    virtual ~EventMemberImpl0 ()
52
protected:
53
    virtual ~EventMemberImpl ()
371
    {
54
    {
372
    }
55
    }
373
private:
56
private:
374
    virtual void Notify (void)
57
    virtual void Notify ()
375
    {
58
    {
376
      (EventMemberImplObjTraits<OBJ>::GetReference (m_obj).*m_function)();
59
      m_function ();
377
    }
60
    }
378
    OBJ m_obj;
61
    std::function<void ()> m_function;
379
    MEM m_function;
62
  };
380
  } *ev = new EventMemberImpl0 (obj, mem_ptr);
63
  return new EventMemberImpl (std::forward<Ts> (args)...);
381
  return ev;
382
}
383
384
385
template <typename MEM, typename OBJ,
386
          typename T1>
387
EventImpl * MakeEvent (MEM mem_ptr, OBJ obj, T1 a1)
388
{
389
  // one argument version
390
  class EventMemberImpl1 : public EventImpl
391
  {
392
public:
393
    EventMemberImpl1 (OBJ obj, MEM function, T1 a1)
394
      : m_obj (obj),
395
        m_function (function),
396
        m_a1 (a1)
397
    {
398
    }
399
protected:
400
    virtual ~EventMemberImpl1 ()
401
    {
402
    }
403
private:
404
    virtual void Notify (void)
405
    {
406
      (EventMemberImplObjTraits<OBJ>::GetReference (m_obj).*m_function)(m_a1);
407
    }
408
    OBJ m_obj;
409
    MEM m_function;
410
    typename TypeTraits<T1>::ReferencedType m_a1;
411
  } *ev = new EventMemberImpl1 (obj, mem_ptr, a1);
412
  return ev;
413
}
414
415
template <typename MEM, typename OBJ,
416
          typename T1, typename T2>
417
EventImpl * MakeEvent (MEM mem_ptr, OBJ obj, T1 a1, T2 a2)
418
{
419
  // two argument version
420
  class EventMemberImpl2 : public EventImpl
421
  {
422
public:
423
    EventMemberImpl2 (OBJ obj, MEM function, T1 a1, T2 a2)
424
      : m_obj (obj),
425
        m_function (function),
426
        m_a1 (a1),
427
        m_a2 (a2)
428
    {
429
    }
430
protected:
431
    virtual ~EventMemberImpl2 ()
432
    {
433
    }
434
private:
435
    virtual void Notify (void)
436
    {
437
      (EventMemberImplObjTraits<OBJ>::GetReference (m_obj).*m_function)(m_a1, m_a2);
438
    }
439
    OBJ m_obj;
440
    MEM m_function;
441
    typename TypeTraits<T1>::ReferencedType m_a1;
442
    typename TypeTraits<T2>::ReferencedType m_a2;
443
  } *ev = new EventMemberImpl2 (obj, mem_ptr, a1, a2);
444
  return ev;
445
}
446
447
template <typename MEM, typename OBJ,
448
          typename T1, typename T2, typename T3>
449
EventImpl * MakeEvent (MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3)
450
{
451
  // three argument version
452
  class EventMemberImpl3 : public EventImpl
453
  {
454
public:
455
    EventMemberImpl3 (OBJ obj, MEM function, T1 a1, T2 a2, T3 a3)
456
      : m_obj (obj),
457
        m_function (function),
458
        m_a1 (a1),
459
        m_a2 (a2),
460
        m_a3 (a3)
461
    {
462
    }
463
protected:
464
    virtual ~EventMemberImpl3 ()
465
    {
466
    }
467
private:
468
    virtual void Notify (void)
469
    {
470
      (EventMemberImplObjTraits<OBJ>::GetReference (m_obj).*m_function)(m_a1, m_a2, m_a3);
471
    }
472
    OBJ m_obj;
473
    MEM m_function;
474
    typename TypeTraits<T1>::ReferencedType m_a1;
475
    typename TypeTraits<T2>::ReferencedType m_a2;
476
    typename TypeTraits<T3>::ReferencedType m_a3;
477
  } *ev = new EventMemberImpl3 (obj, mem_ptr, a1, a2, a3);
478
  return ev;
479
}
480
481
template <typename MEM, typename OBJ,
482
          typename T1, typename T2, typename T3, typename T4>
483
EventImpl * MakeEvent (MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4)
484
{
485
  // four argument version
486
  class EventMemberImpl4 : public EventImpl
487
  {
488
public:
489
    EventMemberImpl4 (OBJ obj, MEM function, T1 a1, T2 a2, T3 a3, T4 a4)
490
      : m_obj (obj),
491
        m_function (function),
492
        m_a1 (a1),
493
        m_a2 (a2),
494
        m_a3 (a3),
495
        m_a4 (a4)
496
    {
497
    }
498
protected:
499
    virtual ~EventMemberImpl4 ()
500
    {
501
    }
502
private:
503
    virtual void Notify (void)
504
    {
505
      (EventMemberImplObjTraits<OBJ>::GetReference (m_obj).*m_function)(m_a1, m_a2, m_a3, m_a4);
506
    }
507
    OBJ m_obj;
508
    MEM m_function;
509
    typename TypeTraits<T1>::ReferencedType m_a1;
510
    typename TypeTraits<T2>::ReferencedType m_a2;
511
    typename TypeTraits<T3>::ReferencedType m_a3;
512
    typename TypeTraits<T4>::ReferencedType m_a4;
513
  } *ev = new EventMemberImpl4 (obj, mem_ptr, a1, a2, a3, a4);
514
  return ev;
515
}
516
517
template <typename MEM, typename OBJ,
518
          typename T1, typename T2, typename T3, typename T4, typename T5>
519
EventImpl * MakeEvent (MEM mem_ptr, OBJ obj,
520
                       T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
521
{
522
  // five argument version
523
  class EventMemberImpl5 : public EventImpl
524
  {
525
public:
526
    EventMemberImpl5 (OBJ obj, MEM function, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
527
      : m_obj (obj),
528
        m_function (function),
529
        m_a1 (a1),
530
        m_a2 (a2),
531
        m_a3 (a3),
532
        m_a4 (a4),
533
        m_a5 (a5)
534
    {
535
    }
536
protected:
537
    virtual ~EventMemberImpl5 ()
538
    {
539
    }
540
private:
541
    virtual void Notify (void)
542
    {
543
      (EventMemberImplObjTraits<OBJ>::GetReference (m_obj).*m_function)(m_a1, m_a2, m_a3, m_a4, m_a5);
544
    }
545
    OBJ m_obj;
546
    MEM m_function;
547
    typename TypeTraits<T1>::ReferencedType m_a1;
548
    typename TypeTraits<T2>::ReferencedType m_a2;
549
    typename TypeTraits<T3>::ReferencedType m_a3;
550
    typename TypeTraits<T4>::ReferencedType m_a4;
551
    typename TypeTraits<T5>::ReferencedType m_a5;
552
  } *ev = new EventMemberImpl5 (obj, mem_ptr, a1, a2, a3, a4, a5);
553
  return ev;
554
}
555
556
template <typename MEM, typename OBJ,
557
          typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
558
EventImpl * MakeEvent (MEM mem_ptr, OBJ obj,
559
                       T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6)
560
{
561
  // six argument version
562
  class EventMemberImpl6 : public EventImpl
563
  {
564
public:
565
    EventMemberImpl6 (OBJ obj, MEM function, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6)
566
      : m_obj (obj),
567
        m_function (function),
568
        m_a1 (a1),
569
        m_a2 (a2),
570
        m_a3 (a3),
571
        m_a4 (a4),
572
        m_a5 (a5),
573
        m_a6 (a6)
574
    {
575
    }
576
protected:
577
    virtual ~EventMemberImpl6 ()
578
    {
579
    }
580
private:
581
    virtual void Notify (void)
582
    {
583
      (EventMemberImplObjTraits<OBJ>::GetReference (m_obj).*m_function)(m_a1, m_a2, m_a3, m_a4, m_a5, m_a6);
584
    }
585
    OBJ m_obj;
586
    MEM m_function;
587
    typename TypeTraits<T1>::ReferencedType m_a1;
588
    typename TypeTraits<T2>::ReferencedType m_a2;
589
    typename TypeTraits<T3>::ReferencedType m_a3;
590
    typename TypeTraits<T4>::ReferencedType m_a4;
591
    typename TypeTraits<T5>::ReferencedType m_a5;
592
    typename TypeTraits<T6>::ReferencedType m_a6;
593
  } *ev = new EventMemberImpl6 (obj, mem_ptr, a1, a2, a3, a4, a5, a6);
594
  return ev;
595
}
596
597
template <typename U1, typename T1>
598
EventImpl * MakeEvent (void (*f)(U1), T1 a1)
599
{
600
  // one arg version
601
  class EventFunctionImpl1 : public EventImpl
602
  {
603
public:
604
    typedef void (*F)(U1);
605
606
    EventFunctionImpl1 (F function, T1 a1)
607
      : m_function (function),
608
        m_a1 (a1)
609
    {
610
    }
611
protected:
612
    virtual ~EventFunctionImpl1 ()
613
    {
614
    }
615
private:
616
    virtual void Notify (void)
617
    {
618
      (*m_function)(m_a1);
619
    }
620
    F m_function;
621
    typename TypeTraits<T1>::ReferencedType m_a1;
622
  } *ev = new EventFunctionImpl1 (f, a1);
623
  return ev;
624
}
625
626
template <typename U1, typename U2, typename T1, typename T2>
627
EventImpl * MakeEvent (void (*f)(U1,U2), T1 a1, T2 a2)
628
{
629
  // two arg version
630
  class EventFunctionImpl2 : public EventImpl
631
  {
632
public:
633
    typedef void (*F)(U1, U2);
634
635
    EventFunctionImpl2 (F function, T1 a1, T2 a2)
636
      : m_function (function),
637
        m_a1 (a1),
638
        m_a2 (a2)
639
    {
640
    }
641
protected:
642
    virtual ~EventFunctionImpl2 ()
643
    {
644
    }
645
private:
646
    virtual void Notify (void)
647
    {
648
      (*m_function)(m_a1, m_a2);
649
    }
650
    F m_function;
651
    typename TypeTraits<T1>::ReferencedType m_a1;
652
    typename TypeTraits<T2>::ReferencedType m_a2;
653
  } *ev = new EventFunctionImpl2 (f, a1, a2);
654
  return ev;
655
}
656
657
template <typename U1, typename U2, typename U3,
658
          typename T1, typename T2, typename T3>
659
EventImpl * MakeEvent (void (*f)(U1,U2,U3), T1 a1, T2 a2, T3 a3)
660
{
661
  // three arg version
662
  class EventFunctionImpl3 : public EventImpl
663
  {
664
public:
665
    typedef void (*F)(U1, U2, U3);
666
667
    EventFunctionImpl3 (F function, T1 a1, T2 a2, T3 a3)
668
      : m_function (function),
669
        m_a1 (a1),
670
        m_a2 (a2),
671
        m_a3 (a3)
672
    {
673
    }
674
protected:
675
    virtual ~EventFunctionImpl3 ()
676
    {
677
    }
678
private:
679
    virtual void Notify (void)
680
    {
681
      (*m_function)(m_a1, m_a2, m_a3);
682
    }
683
    F m_function;
684
    typename TypeTraits<T1>::ReferencedType m_a1;
685
    typename TypeTraits<T2>::ReferencedType m_a2;
686
    typename TypeTraits<T3>::ReferencedType m_a3;
687
  } *ev = new EventFunctionImpl3 (f, a1, a2, a3);
688
  return ev;
689
}
690
691
template <typename U1, typename U2, typename U3, typename U4,
692
          typename T1, typename T2, typename T3, typename T4>
693
EventImpl * MakeEvent (void (*f)(U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4)
694
{
695
  // four arg version
696
  class EventFunctionImpl4 : public EventImpl
697
  {
698
public:
699
    typedef void (*F)(U1, U2, U3, U4);
700
701
    EventFunctionImpl4 (F function, T1 a1, T2 a2, T3 a3, T4 a4)
702
      : m_function (function),
703
        m_a1 (a1),
704
        m_a2 (a2),
705
        m_a3 (a3),
706
        m_a4 (a4)
707
    {
708
    }
709
protected:
710
    virtual ~EventFunctionImpl4 ()
711
    {
712
    }
713
private:
714
    virtual void Notify (void)
715
    {
716
      (*m_function)(m_a1, m_a2, m_a3, m_a4);
717
    }
718
    F m_function;
719
    typename TypeTraits<T1>::ReferencedType m_a1;
720
    typename TypeTraits<T2>::ReferencedType m_a2;
721
    typename TypeTraits<T3>::ReferencedType m_a3;
722
    typename TypeTraits<T4>::ReferencedType m_a4;
723
  } *ev = new EventFunctionImpl4 (f, a1, a2, a3, a4);
724
  return ev;
725
}
726
727
template <typename U1, typename U2, typename U3, typename U4, typename U5,
728
          typename T1, typename T2, typename T3, typename T4, typename T5>
729
EventImpl * MakeEvent (void (*f)(U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
730
{
731
  // five arg version
732
  class EventFunctionImpl5 : public EventImpl
733
  {
734
public:
735
    typedef void (*F)(U1,U2,U3,U4,U5);
736
737
    EventFunctionImpl5 (F function, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
738
      : m_function (function),
739
        m_a1 (a1),
740
        m_a2 (a2),
741
        m_a3 (a3),
742
        m_a4 (a4),
743
        m_a5 (a5)
744
    {
745
    }
746
protected:
747
    virtual ~EventFunctionImpl5 ()
748
    {
749
    }
750
private:
751
    virtual void Notify (void)
752
    {
753
      (*m_function)(m_a1, m_a2, m_a3, m_a4, m_a5);
754
    }
755
    F m_function;
756
    typename TypeTraits<T1>::ReferencedType m_a1;
757
    typename TypeTraits<T2>::ReferencedType m_a2;
758
    typename TypeTraits<T3>::ReferencedType m_a3;
759
    typename TypeTraits<T4>::ReferencedType m_a4;
760
    typename TypeTraits<T5>::ReferencedType m_a5;
761
  } *ev = new EventFunctionImpl5 (f, a1, a2, a3, a4, a5);
762
  return ev;
763
}
764
765
template <typename U1, typename U2, typename U3, typename U4, typename U5, typename U6,
766
          typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
767
EventImpl * MakeEvent (void (*f)(U1,U2,U3,U4,U5,U6), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6)
768
{
769
  // six arg version
770
  class EventFunctionImpl6 : public EventImpl
771
  {
772
public:
773
    typedef void (*F)(U1,U2,U3,U4,U5,U6);
774
775
    EventFunctionImpl6 (F function, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6)
776
      : m_function (function),
777
        m_a1 (a1),
778
        m_a2 (a2),
779
        m_a3 (a3),
780
        m_a4 (a4),
781
        m_a5 (a5),
782
        m_a6 (a6)
783
    {
784
    }
785
protected:
786
    virtual ~EventFunctionImpl6 ()
787
    {
788
    }
789
private:
790
    virtual void Notify (void)
791
    {
792
      (*m_function)(m_a1, m_a2, m_a3, m_a4, m_a5, m_a6);
793
    }
794
    F m_function;
795
    typename TypeTraits<T1>::ReferencedType m_a1;
796
    typename TypeTraits<T2>::ReferencedType m_a2;
797
    typename TypeTraits<T3>::ReferencedType m_a3;
798
    typename TypeTraits<T4>::ReferencedType m_a4;
799
    typename TypeTraits<T5>::ReferencedType m_a5;
800
    typename TypeTraits<T6>::ReferencedType m_a6;
801
  } *ev = new EventFunctionImpl6 (f, a1, a2, a3, a4, a5, a6);
802
  return ev;
803
}
64
}
804
65
805
} // namespace ns3
66
} // namespace ns3
(-)a/src/core/model/object.h (-136 / +7 lines)
 Lines 222-228    Link Here 
222
  /**
222
  /**
223
   * Check if the object has been initialized.
223
   * Check if the object has been initialized.
224
   *
224
   *
225
   * \brief returns true if the object has been initialized. 
225
   * \brief Check if the object has been initialized.
226
   * \returns \c true if the object has been initialized.
226
   */
227
   */
227
  bool IsInitialized (void) const;
228
  bool IsInitialized (void) const;
228
229
 Lines 525-668    Link Here 
525
 * Create an object by type, with varying number of constructor parameters.
526
 * Create an object by type, with varying number of constructor parameters.
526
 *
527
 *
527
 * \tparam T \explicit The type of the derived object to construct.
528
 * \tparam T \explicit The type of the derived object to construct.
529
 * \tparam Ts \deduced Constructor argument types.
530
 * \param [in] args The arguments to use in creating the object.
528
 * \return The derived object.
531
 * \return The derived object.
529
 */
532
 */
530
template <typename T>
533
template <typename T, typename... Ts>
531
Ptr<T> CreateObject (void)
534
Ptr<T> CreateObject (Ts... args)
532
{
535
{
533
  return CompleteConstruct (new T ());
536
  return CompleteConstruct (new T (args...));
534
}
535
/**
536
 * \copybrief CreateObject()
537
 * \tparam T \explicit The type of the derived object to construct.
538
 * \tparam T1 \deduced The type of the constructor argument.
539
 * \param [in] a1 The constructor argument
540
 * \return The derived object.
541
 */
542
template <typename T, typename T1>
543
Ptr<T> CreateObject (T1 a1)
544
{
545
  return CompleteConstruct (new T (a1));
546
}
547
548
/**
549
 * \copybrief CreateObject()
550
 * \tparam T \explicit The type of the derived object to construct.
551
 * \tparam T1 \deduced The type of the first constructor argument.
552
 * \tparam T2 \deduced The type of the second constructor argument.
553
 * \param [in] a1 The constructor first argument
554
 * \param [in] a2 The constructor second argument
555
 * \return The derived object.
556
 */
557
template <typename T, typename T1, typename T2>
558
Ptr<T> CreateObject (T1 a1, T2 a2)
559
{
560
  return CompleteConstruct (new T (a1,a2));
561
}
562
563
/**
564
 * \copybrief CreateObject()
565
 * \tparam T \explicit The type of the derived object to construct.
566
 * \tparam T1 \deduced The type of the first constructor argument.
567
 * \tparam T2 \deduced The type of the second constructor argument.
568
 * \tparam T3 \deduced The type of the third constructor argument.
569
 * \param [in] a1 The constructor first argument
570
 * \param [in] a2 The constructor second argument
571
 * \param [in] a3 The constructor third argument
572
 * \return The derived object.
573
 */
574
template <typename T, typename T1, typename T2, typename T3>
575
Ptr<T> CreateObject (T1 a1, T2 a2, T3 a3)
576
{
577
  return CompleteConstruct (new T (a1,a2,a3));
578
}
579
580
/**
581
 * \copybrief CreateObject()
582
 * \tparam T \explicit The type of the derived object to construct.
583
 * \tparam T1 \deduced The type of the first constructor argument.
584
 * \tparam T2 \deduced The type of the second constructor argument.
585
 * \tparam T3 \deduced The type of the third constructor argument.
586
 * \tparam T4 \deduced The type of the fourth constructor argument.
587
 * \param [in] a1 The constructor first argument
588
 * \param [in] a2 The constructor second argument
589
 * \param [in] a3 The constructor third argument
590
 * \param [in] a4 The constructor fourth argument
591
 * \return The derived object.
592
 */
593
template <typename T, typename T1, typename T2, typename T3, typename T4>
594
Ptr<T> CreateObject (T1 a1, T2 a2, T3 a3, T4 a4)
595
{
596
  return CompleteConstruct (new T (a1,a2,a3,a4));
597
}
598
599
/**
600
 * \copybrief CreateObject()
601
 * \tparam T \explicit The type of the derived object to construct.
602
 * \tparam T1 \deduced The type of the first constructor argument.
603
 * \tparam T2 \deduced The type of the second constructor argument.
604
 * \tparam T3 \deduced The type of the third constructor argument.
605
 * \tparam T4 \deduced The type of the fourth constructor argument.
606
 * \tparam T5 \deduced The type of the fifth constructor argument.
607
 * \param [in] a1 The constructor first argument
608
 * \param [in] a2 The constructor second argument
609
 * \param [in] a3 The constructor third argument
610
 * \param [in] a4 The constructor fourth argument
611
 * \param [in] a5 The constructor fifth argument
612
 * \return The derived object.
613
 */
614
template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5>
615
Ptr<T> CreateObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
616
{
617
  return CompleteConstruct (new T (a1,a2,a3,a4,a5));
618
}
619
620
/**
621
 * \copybrief CreateObject()
622
 * \tparam T \explicit The type of the derived object to construct.
623
 * \tparam T1 \deduced The type of the first constructor argument.
624
 * \tparam T2 \deduced The type of the second constructor argument.
625
 * \tparam T3 \deduced The type of the third constructor argument.
626
 * \tparam T4 \deduced The type of the fourth constructor argument.
627
 * \tparam T5 \deduced The type of the fifth constructor argument.
628
 * \tparam T6 \deduced The type of the sixth constructor argument.
629
 * \param [in] a1 The constructor first argument
630
 * \param [in] a2 The constructor second argument
631
 * \param [in] a3 The constructor third argument
632
 * \param [in] a4 The constructor fourth argument
633
 * \param [in] a5 The constructor fifth argument
634
 * \param [in] a6 The constructor sixth argument
635
 * \return The derived object.
636
 */
637
template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
638
Ptr<T> CreateObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6)
639
{
640
  return CompleteConstruct (new T (a1,a2,a3,a4,a5,a6));
641
}
642
643
/**
644
 * \copybrief CreateObject()
645
 * \tparam T \explicit The type of the derived object to construct.
646
 * \tparam T1 \deduced The type of the first constructor argument.
647
 * \tparam T2 \deduced The type of the second constructor argument.
648
 * \tparam T3 \deduced The type of the third constructor argument.
649
 * \tparam T4 \deduced The type of the fourth constructor argument.
650
 * \tparam T5 \deduced The type of the fifth constructor argument.
651
 * \tparam T6 \deduced The type of the sixth constructor argument.
652
 * \tparam T7 \deduced The type of the seventh constructor argument.
653
 * \param [in] a1 The constructor first argument
654
 * \param [in] a2 The constructor second argument
655
 * \param [in] a3 The constructor third argument
656
 * \param [in] a4 The constructor fourth argument
657
 * \param [in] a5 The constructor fifth argument
658
 * \param [in] a6 The constructor sixth argument
659
 * \param [in] a7 The constructor seventh argument
660
 * \return The derived object.
661
 */
662
template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
663
Ptr<T> CreateObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7)
664
{
665
  return CompleteConstruct (new T (a1,a2,a3,a4,a5,a6,a7));
666
}
537
}
667
/**@}*/
538
/**@}*/
668
539
(-)a/src/core/model/ptr.h (-168 / +8 lines)
 Lines 210-347    Link Here 
210
 * Create class instances by constructors with varying numbers
210
 * Create class instances by constructors with varying numbers
211
 * of arguments and return them by Ptr.
211
 * of arguments and return them by Ptr.
212
 *
212
 *
213
 * These methods work for any class \c T.
213
 * This template work for any class \c T derived from ns3::SimpleRefCount
214
 *
214
 *
215
 * \see CreateObject for methods to create derivatives of ns3::Object
215
 * \see CreateObject for methods to create derivatives of ns3::Object
216
 */
216
 */
217
/** @{ */
217
/** @{ */
218
/**
218
/**
219
 * \tparam T \explicit The type of class object to create.
220
 * \return A Ptr to the newly created \c T.
221
 */
222
template <typename T>
223
Ptr<T> Create (void);
224
225
/**
226
 * \tparam T  \explicit The type of class object to create.
219
 * \tparam T  \explicit The type of class object to create.
227
 * \tparam T1 \deduced The type of the first constructor argument.
220
 * \tparam Ts \deduced Types of the constructor arguments.
228
 * \param  [in] a1 The first constructor argument.
221
 * \param  [in] args Constructor arguments.
229
 * \return A Ptr to the newly created \c T.
222
 * \return A Ptr to the newly created \c T.
230
 */
223
 */
231
template <typename T,
224
template <typename T,
232
          typename T1>
225
          typename... Ts>
233
Ptr<T> Create (T1 a1);
226
Ptr<T> Create (Ts... args);
234
235
/**
236
 * \tparam T  \explicit The type of class object to create.
237
 * \tparam T1 \deduced The type of the first constructor argument.
238
 * \tparam T2 \deduced The type of the second constructor argument.
239
 * \param  [in] a1 The first constructor argument.
240
 * \param  [in] a2 The second constructor argument.
241
 * \return A Ptr to the newly created \c T.
242
 */
243
template <typename T,
244
          typename T1, typename T2>
245
Ptr<T> Create (T1 a1, T2 a2);
246
247
/**
248
 * \tparam T  \explicit The type of class object to create.
249
 * \tparam T1 \deduced The type of the first constructor argument.
250
 * \tparam T2 \deduced The type of the second constructor argument.
251
 * \tparam T3 \deduced The type of the third constructor argument.
252
 * \param  [in] a1 The first constructor argument.
253
 * \param  [in] a2 The second constructor argument.
254
 * \param  [in] a3 The third constructor argument.
255
 * \return A Ptr to the newly created \c T.
256
 */
257
template <typename T,
258
          typename T1, typename T2,
259
          typename T3>
260
Ptr<T> Create (T1 a1, T2 a2, T3 a3);
261
262
/**
263
 * \tparam T  \explicit The type of class object to create.
264
 * \tparam T1 \deduced The type of the first constructor argument.
265
 * \tparam T2 \deduced The type of the second constructor argument.
266
 * \tparam T3 \deduced The type of the third constructor argument.
267
 * \tparam T4 \deduced The type of the fourth constructor argument.
268
 * \param  [in] a1 The first constructor argument.
269
 * \param  [in] a2 The second constructor argument.
270
 * \param  [in] a3 The third constructor argument.
271
 * \param  [in] a4 The fourth constructor argument.
272
 * \return A Ptr to the newly created \c T.
273
 */
274
template <typename T,
275
          typename T1, typename T2,
276
          typename T3, typename T4>
277
Ptr<T> Create (T1 a1, T2 a2, T3 a3, T4 a4);
278
279
/**
280
 * \tparam T  \explicit The type of class object to create.
281
 * \tparam T1 \deduced The type of the first constructor argument.
282
 * \tparam T2 \deduced The type of the second constructor argument.
283
 * \tparam T3 \deduced The type of the third constructor argument.
284
 * \tparam T4 \deduced The type of the fourth constructor argument.
285
 * \tparam T5 \deduced The type of the fifth constructor argument.
286
 * \param  [in] a1 The first constructor argument.
287
 * \param  [in] a2 The second constructor argument.
288
 * \param  [in] a3 The third constructor argument.
289
 * \param  [in] a4 The fourth constructor argument.
290
 * \param  [in] a5 The fifth constructor argument.
291
 * \return A Ptr to the newly created \c T.
292
 */
293
template <typename T,
294
          typename T1, typename T2,
295
          typename T3, typename T4,
296
          typename T5>
297
Ptr<T> Create (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
298
299
/**
300
 * \tparam T  \explicit The type of class object to create.
301
 * \tparam T1 \deduced The type of the first constructor argument.
302
 * \tparam T2 \deduced The type of the second constructor argument.
303
 * \tparam T3 \deduced The type of the third constructor argument.
304
 * \tparam T4 \deduced The type of the fourth constructor argument.
305
 * \tparam T5 \deduced The type of the fifth constructor argument.
306
 * \tparam T6 \deduced The type of the sixth constructor argument.
307
 * \param  [in] a1 The first constructor argument.
308
 * \param  [in] a2 The second constructor argument.
309
 * \param  [in] a3 The third constructor argument.
310
 * \param  [in] a4 The fourth constructor argument.
311
 * \param  [in] a5 The fifth constructor argument.
312
 * \param  [in] a6 The sixth constructor argument.
313
 * \return A Ptr to the newly created \c T.
314
 */
315
template <typename T,
316
          typename T1, typename T2,
317
          typename T3, typename T4,
318
          typename T5, typename T6>
319
Ptr<T> Create (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6);
320
321
/**
322
 * \tparam T  \explicit The type of class object to create.
323
 * \tparam T1 \deduced The type of the first constructor argument.
324
 * \tparam T2 \deduced The type of the second constructor argument.
325
 * \tparam T3 \deduced The type of the third constructor argument.
326
 * \tparam T4 \deduced The type of the fourth constructor argument.
327
 * \tparam T5 \deduced The type of the fifth constructor argument.
328
 * \tparam T6 \deduced The type of the sixth constructor argument.
329
 * \tparam T7 \deduced The type of the seventh constructor argument.
330
 * \param  [in] a1 The first constructor argument.
331
 * \param  [in] a2 The second constructor argument.
332
 * \param  [in] a3 The third constructor argument.
333
 * \param  [in] a4 The fourth constructor argument.
334
 * \param  [in] a5 The fifth constructor argument.
335
 * \param  [in] a6 The sixth constructor argument.
336
 * \param  [in] a7 The seventh constructor argument.
337
 * \return A Ptr to the newly created \c T.
338
 */
339
template <typename T,
340
          typename T1, typename T2,
341
          typename T3, typename T4,
342
          typename T5, typename T6,
343
          typename T7>
344
Ptr<T> Create (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7);
345
/** @}*/
227
/** @}*/
346
228
347
/**
229
/**
 Lines 510-561    Link Here 
510
 *  friend non-member function implementations
392
 *  friend non-member function implementations
511
 ************************************************/
393
 ************************************************/
512
394
513
template <typename T>
395
template <typename T, typename... Ts>
514
Ptr<T> Create (void)
396
Ptr<T> Create (Ts... args)
515
{
397
{
516
  return Ptr<T> (new T (), false);
398
  return Ptr<T> (new T (args...), false);
517
}
518
519
template <typename T, typename T1>
520
Ptr<T> Create (T1 a1)
521
{
522
  return Ptr<T> (new T (a1), false);
523
}
524
525
template <typename T, typename T1, typename T2>
526
Ptr<T> Create (T1 a1, T2 a2)
527
{
528
  return Ptr<T> (new T (a1, a2), false);
529
}
530
531
template <typename T, typename T1, typename T2, typename T3>
532
Ptr<T> Create (T1 a1, T2 a2, T3 a3)
533
{
534
  return Ptr<T> (new T (a1, a2, a3), false);
535
}
536
537
template <typename T, typename T1, typename T2, typename T3, typename T4>
538
Ptr<T> Create (T1 a1, T2 a2, T3 a3, T4 a4)
539
{
540
  return Ptr<T> (new T (a1, a2, a3, a4), false);
541
}
542
543
template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5>
544
Ptr<T> Create (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
545
{
546
  return Ptr<T> (new T (a1, a2, a3, a4, a5), false);
547
}
548
549
template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
550
Ptr<T> Create (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6)
551
{
552
  return Ptr<T> (new T (a1, a2, a3, a4, a5, a6), false);
553
}
554
555
template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
556
Ptr<T> Create (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7)
557
{
558
  return Ptr<T> (new T (a1, a2, a3, a4, a5, a6, a7), false);
559
}
399
}
560
400
561
template <typename U>
401
template <typename U>
(-)a/src/core/model/realtime-simulator-impl.cc (-1 / +1 lines)
 Lines 502-508    Link Here 
502
RealtimeSimulatorImpl::Stop (Time const &delay)
502
RealtimeSimulatorImpl::Stop (Time const &delay)
503
{
503
{
504
  NS_LOG_FUNCTION (this << delay);
504
  NS_LOG_FUNCTION (this << delay);
505
  Simulator::Schedule (delay, &Simulator::Stop);
505
  Simulator::Schedule<void ()> (delay, &Simulator::Stop);
506
}
506
}
507
507
508
//
508
//
(-)a/src/core/model/simulator.cc (-24 lines)
 Lines 283-312    Link Here 
283
}
283
}
284
284
285
285
286
EventId
287
Simulator::Schedule (Time const &delay, void (*f)(void))
288
{
289
  return DoSchedule (delay, MakeEvent (f));
290
}
291
292
void
293
Simulator::ScheduleWithContext (uint32_t context, Time const &delay, void (*f)(void))
294
{
295
  return ScheduleWithContext (context, delay, MakeEvent (f));
296
}
297
298
EventId
299
Simulator::ScheduleNow (void (*f)(void))
300
{
301
  return DoScheduleNow (MakeEvent (f));
302
}
303
304
EventId
305
Simulator::ScheduleDestroy (void (*f)(void))
306
{
307
  return DoScheduleDestroy (MakeEvent (f));
308
}
309
310
void
286
void
311
Simulator::Remove (const EventId &id)
287
Simulator::Remove (const EventId &id)
312
{
288
{
(-)a/src/core/model/simulator.h (-1302 / +86 lines)
 Lines 191-197    Link Here 
191
     */
191
     */
192
    NO_CONTEXT = 0xffffffff
192
    NO_CONTEXT = 0xffffffff
193
  };
193
  };
194
  
194
195
  /**
195
  /**
196
   * @name Schedule events (in the same context) to run at a future time.
196
   * @name Schedule events (in the same context) to run at a future time.
197
   */
197
   */
 Lines 202-332    Link Here 
202
   * for the current simulation time plus the @p delay  passed as a
202
   * for the current simulation time plus the @p delay  passed as a
203
   * parameter.
203
   * parameter.
204
   *
204
   *
205
   * When the event expires (when it becomes due to be run), the 
205
   * @tparam Ts @deduced Argument types.
206
   * input method will be invoked on the input object.
207
   *
208
   * @tparam MEM @deduced Class method function signature type.
209
   * @tparam OBJ @deduced Class type of the object.
210
   * @param [in] delay The relative expiration time of the event.
206
   * @param [in] delay The relative expiration time of the event.
211
   * @param [in] mem_ptr Member method pointer to invoke
207
   * @param [in] args Arguments to pass to MakeEvent.
212
   * @param [in] obj The object on which to invoke the member method
213
   * @returns The id for the scheduled event.
208
   * @returns The id for the scheduled event.
214
   */
209
   */
215
  template <typename MEM, typename OBJ>
210
  template <typename... Ts>
216
  static EventId Schedule (Time const &delay, MEM mem_ptr, OBJ obj);
211
  static EventId Schedule (Time const &delay, Ts&&... args);
217
212
218
  /**
213
  /**
219
   * @see Schedule(const Time&,MEM,OBJ)
214
   *
220
   * @tparam MEM @deduced Class method function signature type.
221
   * @tparam OBJ @deduced Class type of the object.
222
   * @tparam T1 @deduced Type of first argument.
223
   * @param [in] delay The relative expiration time of the event.
224
   * @param [in] mem_ptr Member method pointer to invoke
225
   * @param [in] obj The object on which to invoke the member method
226
   * @param [in] a1 The first argument to pass to the invoked method
227
   * @returns The id for the scheduled event.
228
   */
229
  template <typename MEM, typename OBJ, typename T1>
230
  static EventId Schedule (Time const &delay, MEM mem_ptr, OBJ obj, T1 a1);
231
232
  /**
233
   * @see Schedule(const Time&,MEM,OBJ)
234
   * @tparam MEM @deduced Class method function signature type.
235
   * @tparam OBJ @deduced Class type of the object.
236
   * @tparam T1 @deduced Type of first argument.
237
   * @tparam T2 @deduced Type of second argument.
238
   * @param [in] delay The relative expiration time of the event.
239
   * @param [in] mem_ptr Member method pointer to invoke
240
   * @param [in] obj The object on which to invoke the member method
241
   * @param [in] a1 The first argument to pass to the invoked method
242
   * @param [in] a2 The second argument to pass to the invoked method
243
   * @returns The id for the scheduled event.
244
   */
245
  template <typename MEM, typename OBJ, typename T1, typename T2>
246
  static EventId Schedule (Time const &delay, MEM mem_ptr, OBJ obj, T1 a1, T2 a2);
247
248
  /**
249
   * @see Schedule(const Time&,MEM,OBJ)
250
   * @tparam MEM @deduced Class method function signature type.
251
   * @tparam OBJ @deduced Class type of the object.
252
   * @tparam T1 @deduced Type of first argument.
253
   * @tparam T2 @deduced Type of second argument.
254
   * @tparam T3 @deduced Type of third argument.
255
   * @param [in] delay The relative expiration time of the event.
256
   * @param [in] mem_ptr Member method pointer to invoke
257
   * @param [in] obj The object on which to invoke the member method
258
   * @param [in] a1 The first argument to pass to the invoked method
259
   * @param [in] a2 The second argument to pass to the invoked method
260
   * @param [in] a3 The third argument to pass to the invoked method
261
   * @returns The id for the scheduled event.
262
   */
263
  template <typename MEM, typename OBJ, 
264
            typename T1, typename T2, typename T3>
265
  static EventId Schedule (Time const &delay, MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3);
266
267
  /**
268
   * @see Schedule(const Time&,MEM,OBJ)
269
   * @tparam MEM @deduced Class method function signature type.
270
   * @tparam OBJ @deduced Class type of the object.
271
   * @tparam T1 @deduced Type of first argument.
272
   * @tparam T2 @deduced Type of second argument.
273
   * @tparam T3 @deduced Type of third argument.
274
   * @tparam T4 @deduced Type of fourth argument.
275
   * @param [in] delay The relative expiration time of the event.
276
   * @param [in] mem_ptr Member method pointer to invoke
277
   * @param [in] obj The object on which to invoke the member method
278
   * @param [in] a1 The first argument to pass to the invoked method
279
   * @param [in] a2 The second argument to pass to the invoked method
280
   * @param [in] a3 The third argument to pass to the invoked method
281
   * @param [in] a4 The fourth argument to pass to the invoked method
282
   * @returns The id for the scheduled event.
283
   */
284
  template <typename MEM, typename OBJ, 
285
            typename T1, typename T2, typename T3, typename T4>
286
  static EventId Schedule (Time const &delay, MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4);
287
288
  /**
289
   * @see Schedule(const Time&,MEM,OBJ)
290
   * @tparam MEM @deduced Class method function signature type.
291
   * @tparam OBJ @deduced Class type of the object.
292
   * @tparam T1 @deduced Type of first argument.
293
   * @tparam T2 @deduced Type of second argument.
294
   * @tparam T3 @deduced Type of third argument.
295
   * @tparam T4 @deduced Type of fourth argument.
296
   * @tparam T5 @deduced Type of fifth argument.
297
   * @param [in] delay The relative expiration time of the event.
298
   * @param [in] mem_ptr Member method pointer to invoke
299
   * @param [in] obj The object on which to invoke the member method
300
   * @param [in] a1 The first argument to pass to the invoked method
301
   * @param [in] a2 The second argument to pass to the invoked method
302
   * @param [in] a3 The third argument to pass to the invoked method
303
   * @param [in] a4 The fourth argument to pass to the invoked method
304
   * @param [in] a5 The fifth argument to pass to the invoked method
305
   * @returns The id for the scheduled event.
306
   */
307
  template <typename MEM, typename OBJ, 
308
            typename T1, typename T2, typename T3, typename T4, typename T5>
309
  static EventId Schedule (Time const &delay, MEM mem_ptr, OBJ obj, 
310
                           T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
311
312
  /**
313
   * @param time the relative expiration time of the event.
314
   * @param mem_ptr member method pointer to invoke
315
   * @param obj the object on which to invoke the member method
316
   * @param a1 the first argument to pass to the invoked method
317
   * @param a2 the second argument to pass to the invoked method
318
   * @param a3 the third argument to pass to the invoked method
319
   * @param a4 the fourth argument to pass to the invoked method
320
   * @param a5 the fifth argument to pass to the invoked method
321
   * @param a6 the sixth argument to pass to the invoked method
322
   * @returns an id for the scheduled event.
323
   */
324
  template <typename MEM, typename OBJ, 
325
            typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
326
  static EventId Schedule (Time const &time, MEM mem_ptr, OBJ obj, 
327
                           T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6);
328
329
  /**
330
   * Schedule an event to expire after @p delay.
215
   * Schedule an event to expire after @p delay.
331
   * This can be thought of as scheduling an event
216
   * This can be thought of as scheduling an event
332
   * for the current simulation time plus the @p delay  passed as a
217
   * for the current simulation time plus the @p delay  passed as a
 Lines 334-455    Link Here 
334
   *
219
   *
335
   * When the event expires (when it becomes due to be run), the
220
   * When the event expires (when it becomes due to be run), the
336
   * function will be invoked with any supplied arguments.
221
   * function will be invoked with any supplied arguments.
222
   *
223
   * @tparam Us @deduced Formal function argument types.
224
   * @tparam Ts @deduced Actual function argument types.
337
   * @param [in] delay The relative expiration time of the event.
225
   * @param [in] delay The relative expiration time of the event.
338
   * @param [in] f The function to invoke
226
   * @param [in] f The function to invoke.
227
   * @param [in] args Arguments to pass to the invoked function.
339
   * @returns The id for the scheduled event.
228
   * @returns The id for the scheduled event.
340
   */
229
   */
341
  static EventId Schedule (Time const &delay, void (*f)(void));
230
  template <typename... Us, typename... Ts>
342
231
  static EventId Schedule (Time const &delay, void (*f)(Us...), Ts&&... args);
343
  /**
344
   * @see Schedule(const Time&,(*)())
345
   * @tparam U1 @deduced Formal type of the first argument to the function.
346
   * @tparam T1 @deduced Actual type of the first argument.
347
   * @param [in] delay The relative expiration time of the event.
348
   * @param [in] f The function to invoke
349
   * @param [in] a1 The first argument to pass to the function to invoke.
350
   * @returns The id for the scheduled event.
351
   */
352
  template <typename U1, typename T1>
353
  static EventId Schedule (Time const &delay, void (*f)(U1), T1 a1);
354
355
  /**
356
   * @see Schedule(const Time&,(*)())
357
   * @tparam U1 @deduced Formal type of the first argument to the function.
358
   * @tparam U2 @deduced Formal type of the second argument to the function.
359
   * @tparam T1 @deduced Actual type of the first argument.
360
   * @tparam T2 @deduced Actual type of the second argument.
361
   * @param [in] delay The relative expiration time of the event.
362
   * @param [in] f The function to invoke
363
   * @param [in] a1 The first argument to pass to the function to invoke
364
   * @param [in] a2 The second argument to pass to the function to invoke
365
   * @returns The id for the scheduled event.
366
   */
367
  template <typename U1, typename U2,
368
            typename T1, typename T2>
369
  static EventId Schedule (Time const &delay, void (*f)(U1,U2), T1 a1, T2 a2);
370
371
  /**
372
   * @see Schedule(const Time&,void(*)())
373
   * @tparam U1 @deduced Formal type of the first argument to the function.
374
   * @tparam U2 @deduced Formal type of the second argument to the function.
375
   * @tparam U3 @deduced Formal type of the third argument to the function.
376
   * @tparam T1 @deduced Actual type of the first argument.
377
   * @tparam T2 @deduced Actual type of the second argument.
378
   * @tparam T3 @deduced Actual type of the third argument.
379
   * @param [in] delay The relative expiration time of the event.
380
   * @param [in] f The function to invoke
381
   * @param [in] a1 The first argument to pass to the function to invoke
382
   * @param [in] a2 The second argument to pass to the function to invoke
383
   * @param [in] a3 The third argument to pass to the function to invoke
384
   * @returns The id for the scheduled event.
385
   */
386
  template <typename U1, typename U2, typename U3,
387
            typename T1, typename T2, typename T3>
388
  static EventId Schedule (Time const &delay, void (*f)(U1,U2,U3), T1 a1, T2 a2, T3 a3);
389
390
  /**
391
   * @see Schedule(const Time&,(*)(void))
392
   * @tparam U1 @deduced Formal type of the first argument to the function.
393
   * @tparam U2 @deduced Formal type of the second argument to the function.
394
   * @tparam U3 @deduced Formal type of the third argument to the function.
395
   * @tparam U4 @deduced Formal type of the fourth argument to the function.
396
   * @tparam T1 @deduced Actual type of the first argument.
397
   * @tparam T2 @deduced Actual type of the second argument.
398
   * @tparam T3 @deduced Actual type of the third argument.
399
   * @tparam T4 @deduced Actual type of the fourth argument.
400
   * @param [in] delay The relative expiration time of the event.
401
   * @param [in] f The function to invoke
402
   * @param [in] a1 The first argument to pass to the function to invoke
403
   * @param [in] a2 The second argument to pass to the function to invoke
404
   * @param [in] a3 The third argument to pass to the function to invoke
405
   * @param [in] a4 The fourth argument to pass to the function to invoke
406
   * @returns The id for the scheduled event.
407
   */
408
  template <typename U1, typename U2, typename U3, typename U4, 
409
            typename T1, typename T2, typename T3, typename T4>
410
  static EventId Schedule (Time const &delay, void (*f)(U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4);
411
412
  /**
413
   * @see Schedule(const Time&,void(*)(void))
414
   * @tparam U1 @deduced Formal type of the first argument to the function.
415
   * @tparam U2 @deduced Formal type of the second argument to the function.
416
   * @tparam U3 @deduced Formal type of the third argument to the function.
417
   * @tparam U4 @deduced Formal type of the fourth argument to the function.
418
   * @tparam U5 @deduced Formal type of the fifth argument to the function.
419
   * @tparam T1 @deduced Actual type of the first argument.
420
   * @tparam T2 @deduced Actual type of the second argument.
421
   * @tparam T3 @deduced Actual type of the third argument.
422
   * @tparam T4 @deduced Actual type of the fourth argument.
423
   * @tparam T5 @deduced Actual type of the fifth argument.
424
   * @param [in] delay The relative expiration time of the event.
425
   * @param [in] f The function to invoke
426
   * @param [in] a1 The first argument to pass to the function to invoke
427
   * @param [in] a2 The second argument to pass to the function to invoke
428
   * @param [in] a3 The third argument to pass to the function to invoke
429
   * @param [in] a4 The fourth argument to pass to the function to invoke
430
   * @param [in] a5 The fifth argument to pass to the function to invoke
431
   * @returns The id for the scheduled event.
432
   */
433
  template <typename U1, typename U2, typename U3, typename U4, typename U5,
434
            typename T1, typename T2, typename T3, typename T4, typename T5>
435
  static EventId Schedule (Time const &delay, void (*f)(U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
436
437
  /**
438
   * @param time the relative expiration time of the event.
439
   * @param f the function to invoke
440
   * @param a1 the first argument to pass to the function to invoke
441
   * @param a2 the second argument to pass to the function to invoke
442
   * @param a3 the third argument to pass to the function to invoke
443
   * @param a4 the fourth argument to pass to the function to invoke
444
   * @param a5 the fifth argument to pass to the function to invoke
445
   * @param a6 the sixth argument to pass to the function to invoke
446
   * @returns an id for the scheduled event.
447
   */
448
  template <typename U1, typename U2, typename U3, typename U4, typename U5, typename U6,
449
            typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
450
  static EventId Schedule (Time const &time, void (*f)(U1,U2,U3,U4,U5,U6), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6);
451
452
453
  /** @} */
232
  /** @} */
454
233
455
  /**
234
  /**
 Lines 463-960    Link Here 
463
   * A context of 0xffffffff means no context is specified.
242
   * A context of 0xffffffff means no context is specified.
464
   * This method is thread-safe: it can be called from any thread.
243
   * This method is thread-safe: it can be called from any thread.
465
   *
244
   *
466
   * @see Schedule(const Time&,MEM,OBJ)
245
   * @tparam Ts @deduced Argument types.
467
   * @tparam MEM @deduced Class method function signature type.
468
   * @tparam OBJ @deduced Class type of the object.
469
   * @param [in] context User-specified context parameter
246
   * @param [in] context User-specified context parameter
470
   * @param [in] delay The relative expiration time of the event.
247
   * @param [in] delay The relative expiration time of the event.
471
   * @param [in] mem_ptr Member method pointer to invoke
248
   * @param [in] args Arguments to pass to MakeEvent.
472
   * @param [in] obj The object on which to invoke the member method
473
   */
249
   */
474
  template <typename MEM, typename OBJ>
250
  template <typename... Ts>
475
  static void ScheduleWithContext (uint32_t context, Time const &delay, MEM mem_ptr, OBJ obj);
251
  static void ScheduleWithContext (uint32_t context, Time const &delay, Ts&&... args);
476
252
477
  /**
253
  /**
478
   * @see ScheduleWithContext(uint32_t,const Time&,MEM,OBJ)
479
   * @tparam MEM @deduced Class method function signature type.
480
   * @tparam OBJ @deduced Class type of the object.
481
   * @tparam T1 @deduced Type of first argument.
482
   * @param [in] context User-specified context parameter
483
   * @param [in] delay The relative expiration time of the event.
484
   * @param [in] mem_ptr Member method pointer to invoke
485
   * @param [in] obj The object on which to invoke the member method
486
   * @param [in] a1 The first argument to pass to the invoked method
487
   */
488
  template <typename MEM, typename OBJ, typename T1>
489
  static void ScheduleWithContext (uint32_t context, Time const &delay, MEM mem_ptr, OBJ obj, T1 a1);
490
491
  /**
492
   * @see ScheduleWithContext(uint32_t,const Time&,MEM,OBJ)
493
   * @tparam MEM @deduced Class method function signature type.
494
   * @tparam OBJ @deduced Class type of the object.
495
   * @tparam T1 @deduced Type of first argument.
496
   * @tparam T2 @deduced Type of second argument.
497
   * @param [in] context User-specified context parameter
498
   * @param [in] delay The relative expiration time of the event.
499
   * @param [in] mem_ptr Member method pointer to invoke
500
   * @param [in] obj The object on which to invoke the member method
501
   * @param [in] a1 The first argument to pass to the invoked method
502
   * @param [in] a2 The second argument to pass to the invoked method
503
   */
504
  template <typename MEM, typename OBJ, typename T1, typename T2>
505
  static void ScheduleWithContext (uint32_t context, Time const &delay, MEM mem_ptr, OBJ obj, T1 a1, T2 a2);
506
507
  /**
508
   * @see ScheduleWithContext(uint32_t,const Time&,MEM,OBJ)
509
   * @tparam MEM @deduced Class method function signature type.
510
   * @tparam OBJ @deduced Class type of the object.
511
   * @tparam T1 @deduced Type of first argument.
512
   * @tparam T2 @deduced Type of second argument.
513
   * @tparam T3 @deduced Type of third argument.
514
   * @param [in] context User-specified context parameter
515
   * @param [in] delay The relative expiration time of the event.
516
   * @param [in] mem_ptr Member method pointer to invoke
517
   * @param [in] obj The object on which to invoke the member method
518
   * @param [in] a1 The first argument to pass to the invoked method
519
   * @param [in] a2 The second argument to pass to the invoked method
520
   * @param [in] a3 The third argument to pass to the invoked method
521
   */
522
  template <typename MEM, typename OBJ, 
523
            typename T1, typename T2, typename T3>
524
  static void ScheduleWithContext (uint32_t context, Time const &delay, MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3);
525
526
  /**
527
   * @see ScheduleWithContext(uint32_t,const Time&,MEM,OBJ)
528
   * @tparam MEM @deduced Class method function signature type.
529
   * @tparam OBJ @deduced Class type of the object.
530
   * @tparam T1 @deduced Type of first argument.
531
   * @tparam T2 @deduced Type of second argument.
532
   * @tparam T3 @deduced Type of third argument.
533
   * @tparam T4 @deduced Type of fourth argument.
534
   * @param [in] context User-specified context parameter
535
   * @param [in] delay The relative expiration time of the event.
536
   * @param [in] mem_ptr Member method pointer to invoke
537
   * @param [in] obj The object on which to invoke the member method
538
   * @param [in] a1 The first argument to pass to the invoked method
539
   * @param [in] a2 The second argument to pass to the invoked method
540
   * @param [in] a3 The third argument to pass to the invoked method
541
   * @param [in] a4 The fourth argument to pass to the invoked method
542
   */
543
  template <typename MEM, typename OBJ, 
544
            typename T1, typename T2, typename T3, typename T4>
545
  static void ScheduleWithContext (uint32_t context, Time const &delay, MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4);
546
547
  /**
548
   * @see ScheduleWithContext(uint32_t,const Time&,MEM,OBJ)
549
   * @tparam MEM @deduced Class method function signature type.
550
   * @tparam OBJ @deduced Class type of the object.
551
   * @tparam T1 @deduced Type of first argument.
552
   * @tparam T2 @deduced Type of second argument.
553
   * @tparam T3 @deduced Type of third argument.
554
   * @tparam T4 @deduced Type of fourth argument.
555
   * @tparam T5 @deduced Type of fifth argument.
556
   * @param [in] context User-specified context parameter
557
   * @param [in] delay The relative expiration time of the event.
558
   * @param [in] mem_ptr Member method pointer to invoke
559
   * @param [in] obj The object on which to invoke the member method
560
   * @param [in] a1 The first argument to pass to the invoked method
561
   * @param [in] a2 The second argument to pass to the invoked method
562
   * @param [in] a3 The third argument to pass to the invoked method
563
   * @param [in] a4 The fourth argument to pass to the invoked method
564
   * @param [in] a5 The fifth argument to pass to the invoked method
565
   */
566
  template <typename MEM, typename OBJ, 
567
            typename T1, typename T2, typename T3, typename T4, typename T5>
568
  static void ScheduleWithContext (uint32_t context, Time const &delay, MEM mem_ptr, OBJ obj, 
569
                                   T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
570
571
  /**
572
   * This method is thread-safe: it can be called from any thread.
573
   *
574
   * @param time the relative expiration time of the event.
575
   * @param context user-specified context parameter
576
   * @param mem_ptr member method pointer to invoke
577
   * @param obj the object on which to invoke the member method
578
   * @param a1 the first argument to pass to the invoked method
579
   * @param a2 the second argument to pass to the invoked method
580
   * @param a3 the third argument to pass to the invoked method
581
   * @param a4 the fourth argument to pass to the invoked method
582
   * @param a5 the fifth argument to pass to the invoked method
583
   * @param a6 the sixth argument to pass to the invoked method
584
   */
585
  template <typename MEM, typename OBJ, 
586
            typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
587
  static void ScheduleWithContext (uint32_t context, Time const &time, MEM mem_ptr, OBJ obj, 
588
                                   T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6);
589
  
590
  /**
591
   * Schedule an event with the given context.
254
   * Schedule an event with the given context.
592
   * A context of 0xffffffff means no context is specified.
255
   * A context of 0xffffffff means no context is specified.
593
   * This method is thread-safe: it can be called from any thread.
256
   * This method is thread-safe: it can be called from any thread.
594
   *
257
   *
595
   * When the event expires (when it becomes due to be run), the
258
   * @tparam Us @deduced Formal function argument types.
596
   * function will be invoked with any supplied arguments.
259
   * @tparam Ts @deduced Actual function argument types.
597
   *
598
   * This method is thread-safe: it can be called from any thread.
599
   * @param [in] context User-specified context parameter
260
   * @param [in] context User-specified context parameter
600
   * @param [in] delay The relative expiration time of the event.
261
   * @param [in] delay The relative expiration time of the event.
601
   * @param [in] f The function to invoke
262
   * @param [in] f The function to invoke.
263
   * @param [in] args Arguments to pass to the invoked function.
602
   */
264
   */
603
  static void ScheduleWithContext (uint32_t context, Time const &delay, void (*f)(void));
265
  template <typename... Us, typename... Ts>
266
  static void ScheduleWithContext (uint32_t context, Time const &delay, void (*f)(Us...), Ts&&... args);
267
  /** @} */
604
268
605
  /**
269
  /**
606
   * @see ScheduleWithContext(uint32_t,const Time&,(*)())
607
   * @tparam U1 @deduced Formal type of the first argument to the function.
608
   * @tparam T1 @deduced Actual type of the first argument.
609
   * @param [in] context User-specified context parameter
610
   * @param [in] delay The relative expiration time of the event.
611
   * @param [in] f The function to invoke
612
   * @param [in] a1 The first argument to pass to the function to invoke
613
   */
614
  template <typename U1,
615
            typename T1>
616
  static void ScheduleWithContext (uint32_t context, Time const &delay, void (*f)(U1), T1 a1);
617
618
  /**
619
   * @see ScheduleWithContext(uint32_t,const Time&,(*)())
620
   * @tparam U1 @deduced Formal type of the first argument to the function.
621
   * @tparam U2 @deduced Formal type of the second argument to the function.
622
   * @tparam T1 @deduced Actual type of the first argument.
623
   * @tparam T2 @deduced Actual type of the second argument.
624
   * @param [in] context User-specified context parameter
625
   * @param [in] delay The relative expiration time of the event.
626
   * @param [in] f The function to invoke
627
   * @param [in] a1 The first argument to pass to the function to invoke
628
   * @param [in] a2 The second argument to pass to the function to invoke
629
   */
630
  template <typename U1, typename U2,
631
            typename T1, typename T2>
632
  static void ScheduleWithContext (uint32_t context, Time const &delay, void (*f)(U1,U2), T1 a1, T2 a2);
633
634
  /**
635
   * @see ScheduleWithContext(uint32_t,const Time&,(*)())
636
   * @tparam U1 @deduced Formal type of the first argument to the function.
637
   * @tparam U2 @deduced Formal type of the second argument to the function.
638
   * @tparam U3 @deduced Formal type of the third argument to the function.
639
   * @tparam T1 @deduced Actual type of the first argument.
640
   * @tparam T2 @deduced Actual type of the second argument.
641
   * @tparam T3 @deduced Actual type of the third argument.
642
   * @param [in] context User-specified context parameter
643
   * @param [in] delay The relative expiration time of the event.
644
   * @param [in] f The function to invoke
645
   * @param [in] a1 The first argument to pass to the function to invoke
646
   * @param [in] a2 The second argument to pass to the function to invoke
647
   * @param [in] a3 The third argument to pass to the function to invoke
648
   */
649
  template <typename U1, typename U2, typename U3,
650
            typename T1, typename T2, typename T3>
651
  static void ScheduleWithContext (uint32_t context, Time const &delay, void (*f)(U1,U2,U3), T1 a1, T2 a2, T3 a3);
652
653
  /**
654
   * @see ScheduleWithContext(uint32_t,const Time&,(*)())
655
   * @tparam U1 @deduced Formal type of the first argument to the function.
656
   * @tparam U2 @deduced Formal type of the second argument to the function.
657
   * @tparam U3 @deduced Formal type of the third argument to the function.
658
   * @tparam U4 @deduced Formal type of the fourth argument to the function.
659
   * @tparam T1 @deduced Actual type of the first argument.
660
   * @tparam T2 @deduced Actual type of the second argument.
661
   * @tparam T3 @deduced Actual type of the third argument.
662
   * @tparam T4 @deduced Actual type of the fourth argument.
663
   * @param [in] context User-specified context parameter
664
   * @param [in] delay The relative expiration time of the event.
665
   * @param [in] f The function to invoke
666
   * @param [in] a1 The first argument to pass to the function to invoke
667
   * @param [in] a2 The second argument to pass to the function to invoke
668
   * @param [in] a3 The third argument to pass to the function to invoke
669
   * @param [in] a4 The fourth argument to pass to the function to invoke
670
   */
671
  template <typename U1, typename U2, typename U3, typename U4, 
672
            typename T1, typename T2, typename T3, typename T4>
673
  static void ScheduleWithContext (uint32_t context, Time const &delay, void (*f)(U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4);
674
675
  /**
676
   * @see ScheduleWithContext(uint32_t,const Time&,(*)())
677
   * @tparam U1 @deduced Formal type of the first argument to the function.
678
   * @tparam U2 @deduced Formal type of the second argument to the function.
679
   * @tparam U3 @deduced Formal type of the third argument to the function.
680
   * @tparam U4 @deduced Formal type of the fourth argument to the function.
681
   * @tparam U5 @deduced Formal type of the fifth argument to the function.
682
   * @tparam T1 @deduced Actual type of the first argument.
683
   * @tparam T2 @deduced Actual type of the second argument.
684
   * @tparam T3 @deduced Actual type of the third argument.
685
   * @tparam T4 @deduced Actual type of the fourth argument.
686
   * @tparam T5 @deduced Actual type of the fifth argument.
687
   * @param [in] context User-specified context parameter
688
   * @param [in] delay The relative expiration time of the event.
689
   * @param [in] f The function to invoke
690
   * @param [in] a1 The first argument to pass to the function to invoke
691
   * @param [in] a2 The second argument to pass to the function to invoke
692
   * @param [in] a3 The third argument to pass to the function to invoke
693
   * @param [in] a4 The fourth argument to pass to the function to invoke
694
   * @param [in] a5 The fifth argument to pass to the function to invoke
695
   */
696
  template <typename U1, typename U2, typename U3, typename U4, typename U5,
697
            typename T1, typename T2, typename T3, typename T4, typename T5>
698
  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);
699
700
  /**
701
   * This method is thread-safe: it can be called from any thread.
702
   *
703
   * @param time the relative expiration time of the event.
704
   * @param context user-specified context parameter
705
   * @param f the function to invoke
706
   * @param a1 the first argument to pass to the function to invoke
707
   * @param a2 the second argument to pass to the function to invoke
708
   * @param a3 the third argument to pass to the function to invoke
709
   * @param a4 the fourth argument to pass to the function to invoke
710
   * @param a5 the fifth argument to pass to the function to invoke
711
   * @param a6 the sixth argument to pass to the function to invoke
712
   */
713
  template <typename U1, typename U2, typename U3, typename U4, typename U5, typename U6,
714
            typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
715
  static void ScheduleWithContext (uint32_t context, Time const &time, void (*f)(U1,U2,U3,U4,U5,U6), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6);
716
717
  /** @} */
718
  
719
  /**
720
   * @name Schedule events (in the same context) to run now.
270
   * @name Schedule events (in the same context) to run now.
721
   */
271
   */
722
  /** @{ */
272
  /** @{ */
723
  /**
273
  /**
724
   * Schedule an event to expire Now. All events scheduled to
274
   * Schedule an event to expire Now. All events scheduled to
725
   * to expire "Now" are scheduled FIFO, after all normal events
275
   * to expire "Now" are scheduled FIFO, after all normal events
726
   * have expired. 
276
   * have expired.
727
   *
277
   *
728
   * @tparam MEM @deduced Class method function signature type.
278
   * @tparam Ts @deduced Actual function argument types.
729
   * @tparam OBJ @deduced Class type of the object.
279
   * @param [in] args Arguments to pass to the invoked function.
730
   * @param [in] mem_ptr Member method pointer to invoke
731
   * @param [in] obj The object on which to invoke the member method
732
   * @return The EventId of the scheduled event.
280
   * @return The EventId of the scheduled event.
733
   */
281
   */
734
  template <typename MEM, typename OBJ>
282
  template <typename... Ts>
735
  static EventId ScheduleNow (MEM mem_ptr, OBJ obj);
283
  static EventId ScheduleNow (Ts&&... args);
736
284
737
  /**
285
  /**
738
   * @see ScheduleNow(MEM,OBJ)
286
   * Schedule an event to expire Now. All events scheduled to
739
   * @tparam MEM @deduced Class method function signature type.
287
   * to expire "Now" are scheduled FIFO, after all normal events
740
   * @tparam OBJ @deduced Class type of the object.
288
   * have expired.
741
   * @tparam T1 @deduced Type of first argument.
289
   *
742
   * @param [in] mem_ptr Member method pointer to invoke
290
   * @tparam Us @deduced Formal function argument types.
743
   * @param [in] obj The object on which to invoke the member method
291
   * @tparam Ts @deduced Actual function argument types.
744
   * @param [in] a1 The first argument to pass to the invoked method
292
   * @param [in] f The function to invoke.
293
   * @param [in] args Arguments to pass to MakeEvent.
745
   * @return The EventId of the scheduled event.
294
   * @return The EventId of the scheduled event.
746
   */
295
   */
747
  template <typename MEM, typename OBJ, 
296
  template <typename... Us, typename... Ts>
748
            typename T1>
297
  static EventId ScheduleNow (void (*f)(Us...), Ts&&... args);
749
  static EventId ScheduleNow (MEM mem_ptr, OBJ obj, T1 a1);
750
751
  /**
752
   * @see ScheduleNow(MEM,OBJ)
753
   * @tparam MEM @deduced Class method function signature type.
754
   * @tparam OBJ @deduced Class type of the object.
755
   * @tparam T1 @deduced Type of first argument.
756
   * @tparam T2 @deduced Type of second argument.
757
   * @param [in] mem_ptr Member method pointer to invoke
758
   * @param [in] obj The object on which to invoke the member method
759
   * @param [in] a1 The first argument to pass to the invoked method
760
   * @param [in] a2 The second argument to pass to the invoked method
761
   * @return The EventId of the scheduled event.
762
   */
763
  template <typename MEM, typename OBJ, 
764
            typename T1, typename T2>
765
  static EventId ScheduleNow (MEM mem_ptr, OBJ obj, T1 a1, T2 a2);
766
767
  /**
768
   * @see ScheduleNow(MEM,OBJ)
769
   * @tparam MEM @deduced Class method function signature type.
770
   * @tparam OBJ @deduced Class type of the object.
771
   * @tparam T1 @deduced Type of first argument.
772
   * @tparam T2 @deduced Type of second argument.
773
   * @tparam T3 @deduced Type of third argument.
774
   * @param [in] mem_ptr Member method pointer to invoke
775
   * @param [in] obj The object on which to invoke the member method
776
   * @param [in] a1 The first argument to pass to the invoked method
777
   * @param [in] a2 The second argument to pass to the invoked method
778
   * @param [in] a3 The third argument to pass to the invoked method
779
   * @return The EventId of the scheduled event.
780
   */
781
  template <typename MEM, typename OBJ, 
782
            typename T1, typename T2, typename T3>
783
  static EventId ScheduleNow (MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3);
784
785
  /**
786
   * @see ScheduleNow(MEM,OBJ)
787
   * @tparam MEM @deduced Class method function signature type.
788
   * @tparam OBJ @deduced Class type of the object.
789
   * @tparam T1 @deduced Type of first argument.
790
   * @tparam T2 @deduced Type of second argument.
791
   * @tparam T3 @deduced Type of third argument.
792
   * @tparam T4 @deduced Type of fourth argument.
793
   * @param [in] mem_ptr Member method pointer to invoke
794
   * @param [in] obj The object on which to invoke the member method
795
   * @param [in] a1 The first argument to pass to the invoked method
796
   * @param [in] a2 The second argument to pass to the invoked method
797
   * @param [in] a3 The third argument to pass to the invoked method
798
   * @param [in] a4 The fourth argument to pass to the invoked method
799
   * @return The EventId of the scheduled event.
800
   */
801
  template <typename MEM, typename OBJ, 
802
            typename T1, typename T2, typename T3, typename T4>
803
  static EventId ScheduleNow (MEM mem_ptr, OBJ obj, 
804
                              T1 a1, T2 a2, T3 a3, T4 a4);
805
  /**
806
   * @see ScheduleNow(MEM,OBJ)
807
   * @tparam MEM @deduced Class method function signature type.
808
   * @tparam OBJ @deduced Class type of the object.
809
   * @tparam T1 @deduced Type of first argument.
810
   * @tparam T2 @deduced Type of second argument.
811
   * @tparam T3 @deduced Type of third argument.
812
   * @tparam T4 @deduced Type of fourth argument.
813
   * @tparam T5 @deduced Type of fifth argument.
814
   * @param [in] mem_ptr Member method pointer to invoke
815
   * @param [in] obj The object on which to invoke the member method
816
   * @param [in] a1 The first argument to pass to the invoked method
817
   * @param [in] a2 The second argument to pass to the invoked method
818
   * @param [in] a3 The third argument to pass to the invoked method
819
   * @param [in] a4 The fourth argument to pass to the invoked method
820
   * @param [in] a5 The fifth argument to pass to the invoked method
821
   * @return The EventId of the scheduled event.
822
   */
823
  template <typename MEM, typename OBJ, 
824
            typename T1, typename T2, typename T3, typename T4, typename T5>
825
  static EventId ScheduleNow (MEM mem_ptr, OBJ obj, 
826
                              T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
827
828
  /**
829
   * @param mem_ptr member method pointer to invoke
830
   * @param obj the object on which to invoke the member method
831
   * @param a1 the first argument to pass to the invoked method
832
   * @param a2 the second argument to pass to the invoked method
833
   * @param a3 the third argument to pass to the invoked method
834
   * @param a4 the fourth argument to pass to the invoked method
835
   * @param a5 the fifth argument to pass to the invoked method
836
   * @param a6 the sixth argument to pass to the invoked method
837
   * @return The EventId of the scheduled event.
838
   */
839
  template <typename MEM, typename OBJ, 
840
            typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
841
  static EventId ScheduleNow (MEM mem_ptr, OBJ obj, 
842
                              T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6);
843
844
  /**
845
   * @copybrief ScheduleNow(MEM,OBJ)
846
   *
847
   * When the event expires (when it becomes due to be run), the
848
   * function will be invoked with any supplied arguments.
849
   * @param [in] f The function to invoke
850
   * @return The EventId of the scheduled event.
851
   */
852
  static EventId ScheduleNow (void (*f)(void));
853
854
  /**
855
   * @see ScheduleNow(*)
856
   * @tparam U1 @deduced Formal type of the first argument to the function.
857
   * @tparam T1 @deduced Actual type of the first argument.
858
   * @param [in] f The function to invoke
859
   * @param [in] a1 The first argument to pass to the function to invoke
860
   * @return The EventId of the scheduled event.
861
   */
862
  template <typename U1,
863
            typename T1>
864
  static EventId ScheduleNow (void (*f)(U1), T1 a1);
865
866
  /**
867
   * @see ScheduleNow(*)
868
   * @tparam U1 @deduced Formal type of the first argument to the function.
869
   * @tparam U2 @deduced Formal type of the second argument to the function.
870
   * @tparam T1 @deduced Actual type of the first argument.
871
   * @tparam T2 @deduced Actual type of the second argument.
872
   * @param [in] f The function to invoke
873
   * @param [in] a1 The first argument to pass to the function to invoke
874
   * @param [in] a2 The second argument to pass to the function to invoke
875
   * @return The EventId of the scheduled event.
876
   */
877
  template <typename U1, typename U2,
878
            typename T1, typename T2>
879
  static EventId ScheduleNow (void (*f)(U1,U2), T1 a1, T2 a2);
880
881
  /**
882
   * @see ScheduleNow(*)
883
   * @tparam U1 @deduced Formal type of the first argument to the function.
884
   * @tparam U2 @deduced Formal type of the second argument to the function.
885
   * @tparam U3 @deduced Formal type of the third argument to the function.
886
   * @tparam T1 @deduced Actual type of the first argument.
887
   * @tparam T2 @deduced Actual type of the second argument.
888
   * @tparam T3 @deduced Actual type of the third argument.
889
   * @param [in] f The function to invoke
890
   * @param [in] a1 The first argument to pass to the function to invoke
891
   * @param [in] a2 The second argument to pass to the function to invoke
892
   * @param [in] a3 The third argument to pass to the function to invoke
893
   * @return The EventId of the scheduled event.
894
   */
895
  template <typename U1, typename U2, typename U3,
896
            typename T1, typename T2, typename T3>
897
  static EventId ScheduleNow (void (*f)(U1,U2,U3), T1 a1, T2 a2, T3 a3);
898
899
  /**
900
   * @see ScheduleNow(*)
901
   * @tparam U1 @deduced Formal type of the first argument to the function.
902
   * @tparam U2 @deduced Formal type of the second argument to the function.
903
   * @tparam U3 @deduced Formal type of the third argument to the function.
904
   * @tparam U4 @deduced Formal type of the fourth argument to the function.
905
   * @tparam T1 @deduced Actual type of the first argument.
906
   * @tparam T2 @deduced Actual type of the second argument.
907
   * @tparam T3 @deduced Actual type of the third argument.
908
   * @tparam T4 @deduced Actual type of the fourth argument.
909
   * @param [in] f The function to invoke
910
   * @param [in] a1 The first argument to pass to the function to invoke
911
   * @param [in] a2 The second argument to pass to the function to invoke
912
   * @param [in] a3 The third argument to pass to the function to invoke
913
   * @param [in] a4 The fourth argument to pass to the function to invoke
914
   * @return The EventId of the scheduled event.
915
   */
916
  template <typename U1, typename U2, typename U3, typename U4,
917
            typename T1, typename T2, typename T3, typename T4>
918
  static EventId ScheduleNow (void (*f)(U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4);
919
920
  /**
921
   * @see ScheduleNow(*)
922
   * @tparam U1 @deduced Formal type of the first argument to the function.
923
   * @tparam U2 @deduced Formal type of the second argument to the function.
924
   * @tparam U3 @deduced Formal type of the third argument to the function.
925
   * @tparam U4 @deduced Formal type of the fourth argument to the function.
926
   * @tparam U5 @deduced Formal type of the fifth argument to the function.
927
   * @tparam T1 @deduced Actual type of the first argument.
928
   * @tparam T2 @deduced Actual type of the second argument.
929
   * @tparam T3 @deduced Actual type of the third argument.
930
   * @tparam T4 @deduced Actual type of the fourth argument.
931
   * @tparam T5 @deduced Actual type of the fifth argument.
932
   * @param [in] f The function to invoke
933
   * @param [in] a1 The first argument to pass to the function to invoke
934
   * @param [in] a2 The second argument to pass to the function to invoke
935
   * @param [in] a3 The third argument to pass to the function to invoke
936
   * @param [in] a4 The fourth argument to pass to the function to invoke
937
   * @param [in] a5 The fifth argument to pass to the function to invoke
938
   * @return The EventId of the scheduled event.
939
   */
940
  template <typename U1, typename U2, typename U3, typename U4, typename U5,
941
            typename T1, typename T2, typename T3, typename T4, typename T5>
942
  static EventId ScheduleNow (void (*f)(U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
943
944
  /**
945
   * @param f the function to invoke
946
   * @param a1 the first argument to pass to the function to invoke
947
   * @param a2 the second argument to pass to the function to invoke
948
   * @param a3 the third argument to pass to the function to invoke
949
   * @param a4 the fourth argument to pass to the function to invoke
950
   * @param a5 the fifth argument to pass to the function to invoke
951
   * @param a6 the sixth argument to pass to the function to invoke
952
   * @return The EventId of the scheduled event.
953
   */
954
  template <typename U1, typename U2, typename U3, typename U4, typename U5, typename U6,
955
            typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
956
  static EventId ScheduleNow (void (*f)(U1,U2,U3,U4,U5,U6), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6);
957
958
  /** @} */
298
  /** @} */
959
299
960
  /**
300
  /**
 Lines 962-1201    Link Here 
962
   */
302
   */
963
  /** @{ */
303
  /** @{ */
964
  /**
304
  /**
965
   * Schedule an event to expire when Simulator::Destroy is called.
305
   * Schedule an event to run at the end of the simulation, when Simulator::Destroy() is called.
966
   * All events scheduled to expire at "Destroy" time are scheduled FIFO, 
306
   * All events scheduled to expire at "Destroy" time are scheduled FIFO,
967
   * after all normal events have expired and only when 
307
   * after all normal events have expired and only when
968
   * Simulator::Destroy is invoked.
308
   * Simulator::Destroy is invoked.
969
   *
309
   *
970
   * @tparam MEM @deduced Class method function signature type.
310
   * @tparam Us @deduced Formal function argument types.
971
   * @tparam OBJ @deduced Class type of the object.
311
   * @tparam Ts @deduced Actual function argument types.
972
   * @param [in] mem_ptr Member method pointer to invoke
312
   * @param [in] args Arguments to pass to MakeEvent.
973
   * @param [in] obj The object on which to invoke the member method
974
   * @return The EventId of the scheduled event.
313
   * @return The EventId of the scheduled event.
975
   */
314
   */
976
  template <typename MEM, typename OBJ>
315
  template <typename... Ts>
977
  static EventId ScheduleDestroy (MEM mem_ptr, OBJ obj);
316
  static EventId ScheduleDestroy (Ts&&... args);
978
317
979
  /**
318
  /**
980
   * @see ScheduleDestroy(MEM,OBJ)
319
   * Schedule an event to run at the end of the simulation, when Simulator::Destroy() is called.
981
   * @tparam MEM @deduced Class method function signature type.
320
   * All events scheduled to expire at "Destroy" time are scheduled FIFO,
982
   * @tparam OBJ @deduced Class type of the object.
321
   * after all normal events have expired and only when
983
   * @tparam T1 @deduced Type of first argument.
322
   * Simulator::Destroy is invoked.
984
   * @param [in] mem_ptr Member method pointer to invoke
323
   *
985
   * @param [in] obj The object on which to invoke the member method
324
   * @tparam Us @deduced Formal function argument types.
986
   * @param [in] a1 The first argument to pass to the invoked method
325
   * @tparam Ts @deduced Actual function argument types.
326
   * @param [in] f The function to invoke.
327
   * @param [in] args Arguments to pass to MakeEvent.
987
   * @return The EventId of the scheduled event.
328
   * @return The EventId of the scheduled event.
988
   */
329
   */
989
  template <typename MEM, typename OBJ, 
330
  template <typename... Us, typename... Ts>
990
            typename T1>
331
  static EventId ScheduleDestroy (void (*f)(Us...), Ts&&... args);
991
  static EventId ScheduleDestroy (MEM mem_ptr, OBJ obj, T1 a1);
992
993
  /**
994
   * @see ScheduleDestroy(MEM,OBJ)
995
   * @tparam MEM @deduced Class method function signature type.
996
   * @tparam OBJ @deduced Class type of the object.
997
   * @tparam T1 @deduced Type of first argument.
998
   * @tparam T2 @deduced Type of second argument.
999
   * @param [in] mem_ptr Member method pointer to invoke
1000
   * @param [in] obj The object on which to invoke the member method
1001
   * @param [in] a1 The first argument to pass to the invoked method
1002
   * @param [in] a2 The second argument to pass to the invoked method
1003
   * @return The EventId of the scheduled event.
1004
   */
1005
  template <typename MEM, typename OBJ,
1006
            typename T1, typename T2>
1007
  static EventId ScheduleDestroy (MEM mem_ptr, OBJ obj, T1 a1, T2 a2);
1008
1009
  /**
1010
   * @see ScheduleDestroy(MEM,OBJ)
1011
   * @tparam MEM @deduced Class method function signature type.
1012
   * @tparam OBJ @deduced Class type of the object.
1013
   * @tparam T1 @deduced Type of first argument.
1014
   * @tparam T2 @deduced Type of second argument.
1015
   * @tparam T3 @deduced Type of third argument.
1016
   * @param [in] mem_ptr Member method pointer to invoke
1017
   * @param [in] obj The object on which to invoke the member method
1018
   * @param [in] a1 The first argument to pass to the invoked method
1019
   * @param [in] a2 The second argument to pass to the invoked method
1020
   * @param [in] a3 The third argument to pass to the invoked method
1021
   * @return The EventId of the scheduled event.
1022
   */
1023
  template <typename MEM, typename OBJ, 
1024
            typename T1, typename T2, typename T3>
1025
  static EventId ScheduleDestroy (MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3);
1026
1027
  /**
1028
   * @see ScheduleDestroy(MEM,OBJ)
1029
   * @tparam MEM @deduced Class method function signature type.
1030
   * @tparam OBJ @deduced Class type of the object.
1031
   * @tparam T1 @deduced Type of first argument.
1032
   * @tparam T2 @deduced Type of second argument.
1033
   * @tparam T3 @deduced Type of third argument.
1034
   * @tparam T4 @deduced Type of fourth argument.
1035
   * @param [in] mem_ptr Member method pointer to invoke
1036
   * @param [in] obj The object on which to invoke the member method
1037
   * @param [in] a1 The first argument to pass to the invoked method
1038
   * @param [in] a2 The second argument to pass to the invoked method
1039
   * @param [in] a3 The third argument to pass to the invoked method
1040
   * @param [in] a4 The fourth argument to pass to the invoked method
1041
   * @return The EventId of the scheduled event.
1042
   */
1043
  template <typename MEM, typename OBJ, 
1044
            typename T1, typename T2, typename T3, typename T4>
1045
  static EventId ScheduleDestroy (MEM mem_ptr, OBJ obj, 
1046
                                  T1 a1, T2 a2, T3 a3, T4 a4);
1047
  /**
1048
   * @see ScheduleDestroy(MEM,OBJ)
1049
   * @tparam MEM @deduced Class method function signature type.
1050
   * @tparam OBJ @deduced Class type of the object.
1051
   * @tparam T1 @deduced Type of first argument.
1052
   * @tparam T2 @deduced Type of second argument.
1053
   * @tparam T3 @deduced Type of third argument.
1054
   * @tparam T4 @deduced Type of fourth argument.
1055
   * @tparam T5 @deduced Type of fifth argument.
1056
   * @param [in] mem_ptr Member method pointer to invoke
1057
   * @param [in] obj The object on which to invoke the member method
1058
   * @param [in] a1 The first argument to pass to the invoked method
1059
   * @param [in] a2 The second argument to pass to the invoked method
1060
   * @param [in] a3 The third argument to pass to the invoked method
1061
   * @param [in] a4 The fourth argument to pass to the invoked method
1062
   * @param [in] a5 The fifth argument to pass to the invoked method
1063
   * @return The EventId of the scheduled event.
1064
   */
1065
  template <typename MEM, typename OBJ, 
1066
            typename T1, typename T2, typename T3, typename T4, typename T5>
1067
  static EventId ScheduleDestroy (MEM mem_ptr, OBJ obj, 
1068
                                  T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
1069
1070
  /**
1071
   * @param mem_ptr member method pointer to invoke
1072
   * @param obj the object on which to invoke the member method
1073
   * @param a1 the first argument to pass to the invoked method
1074
   * @param a2 the second argument to pass to the invoked method
1075
   * @param a3 the third argument to pass to the invoked method
1076
   * @param a4 the fourth argument to pass to the invoked method
1077
   * @param a5 the fifth argument to pass to the invoked method
1078
   * @param a6 the sixth argument to pass to the invoked method
1079
   * @return The EventId of the scheduled event.
1080
   */
1081
  template <typename MEM, typename OBJ, 
1082
            typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
1083
  static EventId ScheduleDestroy (MEM mem_ptr, OBJ obj, 
1084
                                  T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6);
1085
1086
  /**
1087
   * @copybrief ScheduleDestroy(MEM,OBJ)
1088
   * When Simulator::Destroy() is called, the
1089
   * function will be invoked with any supplied arguments.
1090
   * @param [in] f The function to invoke
1091
   * @return The EventId of the scheduled event.
1092
   */
1093
  static EventId ScheduleDestroy (void (*f)(void));
1094
1095
  /**
1096
   * @see ScheduleDestory((*)())
1097
   * @tparam U1 @deduced Formal type of the first argument to the function.
1098
   * @tparam T1 @deduced Actual type of the first argument.
1099
   * @param [in] f The function to invoke
1100
   * @param [in] a1 The first argument to pass to the function to invoke
1101
   * @return The EventId of the scheduled event.
1102
   */
1103
  template <typename U1,
1104
            typename T1>
1105
  static EventId ScheduleDestroy (void (*f)(U1), T1 a1);
1106
1107
  /**
1108
   * @see ScheduleDestory((*)())
1109
   * @tparam U1 @deduced Formal type of the first argument to the function.
1110
   * @tparam U2 @deduced Formal type of the second argument to the function.
1111
   * @tparam T1 @deduced Actual type of the first argument.
1112
   * @tparam T2 @deduced Actual type of the second argument.
1113
   * @param [in] f The function to invoke
1114
   * @param [in] a1 The first argument to pass to the function to invoke
1115
   * @param [in] a2 The second argument to pass to the function to invoke
1116
   * @return The EventId of the scheduled event.
1117
   */
1118
  template <typename U1, typename U2,
1119
            typename T1, typename T2>
1120
  static EventId ScheduleDestroy (void (*f)(U1,U2), T1 a1, T2 a2);
1121
1122
  /**
1123
   * @see ScheduleDestory((*)())
1124
   * @tparam U1 @deduced Formal type of the first argument to the function.
1125
   * @tparam U2 @deduced Formal type of the second argument to the function.
1126
   * @tparam U3 @deduced Formal type of the third argument to the function.
1127
   * @tparam T1 @deduced Actual type of the first argument.
1128
   * @tparam T2 @deduced Actual type of the second argument.
1129
   * @tparam T3 @deduced Actual type of the third argument.
1130
   * @param [in] f The function to invoke
1131
   * @param [in] a1 The first argument to pass to the function to invoke
1132
   * @param [in] a2 The second argument to pass to the function to invoke
1133
   * @param [in] a3 The third argument to pass to the function to invoke
1134
   * @return The EventId of the scheduled event.
1135
   */
1136
  template <typename U1, typename U2, typename U3,
1137
            typename T1, typename T2, typename T3>
1138
  static EventId ScheduleDestroy (void (*f)(U1,U2,U3), T1 a1, T2 a2, T3 a3);
1139
1140
  /**
1141
   * @see ScheduleDestory((*)())
1142
   * @tparam U1 @deduced Formal type of the first argument to the function.
1143
   * @tparam U2 @deduced Formal type of the second argument to the function.
1144
   * @tparam U3 @deduced Formal type of the third argument to the function.
1145
   * @tparam U4 @deduced Formal type of the fourth argument to the function.
1146
   * @tparam T1 @deduced Actual type of the first argument.
1147
   * @tparam T2 @deduced Actual type of the second argument.
1148
   * @tparam T3 @deduced Actual type of the third argument.
1149
   * @tparam T4 @deduced Actual type of the fourth argument.
1150
   * @param [in] f The function to invoke
1151
   * @param [in] a1 The first argument to pass to the function to invoke
1152
   * @param [in] a2 The second argument to pass to the function to invoke
1153
   * @param [in] a3 The third argument to pass to the function to invoke
1154
   * @param [in] a4 The fourth argument to pass to the function to invoke
1155
   * @return The EventId of the scheduled event.
1156
   */
1157
  template <typename U1, typename U2, typename U3, typename U4,
1158
            typename T1, typename T2, typename T3, typename T4>
1159
  static EventId ScheduleDestroy (void (*f)(U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4);
1160
1161
  /**
1162
   * @see ScheduleDestory((*)())
1163
   * @tparam U1 @deduced Formal type of the first argument to the function.
1164
   * @tparam U2 @deduced Formal type of the second argument to the function.
1165
   * @tparam U3 @deduced Formal type of the third argument to the function.
1166
   * @tparam U4 @deduced Formal type of the fourth argument to the function.
1167
   * @tparam U5 @deduced Formal type of the fifth argument to the function.
1168
   * @tparam T1 @deduced Actual type of the first argument.
1169
   * @tparam T2 @deduced Actual type of the second argument.
1170
   * @tparam T3 @deduced Actual type of the third argument.
1171
   * @tparam T4 @deduced Actual type of the fourth argument.
1172
   * @tparam T5 @deduced Actual type of the fifth argument.
1173
   * @param [in] f The function to invoke
1174
   * @param [in] a1 The first argument to pass to the function to invoke
1175
   * @param [in] a2 The second argument to pass to the function to invoke
1176
   * @param [in] a3 The third argument to pass to the function to invoke
1177
   * @param [in] a4 The fourth argument to pass to the function to invoke
1178
   * @param [in] a5 The fifth argument to pass to the function to invoke
1179
   * @return The EventId of the scheduled event.
1180
   */
1181
  template <typename U1, typename U2, typename U3, typename U4, typename U5,
1182
            typename T1, typename T2, typename T3, typename T4, typename T5>
1183
  static EventId ScheduleDestroy (void (*f)(U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
1184
1185
  /**
1186
   * @param f the function to invoke
1187
   * @param a1 the first argument to pass to the function to invoke
1188
   * @param a2 the second argument to pass to the function to invoke
1189
   * @param a3 the third argument to pass to the function to invoke
1190
   * @param a4 the fourth argument to pass to the function to invoke
1191
   * @param a5 the fifth argument to pass to the function to invoke
1192
   * @param a6 the sixth argument to pass to the function to invoke
1193
   * @return The EventId of the scheduled event.
1194
   */
1195
  template <typename U1, typename U2, typename U3, typename U4, typename U5, typename U6,
1196
            typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
1197
  static EventId ScheduleDestroy (void (*f)(U1,U2,U3,U4,U5,U6), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6);
1198
1199
  /** @} */
332
  /** @} */
1200
333
1201
  /**
334
  /**
 Lines 1367-1771    Link Here 
1367
500
1368
namespace ns3 {
501
namespace ns3 {
1369
502
1370
template <typename MEM, typename OBJ>
503
template <typename... Ts>
1371
EventId Simulator::Schedule (Time const &delay, MEM mem_ptr, OBJ obj) 
504
EventId Simulator::Schedule (Time const &delay, Ts&&... args)
1372
{
505
{
1373
  return DoSchedule (delay, MakeEvent (mem_ptr, obj));
506
  return DoSchedule (delay, MakeEvent (std::forward<Ts> (args)...));
1374
}
507
}
1375
508
1376
509
template <typename... Us, typename... Ts>
1377
template <typename MEM, typename OBJ,
510
EventId Simulator::Schedule (Time const &delay, void (*f)(Us...), Ts&&... args)
1378
          typename T1>
1379
EventId Simulator::Schedule (Time const &delay, MEM mem_ptr, OBJ obj, T1 a1) 
1380
{
511
{
1381
  return DoSchedule (delay, MakeEvent (mem_ptr, obj, a1));
512
  return DoSchedule (delay, MakeEvent (f, std::forward<Ts> (args)...));
1382
}
513
}
1383
514
1384
template <typename MEM, typename OBJ, 
515
template <typename... Ts>
1385
          typename T1, typename T2>
516
void Simulator::ScheduleWithContext (uint32_t context, Time const &delay, Ts&&... args)
1386
EventId Simulator::Schedule (Time const &delay, MEM mem_ptr, OBJ obj, T1 a1, T2 a2)
1387
{
517
{
1388
  return DoSchedule (delay, MakeEvent (mem_ptr, obj, a1, a2));
518
  return ScheduleWithContext (context, delay, MakeEvent (std::forward<Ts> (args)...));
1389
}
519
}
1390
520
1391
template <typename MEM, typename OBJ,
521
template <typename... Us, typename... Ts>
1392
          typename T1, typename T2, typename T3>
522
void Simulator::ScheduleWithContext (uint32_t context, Time const &delay, void (*f)(Us...), Ts&&... args)
1393
EventId Simulator::Schedule (Time const &delay, MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3) 
1394
{
523
{
1395
  return DoSchedule (delay, MakeEvent (mem_ptr, obj, a1, a2, a3));
524
  return ScheduleWithContext (context, delay, MakeEvent (f, std::forward<Ts> (args)...));
1396
}
525
}
1397
526
1398
template <typename MEM, typename OBJ, 
527
template <typename... Ts>
1399
          typename T1, typename T2, typename T3, typename T4>
528
EventId
1400
EventId Simulator::Schedule (Time const &delay, MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4) 
529
Simulator::ScheduleNow (Ts&&... args)
1401
{
530
{
1402
  return DoSchedule (delay, MakeEvent (mem_ptr, obj, a1, a2, a3, a4));
531
  return DoScheduleNow (MakeEvent (std::forward<Ts> (args)...));
1403
}
532
}
1404
533
1405
template <typename MEM, typename OBJ, 
534
template <typename... Us, typename... Ts>
1406
          typename T1, typename T2, typename T3, typename T4, typename T5>
535
EventId
1407
EventId Simulator::Schedule (Time const &delay, MEM mem_ptr, OBJ obj, 
536
Simulator::ScheduleNow (void (*f)(Us...), Ts&&... args)
1408
                             T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) 
1409
{
537
{
1410
  return DoSchedule (delay, MakeEvent (mem_ptr, obj, a1, a2, a3, a4, a5));
538
  return DoScheduleNow (MakeEvent (f, std::forward<Ts> (args)...));
1411
}
539
}
1412
540
1413
template <typename MEM, typename OBJ, 
541
template <typename... Ts>
1414
          typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
542
EventId
1415
EventId Simulator::Schedule (Time const &time, MEM mem_ptr, OBJ obj, 
543
Simulator::ScheduleDestroy (Ts&&... args)
1416
                             T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) 
1417
{
544
{
1418
  return DoSchedule (time, MakeEvent (mem_ptr, obj, a1, a2, a3, a4, a5, a6));
545
  return DoScheduleDestroy (MakeEvent (std::forward<Ts> (args)...));
1419
}
546
}
1420
547
1421
template <typename U1,
548
template <typename... Us, typename... Ts>
1422
          typename T1>
549
EventId
1423
EventId Simulator::Schedule (Time const &delay, void (*f)(U1), T1 a1)
550
Simulator::ScheduleDestroy (void (*f)(Us...), Ts&&... args)
1424
{
551
{
1425
  return DoSchedule (delay, MakeEvent (f, a1));
552
  return DoScheduleDestroy (MakeEvent (f, std::forward<Ts> (args)...));
1426
}
1427
1428
template <typename U1, typename U2, 
1429
          typename T1, typename T2>
1430
EventId Simulator::Schedule (Time const &delay, void (*f)(U1,U2), T1 a1, T2 a2)
1431
{
1432
  return DoSchedule (delay, MakeEvent (f, a1, a2));
1433
}
1434
1435
template <typename U1, typename U2, typename U3,
1436
          typename T1, typename T2, typename T3>
1437
EventId Simulator::Schedule (Time const &delay, void (*f)(U1,U2,U3), T1 a1, T2 a2, T3 a3)
1438
{
1439
  return DoSchedule (delay, MakeEvent (f, a1, a2, a3));
1440
}
1441
1442
template <typename U1, typename U2, typename U3, typename U4,
1443
          typename T1, typename T2, typename T3, typename T4>
1444
EventId Simulator::Schedule (Time const &delay, void (*f)(U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4)
1445
{
1446
  return DoSchedule (delay, MakeEvent (f, a1, a2, a3, a4));
1447
}
1448
1449
template <typename U1, typename U2, typename U3, typename U4, typename U5,
1450
          typename T1, typename T2, typename T3, typename T4, typename T5>
1451
EventId Simulator::Schedule (Time const &delay, void (*f)(U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
1452
{
1453
  return DoSchedule (delay, MakeEvent (f, a1, a2, a3, a4, a5));
1454
}
1455
1456
template <typename U1, typename U2, typename U3, typename U4, typename U5, typename U6,
1457
          typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
1458
EventId Simulator::Schedule (Time const &time, void (*f)(U1,U2,U3,U4,U5,U6), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6)
1459
{
1460
  return DoSchedule (time, MakeEvent (f, a1, a2, a3, a4, a5, a6));
1461
}
1462
1463
1464
template <typename MEM, typename OBJ>
1465
void Simulator::ScheduleWithContext (uint32_t context, Time const &delay, MEM mem_ptr, OBJ obj)
1466
{
1467
  ScheduleWithContext (context, delay, MakeEvent (mem_ptr, obj));
1468
}
1469
1470
1471
template <typename MEM, typename OBJ,
1472
          typename T1>
1473
void Simulator::ScheduleWithContext (uint32_t context, Time const &delay, MEM mem_ptr, OBJ obj, T1 a1)
1474
{
1475
  return ScheduleWithContext (context, delay, MakeEvent (mem_ptr, obj, a1));
1476
}
1477
1478
template <typename MEM, typename OBJ,
1479
          typename T1, typename T2>
1480
void Simulator::ScheduleWithContext (uint32_t context, Time const &delay, MEM mem_ptr, OBJ obj, T1 a1, T2 a2)
1481
{
1482
  return ScheduleWithContext (context, delay, MakeEvent (mem_ptr, obj, a1, a2));
1483
}
1484
1485
template <typename MEM, typename OBJ,
1486
          typename T1, typename T2, typename T3>
1487
void Simulator::ScheduleWithContext (uint32_t context, Time const &delay, MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3)
1488
{
1489
  return ScheduleWithContext (context, delay, MakeEvent (mem_ptr, obj, a1, a2, a3));
1490
}
1491
1492
template <typename MEM, typename OBJ,
1493
          typename T1, typename T2, typename T3, typename T4>
1494
void Simulator::ScheduleWithContext (uint32_t context, Time const &delay, MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4)
1495
{
1496
  return ScheduleWithContext (context, delay, MakeEvent (mem_ptr, obj, a1, a2, a3, a4));
1497
}
1498
1499
template <typename MEM, typename OBJ,
1500
          typename T1, typename T2, typename T3, typename T4, typename T5>
1501
void Simulator::ScheduleWithContext (uint32_t context, Time const &delay, MEM mem_ptr, OBJ obj,
1502
                                     T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
1503
{
1504
  return ScheduleWithContext (context, delay, MakeEvent (mem_ptr, obj, a1, a2, a3, a4, a5));
1505
}
1506
1507
template <typename MEM, typename OBJ,
1508
          typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
1509
void Simulator::ScheduleWithContext (uint32_t context, Time const &time, MEM mem_ptr, OBJ obj,
1510
                                     T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6)
1511
{
1512
  return ScheduleWithContext (context, time, MakeEvent (mem_ptr, obj, a1, a2, a3, a4, a5, a6));
1513
}
1514
1515
template <typename U1,
1516
          typename T1>
1517
void Simulator::ScheduleWithContext (uint32_t context, Time const &delay, void (*f)(U1), T1 a1)
1518
{
1519
  return ScheduleWithContext (context, delay, MakeEvent (f, a1));
1520
}
1521
1522
template <typename U1, typename U2,
1523
          typename T1, typename T2>
1524
void Simulator::ScheduleWithContext (uint32_t context, Time const &delay, void (*f)(U1,U2), T1 a1, T2 a2)
1525
{
1526
  return ScheduleWithContext (context, delay, MakeEvent (f, a1, a2));
1527
}
1528
1529
template <typename U1, typename U2, typename U3,
1530
          typename T1, typename T2, typename T3>
1531
void Simulator::ScheduleWithContext (uint32_t context, Time const &delay, void (*f)(U1,U2,U3), T1 a1, T2 a2, T3 a3)
1532
{
1533
  return ScheduleWithContext (context, delay, MakeEvent (f, a1, a2, a3));
1534
}
1535
1536
template <typename U1, typename U2, typename U3, typename U4,
1537
          typename T1, typename T2, typename T3, typename T4>
1538
void Simulator::ScheduleWithContext (uint32_t context, Time const &delay, void (*f)(U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4)
1539
{
1540
  return ScheduleWithContext (context, delay, MakeEvent (f, a1, a2, a3, a4));
1541
}
1542
1543
template <typename U1, typename U2, typename U3, typename U4, typename U5,
1544
          typename T1, typename T2, typename T3, typename T4, typename T5>
1545
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)
1546
{
1547
  return ScheduleWithContext (context, delay, MakeEvent (f, a1, a2, a3, a4, a5));
1548
}
1549
1550
template <typename U1, typename U2, typename U3, typename U4, typename U5, typename U6,
1551
          typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
1552
void Simulator::ScheduleWithContext (uint32_t context, Time const &time, void (*f)(U1,U2,U3,U4,U5,U6), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6)
1553
{
1554
  return ScheduleWithContext (context, time, MakeEvent (f, a1, a2, a3, a4, a5, a6));
1555
}
1556
1557
1558
template <typename MEM, typename OBJ>
1559
EventId
1560
Simulator::ScheduleNow (MEM mem_ptr, OBJ obj) 
1561
{
1562
  return DoScheduleNow (MakeEvent (mem_ptr, obj));
1563
}
1564
1565
1566
template <typename MEM, typename OBJ, 
1567
          typename T1>
1568
EventId
1569
Simulator::ScheduleNow (MEM mem_ptr, OBJ obj, T1 a1) 
1570
{
1571
  return DoScheduleNow (MakeEvent (mem_ptr, obj, a1));
1572
}
1573
1574
template <typename MEM, typename OBJ, 
1575
          typename T1, typename T2>
1576
EventId
1577
Simulator::ScheduleNow (MEM mem_ptr, OBJ obj, T1 a1, T2 a2) 
1578
{
1579
  return DoScheduleNow (MakeEvent (mem_ptr, obj, a1, a2));
1580
}
1581
1582
template <typename MEM, typename OBJ, 
1583
          typename T1, typename T2, typename T3>
1584
EventId
1585
Simulator::ScheduleNow (MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3) 
1586
{
1587
  return DoScheduleNow (MakeEvent (mem_ptr, obj, a1, a2, a3));
1588
}
1589
1590
template <typename MEM, typename OBJ, 
1591
          typename T1, typename T2, typename T3, typename T4>
1592
EventId
1593
Simulator::ScheduleNow (MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4) 
1594
{
1595
  return DoScheduleNow (MakeEvent (mem_ptr, obj, a1, a2, a3, a4));
1596
}
1597
1598
template <typename MEM, typename OBJ, 
1599
          typename T1, typename T2, typename T3, typename T4, typename T5>
1600
EventId
1601
Simulator::ScheduleNow (MEM mem_ptr, OBJ obj, 
1602
                        T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) 
1603
{
1604
  return DoScheduleNow (MakeEvent (mem_ptr, obj, a1, a2, a3, a4, a5));
1605
}
1606
1607
template <typename MEM, typename OBJ, 
1608
          typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
1609
EventId
1610
Simulator::ScheduleNow (MEM mem_ptr, OBJ obj, 
1611
                        T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) 
1612
{
1613
  return DoScheduleNow (MakeEvent (mem_ptr, obj, a1, a2, a3, a4, a5, a6));
1614
}
1615
1616
template <typename U1,
1617
          typename T1>
1618
EventId
1619
Simulator::ScheduleNow (void (*f)(U1), T1 a1)
1620
{
1621
  return DoScheduleNow (MakeEvent (f, a1));
1622
}
1623
1624
template <typename U1, typename U2,
1625
          typename T1, typename T2>
1626
EventId
1627
Simulator::ScheduleNow (void (*f)(U1,U2), T1 a1, T2 a2)
1628
{
1629
  return DoScheduleNow (MakeEvent (f, a1, a2));
1630
}
1631
1632
template <typename U1, typename U2, typename U3,
1633
          typename T1, typename T2, typename T3>
1634
EventId
1635
Simulator::ScheduleNow (void (*f)(U1,U2,U3), T1 a1, T2 a2, T3 a3)
1636
{
1637
  return DoScheduleNow (MakeEvent (f, a1, a2, a3));
1638
}
1639
1640
template <typename U1, typename U2, typename U3, typename U4,
1641
          typename T1, typename T2, typename T3, typename T4>
1642
EventId
1643
Simulator::ScheduleNow (void (*f)(U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4)
1644
{
1645
  return DoScheduleNow (MakeEvent (f, a1, a2, a3, a4));
1646
}
1647
1648
template <typename U1, typename U2, typename U3, typename U4, typename U5,
1649
          typename T1, typename T2, typename T3, typename T4, typename T5>
1650
EventId
1651
Simulator::ScheduleNow (void (*f)(U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
1652
{
1653
  return DoScheduleNow (MakeEvent (f, a1, a2, a3, a4, a5));
1654
}
1655
1656
template <typename U1, typename U2, typename U3, typename U4, typename U5, typename U6,
1657
          typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
1658
EventId
1659
Simulator::ScheduleNow (void (*f)(U1,U2,U3,U4,U5,U6), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6)
1660
{
1661
  return DoScheduleNow (MakeEvent (f, a1, a2, a3, a4, a5, a6));
1662
}
1663
1664
1665
template <typename MEM, typename OBJ>
1666
EventId
1667
Simulator::ScheduleDestroy (MEM mem_ptr, OBJ obj) 
1668
{
1669
  return DoScheduleDestroy (MakeEvent (mem_ptr, obj));
1670
}
1671
1672
1673
template <typename MEM, typename OBJ, 
1674
          typename T1>
1675
EventId
1676
Simulator::ScheduleDestroy (MEM mem_ptr, OBJ obj, T1 a1) 
1677
{
1678
  return DoScheduleDestroy (MakeEvent (mem_ptr, obj, a1));
1679
}
1680
1681
template <typename MEM, typename OBJ, 
1682
          typename T1, typename T2>
1683
EventId
1684
Simulator::ScheduleDestroy (MEM mem_ptr, OBJ obj, T1 a1, T2 a2) 
1685
{
1686
  return DoScheduleDestroy (MakeEvent (mem_ptr, obj, a1, a2));
1687
}
1688
1689
template <typename MEM, typename OBJ, 
1690
          typename T1, typename T2, typename T3>
1691
EventId
1692
Simulator::ScheduleDestroy (MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3) 
1693
{
1694
  return DoScheduleDestroy (MakeEvent (mem_ptr, obj, a1, a2, a3));
1695
}
1696
1697
template <typename MEM, typename OBJ,
1698
          typename T1, typename T2, typename T3, typename T4>
1699
EventId
1700
Simulator::ScheduleDestroy (MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4) 
1701
{
1702
  return DoScheduleDestroy (MakeEvent (mem_ptr, obj, a1, a2, a3, a4));
1703
}
1704
1705
template <typename MEM, typename OBJ, 
1706
          typename T1, typename T2, typename T3, typename T4, typename T5>
1707
EventId
1708
Simulator::ScheduleDestroy (MEM mem_ptr, OBJ obj, 
1709
                            T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) 
1710
{
1711
  return DoScheduleDestroy (MakeEvent (mem_ptr, obj, a1, a2, a3, a4, a5));
1712
}
1713
1714
template <typename MEM, typename OBJ, 
1715
          typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
1716
EventId
1717
Simulator::ScheduleDestroy (MEM mem_ptr, OBJ obj, 
1718
                            T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) 
1719
{
1720
  return DoScheduleDestroy (MakeEvent (mem_ptr, obj, a1, a2, a3, a4, a5, a6));
1721
}
1722
1723
template <typename U1,
1724
          typename T1>
1725
EventId
1726
Simulator::ScheduleDestroy (void (*f)(U1), T1 a1)
1727
{
1728
  return DoScheduleDestroy (MakeEvent (f, a1));
1729
}
1730
1731
template <typename U1, typename U2,
1732
          typename T1, typename T2>
1733
EventId
1734
Simulator::ScheduleDestroy (void (*f)(U1,U2), T1 a1, T2 a2)
1735
{
1736
  return DoScheduleDestroy (MakeEvent (f, a1, a2));
1737
}
1738
1739
template <typename U1, typename U2, typename U3,
1740
          typename T1, typename T2, typename T3>
1741
EventId
1742
Simulator::ScheduleDestroy (void (*f)(U1,U2,U3), T1 a1, T2 a2, T3 a3)
1743
{
1744
  return DoScheduleDestroy (MakeEvent (f, a1, a2, a3));
1745
}
1746
1747
template <typename U1, typename U2, typename U3, typename U4,
1748
          typename T1, typename T2, typename T3, typename T4>
1749
EventId
1750
Simulator::ScheduleDestroy (void (*f)(U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4)
1751
{
1752
  return DoScheduleDestroy (MakeEvent (f, a1, a2, a3, a4));
1753
}
1754
1755
template <typename U1, typename U2, typename U3, typename U4, typename U5,
1756
          typename T1, typename T2, typename T3, typename T4, typename T5>
1757
EventId
1758
Simulator::ScheduleDestroy (void (*f)(U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
1759
{
1760
  return DoScheduleDestroy (MakeEvent (f, a1, a2, a3, a4, a5));
1761
}
1762
1763
template <typename U1, typename U2, typename U3, typename U4, typename U5, typename U6,
1764
          typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
1765
EventId
1766
Simulator::ScheduleDestroy (void (*f)(U1,U2,U3,U4,U5,U6), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6)
1767
{
1768
  return DoScheduleDestroy (MakeEvent (f, a1, a2, a3, a4, a5, a6));
1769
}
553
}
1770
554
1771
} // namespace ns3
555
} // namespace ns3
(-)a/src/core/model/timer-impl.h (-4 / +4 lines)
 Lines 28-34    Link Here 
28
28
29
/**
29
/**
30
 * \file
30
 * \file
31
 * \ingroup timer
31
 * \ingroup vttimer
32
 * \ingroup timerimpl
32
 * \ingroup timerimpl
33
 * ns3::TimerImpl declaration and implementation.
33
 * ns3::TimerImpl declaration and implementation.
34
 */
34
 */
 Lines 36-42    Link Here 
36
namespace ns3 {
36
namespace ns3 {
37
37
38
/**
38
/**
39
 * \ingroup timer
39
 * \ingroup vttimer
40
 * The timer implementation underlying Timer and Watchdog.
40
 * The timer implementation underlying Timer and Watchdog.
41
 */
41
 */
42
class TimerImpl
42
class TimerImpl
 Lines 143-149    Link Here 
143
namespace ns3 {
143
namespace ns3 {
144
144
145
/**
145
/**
146
 * \ingroup timer
146
 * \ingroup vttimer
147
 * \defgroup timerimpl TimerImpl Implementation
147
 * \defgroup timerimpl TimerImpl Implementation
148
 * @{
148
 * @{
149
 */
149
 */
 Lines 962-968    Link Here 
962
  return function;
962
  return function;
963
}
963
}
964
964
965
/**@}*/  // \ingroup timer
965
/**@}*/  // \ingroup vttimer
966
966
967
  
967
  
968
/********************************************************************
968
/********************************************************************
(-)a/src/core/model/timer.cc (-1 / +1 lines)
 Lines 24-30    Link Here 
24
24
25
/**
25
/**
26
 * \file
26
 * \file
27
 * \ingroup timer
27
 * \ingroup vttimer
28
 * ns3::Timer implementation.
28
 * ns3::Timer implementation.
29
 */
29
 */
30
30
(-)a/src/core/model/timer.h (-121 / +13 lines)
 Lines 27-33    Link Here 
27
27
28
/**
28
/**
29
 * \file
29
 * \file
30
 * \ingroup timer
30
 * \ingroup vttimer
31
 * ns3::Timer class declaration.
31
 * ns3::Timer class declaration.
32
 */
32
 */
33
33
 Lines 35-41    Link Here 
35
35
36
/**
36
/**
37
 * \ingroup core
37
 * \ingroup core
38
 * \defgroup timer Virtual Time Timer and Watchdog
38
 * \defgroup vttimer Virtual Time Timer and Watchdog
39
 *
39
 *
40
 * The Timer and Watchdog objects both facilitate scheduling functions
40
 * The Timer and Watchdog objects both facilitate scheduling functions
41
 * to execute a specified virtual time in the future.
41
 * to execute a specified virtual time in the future.
 Lines 53-68    Link Here 
53
class TimerImpl;
53
class TimerImpl;
54
54
55
/**
55
/**
56
 * \ingroup timer
56
 * \ingroup vttimer
57
 * \brief A simple Timer class
57
 * \brief A simple virtual Timer class
58
 *
58
 *
59
 * A timer is used to hold together a delay, a function to invoke
59
 * A (virtual time) timer is used to hold together a delay, a function to invoke
60
 * when the delay expires, and a set of arguments to pass to the function
60
 * when the delay expires, and a set of arguments to pass to the function
61
 * when the delay expires.
61
 * when the delay expires.
62
 *
62
 *
63
 * A Timer can be suspended, resumed, cancelled and queried for the
63
 * A Timer can be suspended, resumed, cancelled and queried for the
64
 * time left, but it can't be extended (except by suspending and
64
 * time left, but it can't be extended (except by suspending and
65
 * resuming.)
65
 * resuming).
66
 *
66
 *
67
 * A timer can also be used to enforce a set of predefined event lifetime
67
 * A timer can also be used to enforce a set of predefined event lifetime
68
 * management policies. These policies are specified at construction time
68
 * management policies. These policies are specified at construction time
 Lines 134-195    Link Here 
134
134
135
135
136
  /**
136
  /**
137
   * \param [in] a1 the first argument
137
   * \tparam Ts \deduced Argument types.
138
   *
138
   * \param [in] args arguments
139
   * Store this argument in this Timer for later use by Timer::Schedule.
140
   */
141
  template <typename T1>
142
  void SetArguments (T1 a1);
143
  /**
144
   * \param [in] a1 the first argument
145
   * \param [in] a2 the second argument
146
   *
139
   *
147
   * Store these arguments in this Timer for later use by Timer::Schedule.
140
   * Store these arguments in this Timer for later use by Timer::Schedule.
148
   */
141
   */
149
  template <typename T1, typename T2>
142
  template <typename... Ts>
150
  void SetArguments (T1 a1, T2 a2);
143
  void SetArguments (Ts... args);
151
  /**
152
   * \param [in] a1 the first argument
153
   * \param [in] a2 the second argument
154
   * \param [in] a3 the third argument
155
   *
156
   * Store these arguments in this Timer for later use by Timer::Schedule.
157
   */
158
  template <typename T1, typename T2, typename T3>
159
  void SetArguments (T1 a1, T2 a2, T3 a3);
160
  /**
161
   * \param [in] a1 the first argument
162
   * \param [in] a2 the second argument
163
   * \param [in] a3 the third argument
164
   * \param [in] a4 the fourth argument
165
   *
166
   * Store these arguments in this Timer for later use by Timer::Schedule.
167
   */
168
  template <typename T1, typename T2, typename T3, typename T4>
169
  void SetArguments (T1 a1, T2 a2, T3 a3, T4 a4);
170
  /**
171
   * \param [in] a1 the first argument
172
   * \param [in] a2 the second argument
173
   * \param [in] a3 the third argument
174
   * \param [in] a4 the fourth argument
175
   * \param [in] a5 the fifth argument
176
   *
177
   * Store these arguments in this Timer for later use by Timer::Schedule.
178
   */
179
  template <typename T1, typename T2, typename T3, typename T4, typename T5>
180
  void SetArguments (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
181
  /**
182
   * \param [in] a1 the first argument
183
   * \param [in] a2 the second argument
184
   * \param [in] a3 the third argument
185
   * \param [in] a4 the fourth argument
186
   * \param [in] a5 the fifth argument
187
   * \param [in] a6 the sixth argument
188
   *
189
   * Store these arguments in this Timer for later use by Timer::Schedule.
190
   */
191
  template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
192
  void SetArguments (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6);
193
144
194
  /**
145
  /**
195
   * \param [in] delay The delay
146
   * \param [in] delay The delay
 Lines 319-393    Link Here 
319
  m_impl = MakeTimerImpl (memPtr, objPtr);
270
  m_impl = MakeTimerImpl (memPtr, objPtr);
320
}
271
}
321
272
322
template <typename T1>
273
template <typename... Ts>
323
void
274
void
324
Timer::SetArguments (T1 a1)
275
Timer::SetArguments (Ts... args)
325
{
276
{
326
  if (m_impl == 0)
277
  if (m_impl == 0)
327
    {
278
    {
328
      NS_FATAL_ERROR ("You cannot set the arguments of a Timer before setting its function.");
279
      NS_FATAL_ERROR ("You cannot set the arguments of a Timer before setting its function.");
329
      return;
280
      return;
330
    }
281
    }
331
  m_impl->SetArgs (a1);
282
  m_impl->SetArgs (args...);
332
}
333
template <typename T1, typename T2>
334
void
335
Timer::SetArguments (T1 a1, T2 a2)
336
{
337
  if (m_impl == 0)
338
    {
339
      NS_FATAL_ERROR ("You cannot set the arguments of a Timer before setting its function.");
340
      return;
341
    }
342
  m_impl->SetArgs (a1, a2);
343
}
344
345
template <typename T1, typename T2, typename T3>
346
void
347
Timer::SetArguments (T1 a1, T2 a2, T3 a3)
348
{
349
  if (m_impl == 0)
350
    {
351
      NS_FATAL_ERROR ("You cannot set the arguments of a Timer before setting its function.");
352
      return;
353
    }
354
  m_impl->SetArgs (a1, a2, a3);
355
}
356
357
template <typename T1, typename T2, typename T3, typename T4>
358
void
359
Timer::SetArguments (T1 a1, T2 a2, T3 a3, T4 a4)
360
{
361
  if (m_impl == 0)
362
    {
363
      NS_FATAL_ERROR ("You cannot set the arguments of a Timer before setting its function.");
364
      return;
365
    }
366
  m_impl->SetArgs (a1, a2, a3, a4);
367
}
368
369
template <typename T1, typename T2, typename T3, typename T4, typename T5>
370
void
371
Timer::SetArguments (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
372
{
373
  if (m_impl == 0)
374
    {
375
      NS_FATAL_ERROR ("You cannot set the arguments of a Timer before setting its function.");
376
      return;
377
    }
378
  m_impl->SetArgs (a1, a2, a3, a4, a5);
379
}
380
381
template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
382
void
383
Timer::SetArguments (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6)
384
{
385
  if (m_impl == 0)
386
    {
387
      NS_FATAL_ERROR ("You cannot set the arguments of a Timer before setting its function.");
388
      return;
389
    }
390
  m_impl->SetArgs (a1, a2, a3, a4, a5, a6);
391
}
283
}
392
284
393
} // namespace ns3
285
} // namespace ns3
(-)a/src/core/model/traced-callback.h (-276 / +28 lines)
 Lines 36-64    Link Here 
36
 * \ingroup tracing
36
 * \ingroup tracing
37
 * \brief Forward calls to a chain of Callback
37
 * \brief Forward calls to a chain of Callback
38
 *
38
 *
39
 * An TracedCallback has almost exactly the same API as a normal
39
 * A TracedCallback has almost exactly the same API as a normal
40
 * Callback but instead of forwarding calls to a single function
40
 * Callback but instead of forwarding calls to a single function
41
 * (as a Callback normally does), it forwards calls to a chain
41
 * (as a Callback normally does), it forwards calls to a chain
42
 * of Callback.  Connect adds a Callback at the end of the chain
42
 * of Callback.  Connect adds a Callback at the end of the chain
43
 * of callbacks.  Disconnect removes a Callback from the chain of callbacks.
43
 * of callbacks.  Disconnect removes a Callback from the chain of callbacks.
44
 *
44
 *
45
 * This is a functor: the chain of Callbacks is invoked by
45
 * This is a functor: the chain of Callbacks is invoked by
46
 * calling one of the \c operator() forms with the appropriate
46
 * calling the \c operator() form with the appropriate
47
 * number of arguments.
47
 * number of arguments.
48
 *
48
 *
49
 * \tparam T1 \explicit Type of the first argument to the functor.
49
 * \tparam Ts \explicit Types of the functor arguments.
50
 * \tparam T2 \explicit Type of the second argument to the functor.
51
 * \tparam T3 \explicit Type of the third argument to the functor.
52
 * \tparam T4 \explicit Type of the fourth argument to the functor.
53
 * \tparam T5 \explicit Type of the fifth argument to the functor.
54
 * \tparam T6 \explicit Type of the sixth argument to the functor.
55
 * \tparam T7 \explicit Type of the seventh argument to the functor.
56
 * \tparam T8 \explicit Type of the eighth argument to the functor.
57
 */
50
 */
58
template<typename T1 = empty, typename T2 = empty, 
51
template<typename... Ts>
59
         typename T3 = empty, typename T4 = empty,
60
         typename T5 = empty, typename T6 = empty,
61
         typename T7 = empty, typename T8 = empty>
62
class TracedCallback 
52
class TracedCallback 
63
{
53
{
64
public:
54
public:
 Lines 94-213    Link Here 
94
   */
84
   */
95
  void Disconnect (const CallbackBase & callback, std::string path);
85
  void Disconnect (const CallbackBase & callback, std::string path);
96
  /**
86
  /**
97
   * \name Functors taking various numbers of arguments.
87
   * \brief Functor which invokes the chain of Callbacks.
98
   *
88
   * \tparam Ts \deduced Types of the functor arguments.
99
   * The version selected is determined by the number of arguments
89
   * \param [in] args The arguments to the functor.
100
   * at the point where the Callback is invoked in the class
101
   * which fires the Callback.
102
   */
90
   */
103
  /**@{*/
91
  void operator() (Ts... args) const;
104
  /** Functor which invokes the chain of Callbacks. */
105
  void operator() (void) const;
106
  /**
107
   * \copybrief operator()()
108
   * \tparam T1 \deduced Type of the first argument to the functor.
109
   * \param [in] a1 The first argument to the functor.
110
   */
111
  void operator() (T1 a1) const;
112
  /**
113
   * \copybrief operator()()
114
   * \tparam T1 \deduced Type of the first argument to the functor.
115
   * \tparam T2 \deduced Type of the second argument to the functor.
116
   * \param [in] a1 The first argument to the functor.
117
   * \param [in] a2 The second argument to the functor.
118
   */
119
  void operator() (T1 a1, T2 a2) const;
120
  /**
121
   * \copybrief operator()()
122
   * \tparam T1 \deduced Type of the first argument to the functor.
123
   * \tparam T2 \deduced Type of the second argument to the functor.
124
   * \tparam T3 \deduced Type of the third argument to the functor.
125
   * \param [in] a1 The first argument to the functor.
126
   * \param [in] a2 The second argument to the functor.
127
   * \param [in] a3 The third argument to the functor.
128
   */
129
  void operator() (T1 a1, T2 a2, T3 a3) const;
130
  /**
131
   * \copybrief operator()()
132
   * \tparam T1 \deduced Type of the first argument to the functor.
133
   * \tparam T2 \deduced Type of the second argument to the functor.
134
   * \tparam T3 \deduced Type of the third argument to the functor.
135
   * \tparam T4 \deduced Type of the fourth argument to the functor.
136
   * \param [in] a1 The first argument to the functor.
137
   * \param [in] a2 The second argument to the functor.
138
   * \param [in] a3 The third argument to the functor.
139
   * \param [in] a4 The fourth argument to the functor.
140
   */
141
  void operator() (T1 a1, T2 a2, T3 a3, T4 a4) const;
142
  /**
143
   * \copybrief operator()()
144
   * \tparam T1 \deduced Type of the first argument to the functor.
145
   * \tparam T2 \deduced Type of the second argument to the functor.
146
   * \tparam T3 \deduced Type of the third argument to the functor.
147
   * \tparam T4 \deduced Type of the fourth argument to the functor.
148
   * \tparam T5 \deduced Type of the fifth argument to the functor.
149
   * \param [in] a1 The first argument to the functor.
150
   * \param [in] a2 The second argument to the functor.
151
   * \param [in] a3 The third argument to the functor.
152
   * \param [in] a4 The fourth argument to the functor.
153
   * \param [in] a5 The fifth argument to the functor.
154
   */
155
  void operator() (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) const;
156
  /**
157
   * \copybrief operator()()
158
   * \tparam T1 \deduced Type of the first argument to the functor.
159
   * \tparam T2 \deduced Type of the second argument to the functor.
160
   * \tparam T3 \deduced Type of the third argument to the functor.
161
   * \tparam T4 \deduced Type of the fourth argument to the functor.
162
   * \tparam T5 \deduced Type of the fifth argument to the functor.
163
   * \tparam T6 \deduced Type of the sixth argument to the functor.
164
   * \param [in] a1 The first argument to the functor.
165
   * \param [in] a2 The second argument to the functor.
166
   * \param [in] a3 The third argument to the functor.
167
   * \param [in] a4 The fourth argument to the functor.
168
   * \param [in] a5 The fifth argument to the functor.
169
   * \param [in] a6 The sixth argument to the functor.
170
   */
171
  void operator() (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) const;
172
  /**
173
   * \copybrief operator()()
174
   * \tparam T1 \deduced Type of the first argument to the functor.
175
   * \tparam T2 \deduced Type of the second argument to the functor.
176
   * \tparam T3 \deduced Type of the third argument to the functor.
177
   * \tparam T4 \deduced Type of the fourth argument to the functor.
178
   * \tparam T5 \deduced Type of the fifth argument to the functor.
179
   * \tparam T6 \deduced Type of the sixth argument to the functor.
180
   * \tparam T7 \deduced Type of the seventh argument to the functor.
181
   * \param [in] a1 The first argument to the functor.
182
   * \param [in] a2 The second argument to the functor.
183
   * \param [in] a3 The third argument to the functor.
184
   * \param [in] a4 The fourth argument to the functor.
185
   * \param [in] a5 The fifth argument to the functor.
186
   * \param [in] a6 The sixth argument to the functor.
187
   * \param [in] a7 The seventh argument to the functor.
188
   */
189
  void operator() (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7) const;
190
  /**
191
   * \copybrief operator()()
192
   * \tparam T1 \deduced Type of the first argument to the functor.
193
   * \tparam T2 \deduced Type of the second argument to the functor.
194
   * \tparam T3 \deduced Type of the third argument to the functor.
195
   * \tparam T4 \deduced Type of the fourth argument to the functor.
196
   * \tparam T5 \deduced Type of the fifth argument to the functor.
197
   * \tparam T6 \deduced Type of the sixth argument to the functor.
198
   * \tparam T7 \deduced Type of the seventh argument to the functor.
199
   * \tparam T8 \deduced Type of the eighth argument to the functor.
200
   * \param [in] a1 The first argument to the functor.
201
   * \param [in] a2 The second argument to the functor.
202
   * \param [in] a3 The third argument to the functor.
203
   * \param [in] a4 The fourth argument to the functor.
204
   * \param [in] a5 The fifth argument to the functor.
205
   * \param [in] a6 The sixth argument to the functor.
206
   * \param [in] a7 The seventh argument to the functor.
207
   * \param [in] a8 The eighth argument to the functor.
208
   */
209
  void operator() (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8) const;
210
  /**@}*/
211
92
212
  /**
93
  /**
213
   *  TracedCallback signature for POD.
94
   *  TracedCallback signature for POD.
 Lines 225-240    Link Here 
225
  /**
106
  /**
226
   * Container type for holding the chain of Callbacks.
107
   * Container type for holding the chain of Callbacks.
227
   *
108
   *
228
   * \tparam T1 \deduced Type of the first argument to the functor.
109
   * \tparam Ts \deduced Types of the functor arguments.
229
   * \tparam T2 \deduced Type of the second argument to the functor.
230
   * \tparam T3 \deduced Type of the third argument to the functor.
231
   * \tparam T4 \deduced Type of the fourth argument to the functor.
232
   * \tparam T5 \deduced Type of the fifth argument to the functor.
233
   * \tparam T6 \deduced Type of the sixth argument to the functor.
234
   * \tparam T7 \deduced Type of the seventh argument to the functor.
235
   * \tparam T8 \deduced Type of the eighth argument to the functor.
236
   */
110
   */
237
  typedef std::list<Callback<void,T1,T2,T3,T4,T5,T6,T7,T8> > CallbackList;
111
  typedef std::list<Callback<void,Ts...> > CallbackList;
238
  /** The chain of Callbacks. */
112
  /** The chain of Callbacks. */
239
  CallbackList m_callbackList;
113
  CallbackList m_callbackList;
240
};
114
};
 Lines 248-292    Link Here 
248
122
249
namespace ns3 {
123
namespace ns3 {
250
124
251
template<typename T1, typename T2, 
125
template<typename... Ts>
252
         typename T3, typename T4,
126
TracedCallback<Ts...>::TracedCallback ()
253
         typename T5, typename T6,
254
         typename T7, typename T8>
255
TracedCallback<T1,T2,T3,T4,T5,T6,T7,T8>::TracedCallback ()
256
  : m_callbackList () 
127
  : m_callbackList () 
257
{
128
{
258
}
129
}
259
template<typename T1, typename T2,
130
template<typename... Ts>
260
         typename T3, typename T4,
261
         typename T5, typename T6,
262
         typename T7, typename T8>
263
void
131
void
264
TracedCallback<T1,T2,T3,T4,T5,T6,T7,T8>::ConnectWithoutContext (const CallbackBase & callback)
132
TracedCallback<Ts...>::ConnectWithoutContext (const CallbackBase & callback)
265
{
133
{
266
  Callback<void,T1,T2,T3,T4,T5,T6,T7,T8> cb;
134
  Callback<void,Ts...> cb;
267
  if (!cb.Assign (callback))
135
  if (!cb.Assign (callback))
268
    NS_FATAL_ERROR_NO_MSG();
136
    NS_FATAL_ERROR_NO_MSG();
269
  m_callbackList.push_back (cb);
137
  m_callbackList.push_back (cb);
270
}
138
}
271
template<typename T1, typename T2,
139
template<typename... Ts>
272
         typename T3, typename T4,
273
         typename T5, typename T6,
274
         typename T7, typename T8>
275
void
140
void
276
TracedCallback<T1,T2,T3,T4,T5,T6,T7,T8>::Connect (const CallbackBase & callback, std::string path)
141
TracedCallback<Ts...>::Connect (const CallbackBase & callback, std::string path)
277
{
142
{
278
  Callback<void,std::string,T1,T2,T3,T4,T5,T6,T7,T8> cb;
143
  Callback<void,std::string,Ts...> cb;
279
  if (!cb.Assign (callback))
144
  if (!cb.Assign (callback))
280
    NS_FATAL_ERROR ("when connecting to " << path);
145
    NS_FATAL_ERROR ("when connecting to " << path);
281
  Callback<void,T1,T2,T3,T4,T5,T6,T7,T8> realCb = cb.Bind (path);
146
  Callback<void,Ts...> realCb = cb.Bind (path);
282
  m_callbackList.push_back (realCb);
147
  m_callbackList.push_back (realCb);
283
}
148
}
284
template<typename T1, typename T2, 
149
template<typename... Ts>
285
         typename T3, typename T4,
286
         typename T5, typename T6,
287
         typename T7, typename T8>
288
void 
150
void 
289
TracedCallback<T1,T2,T3,T4,T5,T6,T7,T8>::DisconnectWithoutContext (const CallbackBase & callback)
151
TracedCallback<Ts...>::DisconnectWithoutContext (const CallbackBase & callback)
290
{
152
{
291
  for (typename CallbackList::iterator i = m_callbackList.begin ();
153
  for (typename CallbackList::iterator i = m_callbackList.begin ();
292
       i != m_callbackList.end (); /* empty */)
154
       i != m_callbackList.end (); /* empty */)
 Lines 301-434    Link Here 
301
        }
163
        }
302
    }
164
    }
303
}
165
}
304
template<typename T1, typename T2, 
166
template<typename... Ts>
305
         typename T3, typename T4,
306
         typename T5, typename T6,
307
         typename T7, typename T8>
308
void 
167
void 
309
TracedCallback<T1,T2,T3,T4,T5,T6,T7,T8>::Disconnect (const CallbackBase & callback, std::string path)
168
TracedCallback<Ts...>::Disconnect (const CallbackBase & callback, std::string path)
310
{
169
{
311
  Callback<void,std::string,T1,T2,T3,T4,T5,T6,T7,T8> cb;
170
  Callback<void,std::string,Ts...> cb;
312
  if (!cb.Assign (callback))
171
  if (!cb.Assign (callback))
313
    NS_FATAL_ERROR ("when disconnecting from " << path);
172
    NS_FATAL_ERROR ("when disconnecting from " << path);
314
  Callback<void,T1,T2,T3,T4,T5,T6,T7,T8> realCb = cb.Bind (path);
173
  Callback<void,Ts...> realCb = cb.Bind (path);
315
  DisconnectWithoutContext (realCb);
174
  DisconnectWithoutContext (realCb);
316
}
175
}
317
template<typename T1, typename T2, 
176
template<typename... Ts>
318
         typename T3, typename T4,
319
         typename T5, typename T6,
320
         typename T7, typename T8>
321
void 
177
void 
322
TracedCallback<T1,T2,T3,T4,T5,T6,T7,T8>::operator() (void) const
178
TracedCallback<Ts...>::operator() (Ts... args) const
323
{
179
{
324
  for (typename CallbackList::const_iterator i = m_callbackList.begin ();
180
  for (typename CallbackList::const_iterator i = m_callbackList.begin ();
325
       i != m_callbackList.end (); i++)
181
       i != m_callbackList.end (); i++)
326
    {
182
    {
327
      (*i)();
183
      (*i)(args...);
328
    }
329
}
330
template<typename T1, typename T2, 
331
         typename T3, typename T4,
332
         typename T5, typename T6,
333
         typename T7, typename T8>
334
void 
335
TracedCallback<T1,T2,T3,T4,T5,T6,T7,T8>::operator() (T1 a1) const
336
{
337
  for (typename CallbackList::const_iterator i = m_callbackList.begin ();
338
       i != m_callbackList.end (); i++)
339
    {
340
      (*i)(a1);
341
    }
342
}
343
template<typename T1, typename T2, 
344
         typename T3, typename T4,
345
         typename T5, typename T6,
346
         typename T7, typename T8>
347
void 
348
TracedCallback<T1,T2,T3,T4,T5,T6,T7,T8>::operator() (T1 a1, T2 a2) const
349
{
350
  for (typename CallbackList::const_iterator i = m_callbackList.begin ();
351
       i != m_callbackList.end (); i++)
352
    {
353
      (*i)(a1, a2);
354
    }
355
}
356
template<typename T1, typename T2, 
357
         typename T3, typename T4,
358
         typename T5, typename T6,
359
         typename T7, typename T8>
360
void 
361
TracedCallback<T1,T2,T3,T4,T5,T6,T7,T8>::operator() (T1 a1, T2 a2, T3 a3) const
362
{
363
  for (typename CallbackList::const_iterator i = m_callbackList.begin ();
364
       i != m_callbackList.end (); i++)
365
    {
366
      (*i)(a1, a2, a3);
367
    }
368
}
369
template<typename T1, typename T2, 
370
         typename T3, typename T4,
371
         typename T5, typename T6,
372
         typename T7, typename T8>
373
void 
374
TracedCallback<T1,T2,T3,T4,T5,T6,T7,T8>::operator() (T1 a1, T2 a2, T3 a3, T4 a4) const
375
{
376
  for (typename CallbackList::const_iterator i = m_callbackList.begin ();
377
       i != m_callbackList.end (); i++)
378
    {
379
      (*i)(a1, a2, a3, a4);
380
    }
381
}
382
template<typename T1, typename T2, 
383
         typename T3, typename T4,
384
         typename T5, typename T6,
385
         typename T7, typename T8>
386
void 
387
TracedCallback<T1,T2,T3,T4,T5,T6,T7,T8>::operator() (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) const
388
{
389
  for (typename CallbackList::const_iterator i = m_callbackList.begin ();
390
       i != m_callbackList.end (); i++)
391
    {
392
      (*i)(a1, a2, a3, a4, a5);
393
    }
394
}
395
template<typename T1, typename T2, 
396
         typename T3, typename T4,
397
         typename T5, typename T6,
398
         typename T7, typename T8>
399
void 
400
TracedCallback<T1,T2,T3,T4,T5,T6,T7,T8>::operator() (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) const
401
{
402
  for (typename CallbackList::const_iterator i = m_callbackList.begin ();
403
       i != m_callbackList.end (); i++)
404
    {
405
      (*i)(a1, a2, a3, a4, a5, a6);
406
    }
407
}
408
template<typename T1, typename T2, 
409
         typename T3, typename T4,
410
         typename T5, typename T6,
411
         typename T7, typename T8>
412
void 
413
TracedCallback<T1,T2,T3,T4,T5,T6,T7,T8>::operator() (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7) const
414
{
415
  for (typename CallbackList::const_iterator i = m_callbackList.begin ();
416
       i != m_callbackList.end (); i++)
417
    {
418
      (*i)(a1, a2, a3, a4, a5, a6, a7);
419
    }
420
}
421
template<typename T1, typename T2, 
422
         typename T3, typename T4,
423
         typename T5, typename T6,
424
         typename T7, typename T8>
425
void 
426
TracedCallback<T1,T2,T3,T4,T5,T6,T7,T8>::operator() (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8) const
427
{
428
  for (typename CallbackList::const_iterator i = m_callbackList.begin ();
429
       i != m_callbackList.end (); i++)
430
    {
431
      (*i)(a1, a2, a3, a4, a5, a6, a7, a8);
432
    }
184
    }
433
}
185
}
434
186
(-)a/src/core/model/watchdog.cc (-1 / +1 lines)
 Lines 23-29    Link Here 
23
23
24
/**
24
/**
25
 * \file
25
 * \file
26
 * \ingroup timer
26
 * \ingroup vttimer
27
 * ns3::Watchdog timer class implementation.
27
 * ns3::Watchdog timer class implementation.
28
 */
28
 */
29
29
(-)a/src/core/model/watchdog.h (-128 / +9 lines)
 Lines 25-31    Link Here 
25
25
26
/**
26
/**
27
 * \file
27
 * \file
28
 * \ingroup timer
28
 * \ingroup vttimer
29
 * ns3::Watchdog timer class declaration.
29
 * ns3::Watchdog timer class declaration.
30
 */
30
 */
31
31
 Lines 34-40    Link Here 
34
class TimerImpl;
34
class TimerImpl;
35
35
36
/**
36
/**
37
 * \ingroup timer
37
 * \ingroup vttimer
38
 * \brief A very simple watchdog operating in virtual time.
38
 * \brief A very simple watchdog operating in virtual time.
39
 *
39
 *
40
 * The watchdog timer is started by calling Ping with a delay value.
40
 * The watchdog timer is started by calling Ping with a delay value.
 Lines 101-171    Link Here 
101
   */
101
   */
102
  /**@{*/
102
  /**@{*/
103
  /**
103
  /**
104
   * \tparam T1 \deduced Type of the first argument.
104
   * \tparam Ts \deduced Argument types.
105
   * \param [in] a1 The first argument
105
   * \param [in] args arguments
106
   */
106
   */
107
  template <typename T1>
107
  template <typename... Ts>
108
  void SetArguments (T1 a1);
108
  void SetArguments (Ts&&... args);
109
  /**
110
   * \tparam T1 \deduced Type of the first argument.
111
   * \tparam T2 \deduced Type of the second argument.
112
   * \param [in] a1 the first argument
113
   * \param [in] a2 the second argument
114
   */
115
  template <typename T1, typename T2>
116
  void SetArguments (T1 a1, T2 a2);
117
  /**
118
   * \tparam T1 \deduced Type of the first argument.
119
   * \tparam T2 \deduced Type of the second argument.
120
   * \tparam T3 \deduced Type of the third argument.
121
   * \param [in] a1 the first argument
122
   * \param [in] a2 the second argument
123
   * \param [in] a3 the third argument
124
   */
125
  template <typename T1, typename T2, typename T3>
126
  void SetArguments (T1 a1, T2 a2, T3 a3);
127
  /**
128
   * \tparam T1 \deduced Type of the first argument.
129
   * \tparam T2 \deduced Type of the second argument.
130
   * \tparam T3 \deduced Type of the third argument.
131
   * \tparam T4 \deduced Type of the fourth argument.
132
   * \param [in] a1 the first argument
133
   * \param [in] a2 the second argument
134
   * \param [in] a3 the third argument
135
   * \param [in] a4 the fourth argument
136
   */
137
  template <typename T1, typename T2, typename T3, typename T4>
138
  void SetArguments (T1 a1, T2 a2, T3 a3, T4 a4);
139
  /**
140
   * \tparam T1 \deduced Type of the first argument.
141
   * \tparam T2 \deduced Type of the second argument.
142
   * \tparam T3 \deduced Type of the third argument.
143
   * \tparam T4 \deduced Type of the fourth argument.
144
   * \tparam T5 \deduced Type of the fifth argument.
145
   * \param [in] a1 the first argument
146
   * \param [in] a2 the second argument
147
   * \param [in] a3 the third argument
148
   * \param [in] a4 the fourth argument
149
   * \param [in] a5 the fifth argument
150
   */
151
  template <typename T1, typename T2, typename T3, typename T4, typename T5>
152
  void SetArguments (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
153
  /**
154
   * \tparam T1 \deduced Type of the first argument.
155
   * \tparam T2 \deduced Type of the second argument.
156
   * \tparam T3 \deduced Type of the third argument.
157
   * \tparam T4 \deduced Type of the fourth argument.
158
   * \tparam T5 \deduced Type of the fifth argument.
159
   * \tparam T6 \deduced Type of the sixth argument.
160
   * \param [in] a1 the first argument
161
   * \param [in] a2 the second argument
162
   * \param [in] a3 the third argument
163
   * \param [in] a4 the fourth argument
164
   * \param [in] a5 the fifth argument
165
   * \param [in] a6 the sixth argument
166
   */
167
  template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
168
  void SetArguments (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6);
169
  /**@}*/
109
  /**@}*/
170
110
171
private:
111
private:
 Lines 209-283    Link Here 
209
  m_impl = MakeTimerImpl (memPtr, objPtr);
149
  m_impl = MakeTimerImpl (memPtr, objPtr);
210
}
150
}
211
151
212
template <typename T1>
152
template <typename... Ts>
213
void 
153
void 
214
Watchdog::SetArguments (T1 a1)
154
Watchdog::SetArguments (Ts&&... args)
215
{
155
{
216
  if (m_impl == 0)
156
  if (m_impl == 0)
217
    {
157
    {
218
      NS_FATAL_ERROR ("You cannot set the arguments of a Watchdog before setting its function.");
158
      NS_FATAL_ERROR ("You cannot set the arguments of a Watchdog before setting its function.");
219
      return;
159
      return;
220
    }
160
    }
221
  m_impl->SetArgs (a1);
161
  m_impl->SetArgs (std::forward<Ts>(args)...);
222
}
223
template <typename T1, typename T2>
224
void 
225
Watchdog::SetArguments (T1 a1, T2 a2)
226
{
227
  if (m_impl == 0)
228
    {
229
      NS_FATAL_ERROR ("You cannot set the arguments of a Watchdog before setting its function.");
230
      return;
231
    }
232
  m_impl->SetArgs (a1, a2);
233
}
234
235
template <typename T1, typename T2, typename T3>
236
void 
237
Watchdog::SetArguments (T1 a1, T2 a2, T3 a3)
238
{
239
  if (m_impl == 0)
240
    {
241
      NS_FATAL_ERROR ("You cannot set the arguments of a Watchdog before setting its function.");
242
      return;
243
    }
244
  m_impl->SetArgs (a1, a2, a3);
245
}
246
247
template <typename T1, typename T2, typename T3, typename T4>
248
void 
249
Watchdog::SetArguments (T1 a1, T2 a2, T3 a3, T4 a4)
250
{
251
  if (m_impl == 0)
252
    {
253
      NS_FATAL_ERROR ("You cannot set the arguments of a Watchdog before setting its function.");
254
      return;
255
    }
256
  m_impl->SetArgs (a1, a2, a3, a4);
257
}
258
259
template <typename T1, typename T2, typename T3, typename T4, typename T5>
260
void 
261
Watchdog::SetArguments (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
262
{
263
  if (m_impl == 0)
264
    {
265
      NS_FATAL_ERROR ("You cannot set the arguments of a Watchdog before setting its function.");
266
      return;
267
    }
268
  m_impl->SetArgs (a1, a2, a3, a4, a5);
269
}
270
271
template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
272
void 
273
Watchdog::SetArguments (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6)
274
{
275
  if (m_impl == 0)
276
    {
277
      NS_FATAL_ERROR ("You cannot set the arguments of a Watchdog before setting its function.");
278
      return;
279
    }
280
  m_impl->SetArgs (a1, a2, a3, a4, a5, a6);
281
}
162
}
282
163
283
} // namespace ns3
164
} // namespace ns3
(-)a/src/core/wscript (-1 lines)
 Lines 148-154    Link Here 
148
        'model/timer.cc',
148
        'model/timer.cc',
149
        'model/watchdog.cc',
149
        'model/watchdog.cc',
150
        'model/synchronizer.cc',
150
        'model/synchronizer.cc',
151
        'model/make-event.cc',
152
        'model/log.cc',
151
        'model/log.cc',
153
        'model/breakpoint.cc',
152
        'model/breakpoint.cc',
154
        'model/type-id.cc',
153
        'model/type-id.cc',

Return to bug 2457