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/default-simulator-impl.cc (-1 / +1 lines)
 Lines 218-224    Link Here 
218
DefaultSimulatorImpl::Stop (Time const &delay)
218
DefaultSimulatorImpl::Stop (Time const &delay)
219
{
219
{
220
  NS_LOG_FUNCTION (this << delay.GetTimeStep ());
220
  NS_LOG_FUNCTION (this << delay.GetTimeStep ());
221
  Simulator::Schedule (delay, &Simulator::Stop);
221
  Simulator::Schedule<void ()> (delay, &Simulator::Stop);
222
}
222
}
223
223
224
//
224
//
(-)a/src/core/model/make-event.h (-624 / +19 lines)
 Lines 20-671    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
/**
150
 * \ingroup events
151
 * \defgroup makeeventfnptr MakeEvent from Function Pointers.
152
 *
153
 * Create EventImpl instances from function pointers which take
154
 * varying numbers of arguments.
155
 *
156
 * @{
157
 */
158
/**
159
 * Make an EventImpl from a function pointer taking varying numbers
160
 * of arguments.
161
 *
162
 * \param [in] f The function pointer.
163
 * \returns The constructed EventImpl.
164
 */
165
EventImpl * MakeEvent (void (*f)(void));
166
167
/**
168
 * \copybrief MakeEvent(void(*f)(void))
169
 * \tparam U1 \deduced Formal type of the argument to the function.
170
 * \tparam T1 \deduced Actual type of the argument to the function.
171
 * \param [in] f The function pointer.
172
 * \param [in] a1 Argument to be bound to the function.
173
 * \returns The constructed EventImpl.
174
 */
175
template <typename U1,
176
          typename T1>
177
EventImpl * MakeEvent (void (*f)(U1), T1 a1);
178
179
/**
180
 * \copybrief MakeEvent(void(*f)(void))
181
 * \tparam U1 \deduced Formal type of the first argument to the function.
182
 * \tparam U2 \deduced Formal type of the second argument to the function.
183
 * \tparam T1 \deduced Actual type of the first argument to the function.
184
 * \tparam T2 \deduced Actual type of the second argument to the function.
185
 * \param [in] f The function pointer.
186
 * \param [in] a1 First argument to be bound to the function.
187
 * \param [in] a2 Second argument to be bound to the function.
188
 * \returns The constructed EventImpl.
189
 */
190
template <typename U1, typename U2,
191
          typename T1, typename T2>
192
EventImpl * MakeEvent (void (*f)(U1,U2), T1 a1, T2 a2);
193
194
/**
195
 * \copybrief MakeEvent(void(*f)(void))
196
 * \tparam U1 \deduced Formal type of the first argument to the function.
197
 * \tparam U2 \deduced Formal type of the second argument to the function.
198
 * \tparam U3 \deduced Formal type of the third argument to the function.
199
 * \tparam T1 \deduced Actual type of the first argument to the function.
200
 * \tparam T2 \deduced Actual type of the second argument to the function.
201
 * \tparam T3 \deduced Actual type of the third argument to the function.
202
 * \param [in] f The function pointer.
203
 * \param [in] a1 First argument to be bound to the function.
204
 * \param [in] a2 Second argument to be bound to the function.
205
 * \param [in] a3 Third argument to be bound to the function.
206
 * \returns The constructed EventImpl.
207
 */
208
template <typename U1, typename U2, typename U3,
209
          typename T1, typename T2, typename T3>
210
EventImpl * MakeEvent (void (*f)(U1,U2,U3), T1 a1, T2 a2, T3 a3);
211
212
/**
213
 * \copybrief MakeEvent(void(*f)(void))
214
 * \tparam U1 \deduced Formal type of the first argument to the function.
215
 * \tparam U2 \deduced Formal type of the second argument to the function.
216
 * \tparam U3 \deduced Formal type of the third argument to the function.
217
 * \tparam U4 \deduced Formal type of the fourth argument to the function.
218
 * \tparam T1 \deduced Actual type of the first argument to the function.
219
 * \tparam T2 \deduced Actual type of the second argument to the function.
220
 * \tparam T3 \deduced Actual type of the third argument to the function.
221
 * \tparam T4 \deduced Actual type of the fourth argument to the function.
222
 * \param [in] f The function pointer.
223
 * \param [in] a1 First argument to be bound to the function.
224
 * \param [in] a2 Second argument to be bound to the function.
225
 * \param [in] a3 Third argument to be bound to the function.
226
 * \param [in] a4 Fourth argument to be bound to the function.
227
 * \returns The constructed EventImpl.
228
 */
229
template <typename U1, typename U2, typename U3, typename U4,
230
          typename T1, typename T2, typename T3, typename T4>
231
EventImpl * MakeEvent (void (*f)(U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4);
232
233
/**
234
 * \copybrief MakeEvent(void(*f)(void))
235
 * \tparam U1 \deduced Formal type of the first argument to the function.
236
 * \tparam U2 \deduced Formal type of the second argument to the function.
237
 * \tparam U3 \deduced Formal type of the third argument to the function.
238
 * \tparam U4 \deduced Formal type of the fourth argument to the function.
239
 * \tparam U5 \deduced Formal type of the fifth argument to the function.
240
 * \tparam T1 \deduced Actual type of the first argument to the function.
241
 * \tparam T2 \deduced Actual type of the second argument to the function.
242
 * \tparam T3 \deduced Actual type of the third argument to the function.
243
 * \tparam T4 \deduced Actual type of the fourth argument to the function.
244
 * \tparam T5 \deduced Actual type of the fifth argument to the function.
245
 * \param [in] f The function pointer.
246
 * \param [in] a1 First argument to be bound to the function.
247
 * \param [in] a2 Second argument to be bound to the function.
248
 * \param [in] a3 Third argument to be bound to the function.
249
 * \param [in] a4 Fourth argument to be bound to the function.
250
 * \param [in] a5 Fifth argument to be bound to the function.
251
 * \returns The constructed EventImpl.
252
 */
253
template <typename U1, typename U2, typename U3, typename U4, typename U5,
254
          typename T1, typename T2, typename T3, typename T4, typename T5>
255
EventImpl * MakeEvent (void (*f)(U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
256
/**@}*/
257
258
} // namespace ns3
259
260
/********************************************************************
261
 *  Implementation of the templates declared above.
262
 ********************************************************************/
263
264
#include "event-impl.h"
265
#include "type-traits.h"
266
267
namespace ns3 {
268
269
/**
270
 * \ingroup makeeventmemptr
271
 * Helper for the MakeEvent functions which take a class method.
272
 *
273
 * This helper converts a pointer to a reference.
274
 *
275
 * This is the generic template declaration (with empty body).
276
 *
277
 * \tparam T \explicit The class type.
278
 */
279
template <typename T>
280
struct EventMemberImplObjTraits;
281
282
/**
283
 * \ingroup makeeventmemptr
284
 * Helper for the MakeEvent functions which take a class method.
285
 *
286
 * This helper converts a pointer to a reference.
287
 *
288
 * This is the specialization for pointer types.
289
 *
290
 * \tparam T \explicit The class type.
291
 */
292
template <typename T>
293
struct EventMemberImplObjTraits<T *>
294
{
44
{
295
  /**
45
  class EventMemberImpl : public EventImpl
296
   * \param [in] p Object pointer.
297
   * \return A reference to the object pointed to by p.
298
   */
299
  static T &GetReference (T *p)
300
  {
301
    return *p;
302
  }
303
};
304
305
template <typename MEM, typename OBJ>
306
EventImpl * MakeEvent (MEM mem_ptr, OBJ obj)
307
{
308
  // zero argument version
309
  class EventMemberImpl0 : public EventImpl
310
  {
46
  {
311
public:
47
public:
312
    EventMemberImpl0 (OBJ obj, MEM function)
48
    EventMemberImpl (Ts&&... args)
313
      : m_obj (obj),
49
      : m_function (std::bind (std::forward<Ts> (args)...))
314
        m_function (function)
315
    {
50
    {
316
    }
51
    }
317
    virtual ~EventMemberImpl0 ()
52
protected:
53
    virtual ~EventMemberImpl ()
318
    {
54
    {
319
    }
55
    }
320
private:
56
private:
321
    virtual void Notify (void)
57
    virtual void Notify ()
322
    {
58
    {
323
      (EventMemberImplObjTraits<OBJ>::GetReference (m_obj).*m_function)();
59
      m_function ();
324
    }
60
    }
325
    OBJ m_obj;
61
    std::function<void ()> m_function;
326
    MEM m_function;
62
  };
327
  } *ev = new EventMemberImpl0 (obj, mem_ptr);
63
  return new EventMemberImpl (std::forward<Ts> (args)...);
328
  return ev;
329
}
330
331
332
template <typename MEM, typename OBJ,
333
          typename T1>
334
EventImpl * MakeEvent (MEM mem_ptr, OBJ obj, T1 a1)
335
{
336
  // one argument version
337
  class EventMemberImpl1 : public EventImpl
338
  {
339
public:
340
    EventMemberImpl1 (OBJ obj, MEM function, T1 a1)
341
      : m_obj (obj),
342
        m_function (function),
343
        m_a1 (a1)
344
    {
345
    }
346
protected:
347
    virtual ~EventMemberImpl1 ()
348
    {
349
    }
350
private:
351
    virtual void Notify (void)
352
    {
353
      (EventMemberImplObjTraits<OBJ>::GetReference (m_obj).*m_function)(m_a1);
354
    }
355
    OBJ m_obj;
356
    MEM m_function;
357
    typename TypeTraits<T1>::ReferencedType m_a1;
358
  } *ev = new EventMemberImpl1 (obj, mem_ptr, a1);
359
  return ev;
360
}
361
362
template <typename MEM, typename OBJ,
363
          typename T1, typename T2>
364
EventImpl * MakeEvent (MEM mem_ptr, OBJ obj, T1 a1, T2 a2)
365
{
366
  // two argument version
367
  class EventMemberImpl2 : public EventImpl
368
  {
369
public:
370
    EventMemberImpl2 (OBJ obj, MEM function, T1 a1, T2 a2)
371
      : m_obj (obj),
372
        m_function (function),
373
        m_a1 (a1),
374
        m_a2 (a2)
375
    {
376
    }
377
protected:
378
    virtual ~EventMemberImpl2 ()
379
    {
380
    }
381
private:
382
    virtual void Notify (void)
383
    {
384
      (EventMemberImplObjTraits<OBJ>::GetReference (m_obj).*m_function)(m_a1, m_a2);
385
    }
386
    OBJ m_obj;
387
    MEM m_function;
388
    typename TypeTraits<T1>::ReferencedType m_a1;
389
    typename TypeTraits<T2>::ReferencedType m_a2;
390
  } *ev = new EventMemberImpl2 (obj, mem_ptr, a1, a2);
391
  return ev;
392
}
393
394
template <typename MEM, typename OBJ,
395
          typename T1, typename T2, typename T3>
396
EventImpl * MakeEvent (MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3)
397
{
398
  // three argument version
399
  class EventMemberImpl3 : public EventImpl
400
  {
401
public:
402
    EventMemberImpl3 (OBJ obj, MEM function, T1 a1, T2 a2, T3 a3)
403
      : m_obj (obj),
404
        m_function (function),
405
        m_a1 (a1),
406
        m_a2 (a2),
407
        m_a3 (a3)
408
    {
409
    }
410
protected:
411
    virtual ~EventMemberImpl3 ()
412
    {
413
    }
414
private:
415
    virtual void Notify (void)
416
    {
417
      (EventMemberImplObjTraits<OBJ>::GetReference (m_obj).*m_function)(m_a1, m_a2, m_a3);
418
    }
419
    OBJ m_obj;
420
    MEM m_function;
421
    typename TypeTraits<T1>::ReferencedType m_a1;
422
    typename TypeTraits<T2>::ReferencedType m_a2;
423
    typename TypeTraits<T3>::ReferencedType m_a3;
424
  } *ev = new EventMemberImpl3 (obj, mem_ptr, a1, a2, a3);
425
  return ev;
426
}
427
428
template <typename MEM, typename OBJ,
429
          typename T1, typename T2, typename T3, typename T4>
430
EventImpl * MakeEvent (MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4)
431
{
432
  // four argument version
433
  class EventMemberImpl4 : public EventImpl
434
  {
435
public:
436
    EventMemberImpl4 (OBJ obj, MEM function, T1 a1, T2 a2, T3 a3, T4 a4)
437
      : m_obj (obj),
438
        m_function (function),
439
        m_a1 (a1),
440
        m_a2 (a2),
441
        m_a3 (a3),
442
        m_a4 (a4)
443
    {
444
    }
445
protected:
446
    virtual ~EventMemberImpl4 ()
447
    {
448
    }
449
private:
450
    virtual void Notify (void)
451
    {
452
      (EventMemberImplObjTraits<OBJ>::GetReference (m_obj).*m_function)(m_a1, m_a2, m_a3, m_a4);
453
    }
454
    OBJ m_obj;
455
    MEM m_function;
456
    typename TypeTraits<T1>::ReferencedType m_a1;
457
    typename TypeTraits<T2>::ReferencedType m_a2;
458
    typename TypeTraits<T3>::ReferencedType m_a3;
459
    typename TypeTraits<T4>::ReferencedType m_a4;
460
  } *ev = new EventMemberImpl4 (obj, mem_ptr, a1, a2, a3, a4);
461
  return ev;
462
}
463
464
template <typename MEM, typename OBJ,
465
          typename T1, typename T2, typename T3, typename T4, typename T5>
466
EventImpl * MakeEvent (MEM mem_ptr, OBJ obj,
467
                       T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
468
{
469
  // five argument version
470
  class EventMemberImpl5 : public EventImpl
471
  {
472
public:
473
    EventMemberImpl5 (OBJ obj, MEM function, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
474
      : m_obj (obj),
475
        m_function (function),
476
        m_a1 (a1),
477
        m_a2 (a2),
478
        m_a3 (a3),
479
        m_a4 (a4),
480
        m_a5 (a5)
481
    {
482
    }
483
protected:
484
    virtual ~EventMemberImpl5 ()
485
    {
486
    }
487
private:
488
    virtual void Notify (void)
489
    {
490
      (EventMemberImplObjTraits<OBJ>::GetReference (m_obj).*m_function)(m_a1, m_a2, m_a3, m_a4, m_a5);
491
    }
492
    OBJ m_obj;
493
    MEM m_function;
494
    typename TypeTraits<T1>::ReferencedType m_a1;
495
    typename TypeTraits<T2>::ReferencedType m_a2;
496
    typename TypeTraits<T3>::ReferencedType m_a3;
497
    typename TypeTraits<T4>::ReferencedType m_a4;
498
    typename TypeTraits<T5>::ReferencedType m_a5;
499
  } *ev = new EventMemberImpl5 (obj, mem_ptr, a1, a2, a3, a4, a5);
500
  return ev;
501
}
502
503
template <typename U1, typename T1>
504
EventImpl * MakeEvent (void (*f)(U1), T1 a1)
505
{
506
  // one arg version
507
  class EventFunctionImpl1 : public EventImpl
508
  {
509
public:
510
    typedef void (*F)(U1);
511
512
    EventFunctionImpl1 (F function, T1 a1)
513
      : m_function (function),
514
        m_a1 (a1)
515
    {
516
    }
517
protected:
518
    virtual ~EventFunctionImpl1 ()
519
    {
520
    }
521
private:
522
    virtual void Notify (void)
523
    {
524
      (*m_function)(m_a1);
525
    }
526
    F m_function;
527
    typename TypeTraits<T1>::ReferencedType m_a1;
528
  } *ev = new EventFunctionImpl1 (f, a1);
529
  return ev;
530
}
531
532
template <typename U1, typename U2, typename T1, typename T2>
533
EventImpl * MakeEvent (void (*f)(U1,U2), T1 a1, T2 a2)
534
{
535
  // two arg version
536
  class EventFunctionImpl2 : public EventImpl
537
  {
538
public:
539
    typedef void (*F)(U1, U2);
540
541
    EventFunctionImpl2 (F function, T1 a1, T2 a2)
542
      : m_function (function),
543
        m_a1 (a1),
544
        m_a2 (a2)
545
    {
546
    }
547
protected:
548
    virtual ~EventFunctionImpl2 ()
549
    {
550
    }
551
private:
552
    virtual void Notify (void)
553
    {
554
      (*m_function)(m_a1, m_a2);
555
    }
556
    F m_function;
557
    typename TypeTraits<T1>::ReferencedType m_a1;
558
    typename TypeTraits<T2>::ReferencedType m_a2;
559
  } *ev = new EventFunctionImpl2 (f, a1, a2);
560
  return ev;
561
}
562
563
template <typename U1, typename U2, typename U3,
564
          typename T1, typename T2, typename T3>
565
EventImpl * MakeEvent (void (*f)(U1,U2,U3), T1 a1, T2 a2, T3 a3)
566
{
567
  // three arg version
568
  class EventFunctionImpl3 : public EventImpl
569
  {
570
public:
571
    typedef void (*F)(U1, U2, U3);
572
573
    EventFunctionImpl3 (F function, T1 a1, T2 a2, T3 a3)
574
      : m_function (function),
575
        m_a1 (a1),
576
        m_a2 (a2),
577
        m_a3 (a3)
578
    {
579
    }
580
protected:
581
    virtual ~EventFunctionImpl3 ()
582
    {
583
    }
584
private:
585
    virtual void Notify (void)
586
    {
587
      (*m_function)(m_a1, m_a2, m_a3);
588
    }
589
    F m_function;
590
    typename TypeTraits<T1>::ReferencedType m_a1;
591
    typename TypeTraits<T2>::ReferencedType m_a2;
592
    typename TypeTraits<T3>::ReferencedType m_a3;
593
  } *ev = new EventFunctionImpl3 (f, a1, a2, a3);
594
  return ev;
595
}
596
597
template <typename U1, typename U2, typename U3, typename U4,
598
          typename T1, typename T2, typename T3, typename T4>
599
EventImpl * MakeEvent (void (*f)(U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4)
600
{
601
  // four arg version
602
  class EventFunctionImpl4 : public EventImpl
603
  {
604
public:
605
    typedef void (*F)(U1, U2, U3, U4);
606
607
    EventFunctionImpl4 (F function, T1 a1, T2 a2, T3 a3, T4 a4)
608
      : m_function (function),
609
        m_a1 (a1),
610
        m_a2 (a2),
611
        m_a3 (a3),
612
        m_a4 (a4)
613
    {
614
    }
615
protected:
616
    virtual ~EventFunctionImpl4 ()
617
    {
618
    }
619
private:
620
    virtual void Notify (void)
621
    {
622
      (*m_function)(m_a1, m_a2, m_a3, m_a4);
623
    }
624
    F m_function;
625
    typename TypeTraits<T1>::ReferencedType m_a1;
626
    typename TypeTraits<T2>::ReferencedType m_a2;
627
    typename TypeTraits<T3>::ReferencedType m_a3;
628
    typename TypeTraits<T4>::ReferencedType m_a4;
629
  } *ev = new EventFunctionImpl4 (f, a1, a2, a3, a4);
630
  return ev;
631
}
632
633
template <typename U1, typename U2, typename U3, typename U4, typename U5,
634
          typename T1, typename T2, typename T3, typename T4, typename T5>
635
EventImpl * MakeEvent (void (*f)(U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
636
{
637
  // five arg version
638
  class EventFunctionImpl5 : public EventImpl
639
  {
640
public:
641
    typedef void (*F)(U1,U2,U3,U4,U5);
642
643
    EventFunctionImpl5 (F function, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
644
      : m_function (function),
645
        m_a1 (a1),
646
        m_a2 (a2),
647
        m_a3 (a3),
648
        m_a4 (a4),
649
        m_a5 (a5)
650
    {
651
    }
652
protected:
653
    virtual ~EventFunctionImpl5 ()
654
    {
655
    }
656
private:
657
    virtual void Notify (void)
658
    {
659
      (*m_function)(m_a1, m_a2, m_a3, m_a4, m_a5);
660
    }
661
    F m_function;
662
    typename TypeTraits<T1>::ReferencedType m_a1;
663
    typename TypeTraits<T2>::ReferencedType m_a2;
664
    typename TypeTraits<T3>::ReferencedType m_a3;
665
    typename TypeTraits<T4>::ReferencedType m_a4;
666
    typename TypeTraits<T5>::ReferencedType m_a5;
667
  } *ev = new EventFunctionImpl5 (f, a1, a2, a3, a4, a5);
668
  return ev;
669
}
64
}
670
65
671
} // 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 (-1110 / +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-314    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
   * Schedule an event to expire after @p delay.
215
   * Schedule an event to expire after @p delay.
313
   * This can be thought of as scheduling an event
216
   * This can be thought of as scheduling an event
314
   * 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 316-421    Link Here 
316
   *
219
   *
317
   * 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
318
   * 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.
319
   * @param [in] delay The relative expiration time of the event.
225
   * @param [in] delay The relative expiration time of the event.
320
   * @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.
321
   * @returns The id for the scheduled event.
228
   * @returns The id for the scheduled event.
322
   */
229
   */
323
  static EventId Schedule (Time const &delay, void (*f)(void));
230
  template <typename... Us, typename... Ts>
324
231
  static EventId Schedule (Time const &delay, void (*f)(Us...), Ts&&... args);
325
  /**
326
   * @see Schedule(const Time&,(*)())
327
   * @tparam U1 @deduced Formal type of the first argument to the function.
328
   * @tparam T1 @deduced Actual type of the first argument.
329
   * @param [in] delay The relative expiration time of the event.
330
   * @param [in] f The function to invoke
331
   * @param [in] a1 The first argument to pass to the function to invoke.
332
   * @returns The id for the scheduled event.
333
   */
334
  template <typename U1, typename T1>
335
  static EventId Schedule (Time const &delay, void (*f)(U1), T1 a1);
336
337
  /**
338
   * @see Schedule(const Time&,(*)())
339
   * @tparam U1 @deduced Formal type of the first argument to the function.
340
   * @tparam U2 @deduced Formal type of the second argument to the function.
341
   * @tparam T1 @deduced Actual type of the first argument.
342
   * @tparam T2 @deduced Actual type of the second argument.
343
   * @param [in] delay The relative expiration time of the event.
344
   * @param [in] f The function to invoke
345
   * @param [in] a1 The first argument to pass to the function to invoke
346
   * @param [in] a2 The second argument to pass to the function to invoke
347
   * @returns The id for the scheduled event.
348
   */
349
  template <typename U1, typename U2,
350
            typename T1, typename T2>
351
  static EventId Schedule (Time const &delay, void (*f)(U1,U2), T1 a1, T2 a2);
352
353
  /**
354
   * @see Schedule(const Time&,void(*)())
355
   * @tparam U1 @deduced Formal type of the first argument to the function.
356
   * @tparam U2 @deduced Formal type of the second argument to the function.
357
   * @tparam U3 @deduced Formal type of the third argument to the function.
358
   * @tparam T1 @deduced Actual type of the first argument.
359
   * @tparam T2 @deduced Actual type of the second argument.
360
   * @tparam T3 @deduced Actual type of the third 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
   * @param [in] a3 The third argument to pass to the function to invoke
366
   * @returns The id for the scheduled event.
367
   */
368
  template <typename U1, typename U2, typename U3,
369
            typename T1, typename T2, typename T3>
370
  static EventId Schedule (Time const &delay, void (*f)(U1,U2,U3), T1 a1, T2 a2, T3 a3);
371
372
  /**
373
   * @see Schedule(const Time&,(*)(void))
374
   * @tparam U1 @deduced Formal type of the first argument to the function.
375
   * @tparam U2 @deduced Formal type of the second argument to the function.
376
   * @tparam U3 @deduced Formal type of the third argument to the function.
377
   * @tparam U4 @deduced Formal type of the fourth argument to the function.
378
   * @tparam T1 @deduced Actual type of the first argument.
379
   * @tparam T2 @deduced Actual type of the second argument.
380
   * @tparam T3 @deduced Actual type of the third argument.
381
   * @tparam T4 @deduced Actual type of the fourth argument.
382
   * @param [in] delay The relative expiration time of the event.
383
   * @param [in] f The function to invoke
384
   * @param [in] a1 The first argument to pass to the function to invoke
385
   * @param [in] a2 The second argument to pass to the function to invoke
386
   * @param [in] a3 The third argument to pass to the function to invoke
387
   * @param [in] a4 The fourth argument to pass to the function to invoke
388
   * @returns The id for the scheduled event.
389
   */
390
  template <typename U1, typename U2, typename U3, typename U4, 
391
            typename T1, typename T2, typename T3, typename T4>
392
  static EventId Schedule (Time const &delay, void (*f)(U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4);
393
394
  /**
395
   * @see Schedule(const Time&,void(*)(void))
396
   * @tparam U1 @deduced Formal type of the first argument to the function.
397
   * @tparam U2 @deduced Formal type of the second argument to the function.
398
   * @tparam U3 @deduced Formal type of the third argument to the function.
399
   * @tparam U4 @deduced Formal type of the fourth argument to the function.
400
   * @tparam U5 @deduced Formal type of the fifth argument to the function.
401
   * @tparam T1 @deduced Actual type of the first argument.
402
   * @tparam T2 @deduced Actual type of the second argument.
403
   * @tparam T3 @deduced Actual type of the third argument.
404
   * @tparam T4 @deduced Actual type of the fourth argument.
405
   * @tparam T5 @deduced Actual type of the fifth argument.
406
   * @param [in] delay The relative expiration time of the event.
407
   * @param [in] f The function to invoke
408
   * @param [in] a1 The first argument to pass to the function to invoke
409
   * @param [in] a2 The second argument to pass to the function to invoke
410
   * @param [in] a3 The third argument to pass to the function to invoke
411
   * @param [in] a4 The fourth argument to pass to the function to invoke
412
   * @param [in] a5 The fifth argument to pass to the function to invoke
413
   * @returns The id for the scheduled event.
414
   */
415
  template <typename U1, typename U2, typename U3, typename U4, typename U5,
416
            typename T1, typename T2, typename T3, typename T4, typename T5>
417
  static EventId Schedule (Time const &delay, void (*f)(U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
418
419
  /** @} */
232
  /** @} */
420
233
421
  /**
234
  /**
 Lines 429-858    Link Here 
429
   * A context of 0xffffffff means no context is specified.
242
   * A context of 0xffffffff means no context is specified.
430
   * 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.
431
   *
244
   *
432
   * @see Schedule(const Time&,MEM,OBJ)
245
   * @tparam Ts @deduced Argument types.
433
   * @tparam MEM @deduced Class method function signature type.
434
   * @tparam OBJ @deduced Class type of the object.
435
   * @param [in] context User-specified context parameter
246
   * @param [in] context User-specified context parameter
436
   * @param [in] delay The relative expiration time of the event.
247
   * @param [in] delay The relative expiration time of the event.
437
   * @param [in] mem_ptr Member method pointer to invoke
248
   * @param [in] args Arguments to pass to MakeEvent.
438
   * @param [in] obj The object on which to invoke the member method
439
   */
249
   */
440
  template <typename MEM, typename OBJ>
250
  template <typename... Ts>
441
  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);
442
252
443
  /**
253
  /**
444
   * @see ScheduleWithContext(uint32_t,const Time&,MEM,OBJ)
445
   * @tparam MEM @deduced Class method function signature type.
446
   * @tparam OBJ @deduced Class type of the object.
447
   * @tparam T1 @deduced Type of first argument.
448
   * @param [in] context User-specified context parameter
449
   * @param [in] delay The relative expiration time of the event.
450
   * @param [in] mem_ptr Member method pointer to invoke
451
   * @param [in] obj The object on which to invoke the member method
452
   * @param [in] a1 The first argument to pass to the invoked method
453
   */
454
  template <typename MEM, typename OBJ, typename T1>
455
  static void ScheduleWithContext (uint32_t context, Time const &delay, MEM mem_ptr, OBJ obj, T1 a1);
456
457
  /**
458
   * @see ScheduleWithContext(uint32_t,const Time&,MEM,OBJ)
459
   * @tparam MEM @deduced Class method function signature type.
460
   * @tparam OBJ @deduced Class type of the object.
461
   * @tparam T1 @deduced Type of first argument.
462
   * @tparam T2 @deduced Type of second argument.
463
   * @param [in] context User-specified context parameter
464
   * @param [in] delay The relative expiration time of the event.
465
   * @param [in] mem_ptr Member method pointer to invoke
466
   * @param [in] obj The object on which to invoke the member method
467
   * @param [in] a1 The first argument to pass to the invoked method
468
   * @param [in] a2 The second argument to pass to the invoked method
469
   */
470
  template <typename MEM, typename OBJ, typename T1, typename T2>
471
  static void ScheduleWithContext (uint32_t context, Time const &delay, MEM mem_ptr, OBJ obj, T1 a1, T2 a2);
472
473
  /**
474
   * @see ScheduleWithContext(uint32_t,const Time&,MEM,OBJ)
475
   * @tparam MEM @deduced Class method function signature type.
476
   * @tparam OBJ @deduced Class type of the object.
477
   * @tparam T1 @deduced Type of first argument.
478
   * @tparam T2 @deduced Type of second argument.
479
   * @tparam T3 @deduced Type of third argument.
480
   * @param [in] context User-specified context parameter
481
   * @param [in] delay The relative expiration time of the event.
482
   * @param [in] mem_ptr Member method pointer to invoke
483
   * @param [in] obj The object on which to invoke the member method
484
   * @param [in] a1 The first argument to pass to the invoked method
485
   * @param [in] a2 The second argument to pass to the invoked method
486
   * @param [in] a3 The third argument to pass to the invoked method
487
   */
488
  template <typename MEM, typename OBJ, 
489
            typename T1, typename T2, typename T3>
490
  static void ScheduleWithContext (uint32_t context, Time const &delay, MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3);
491
492
  /**
493
   * @see ScheduleWithContext(uint32_t,const Time&,MEM,OBJ)
494
   * @tparam MEM @deduced Class method function signature type.
495
   * @tparam OBJ @deduced Class type of the object.
496
   * @tparam T1 @deduced Type of first argument.
497
   * @tparam T2 @deduced Type of second argument.
498
   * @tparam T3 @deduced Type of third argument.
499
   * @tparam T4 @deduced Type of fourth argument.
500
   * @param [in] context User-specified context parameter
501
   * @param [in] delay The relative expiration time of the event.
502
   * @param [in] mem_ptr Member method pointer to invoke
503
   * @param [in] obj The object on which to invoke the member method
504
   * @param [in] a1 The first argument to pass to the invoked method
505
   * @param [in] a2 The second argument to pass to the invoked method
506
   * @param [in] a3 The third argument to pass to the invoked method
507
   * @param [in] a4 The fourth argument to pass to the invoked method
508
   */
509
  template <typename MEM, typename OBJ, 
510
            typename T1, typename T2, typename T3, typename T4>
511
  static void ScheduleWithContext (uint32_t context, Time const &delay, MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4);
512
513
  /**
514
   * @see ScheduleWithContext(uint32_t,const Time&,MEM,OBJ)
515
   * @tparam MEM @deduced Class method function signature type.
516
   * @tparam OBJ @deduced Class type of the object.
517
   * @tparam T1 @deduced Type of first argument.
518
   * @tparam T2 @deduced Type of second argument.
519
   * @tparam T3 @deduced Type of third argument.
520
   * @tparam T4 @deduced Type of fourth argument.
521
   * @tparam T5 @deduced Type of fifth argument.
522
   * @param [in] context User-specified context parameter
523
   * @param [in] delay The relative expiration time of the event.
524
   * @param [in] mem_ptr Member method pointer to invoke
525
   * @param [in] obj The object on which to invoke the member method
526
   * @param [in] a1 The first argument to pass to the invoked method
527
   * @param [in] a2 The second argument to pass to the invoked method
528
   * @param [in] a3 The third argument to pass to the invoked method
529
   * @param [in] a4 The fourth argument to pass to the invoked method
530
   * @param [in] a5 The fifth argument to pass to the invoked method
531
   */
532
  template <typename MEM, typename OBJ, 
533
            typename T1, typename T2, typename T3, typename T4, typename T5>
534
  static void ScheduleWithContext (uint32_t context, Time const &delay, MEM mem_ptr, OBJ obj, 
535
                                   T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
536
  /**
537
   * Schedule an event with the given context.
254
   * Schedule an event with the given context.
538
   * A context of 0xffffffff means no context is specified.
255
   * A context of 0xffffffff means no context is specified.
539
   * 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.
540
   *
257
   *
541
   * When the event expires (when it becomes due to be run), the
258
   * @tparam Us @deduced Formal function argument types.
542
   * function will be invoked with any supplied arguments.
259
   * @tparam Ts @deduced Actual function argument types.
543
   *
544
   * This method is thread-safe: it can be called from any thread.
545
   * @param [in] context User-specified context parameter
260
   * @param [in] context User-specified context parameter
546
   * @param [in] delay The relative expiration time of the event.
261
   * @param [in] delay The relative expiration time of the event.
547
   * @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.
548
   */
264
   */
549
  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
  /** @} */
550
268
551
  /**
269
  /**
552
   * @see ScheduleWithContext(uint32_t,const Time&,(*)())
553
   * @tparam U1 @deduced Formal type of the first argument to the function.
554
   * @tparam T1 @deduced Actual type of the first argument.
555
   * @param [in] context User-specified context parameter
556
   * @param [in] delay The relative expiration time of the event.
557
   * @param [in] f The function to invoke
558
   * @param [in] a1 The first argument to pass to the function to invoke
559
   */
560
  template <typename U1,
561
            typename T1>
562
  static void ScheduleWithContext (uint32_t context, Time const &delay, void (*f)(U1), T1 a1);
563
564
  /**
565
   * @see ScheduleWithContext(uint32_t,const Time&,(*)())
566
   * @tparam U1 @deduced Formal type of the first argument to the function.
567
   * @tparam U2 @deduced Formal type of the second argument to the function.
568
   * @tparam T1 @deduced Actual type of the first argument.
569
   * @tparam T2 @deduced Actual type of the second argument.
570
   * @param [in] context User-specified context parameter
571
   * @param [in] delay The relative expiration time of the event.
572
   * @param [in] f The function to invoke
573
   * @param [in] a1 The first argument to pass to the function to invoke
574
   * @param [in] a2 The second argument to pass to the function to invoke
575
   */
576
  template <typename U1, typename U2,
577
            typename T1, typename T2>
578
  static void ScheduleWithContext (uint32_t context, Time const &delay, void (*f)(U1,U2), T1 a1, T2 a2);
579
580
  /**
581
   * @see ScheduleWithContext(uint32_t,const Time&,(*)())
582
   * @tparam U1 @deduced Formal type of the first argument to the function.
583
   * @tparam U2 @deduced Formal type of the second argument to the function.
584
   * @tparam U3 @deduced Formal type of the third argument to the function.
585
   * @tparam T1 @deduced Actual type of the first argument.
586
   * @tparam T2 @deduced Actual type of the second argument.
587
   * @tparam T3 @deduced Actual type of the third argument.
588
   * @param [in] context User-specified context parameter
589
   * @param [in] delay The relative expiration time of the event.
590
   * @param [in] f The function to invoke
591
   * @param [in] a1 The first argument to pass to the function to invoke
592
   * @param [in] a2 The second argument to pass to the function to invoke
593
   * @param [in] a3 The third argument to pass to the function to invoke
594
   */
595
  template <typename U1, typename U2, typename U3,
596
            typename T1, typename T2, typename T3>
597
  static void ScheduleWithContext (uint32_t context, Time const &delay, void (*f)(U1,U2,U3), T1 a1, T2 a2, T3 a3);
598
599
  /**
600
   * @see ScheduleWithContext(uint32_t,const Time&,(*)())
601
   * @tparam U1 @deduced Formal type of the first argument to the function.
602
   * @tparam U2 @deduced Formal type of the second argument to the function.
603
   * @tparam U3 @deduced Formal type of the third argument to the function.
604
   * @tparam U4 @deduced Formal type of the fourth argument to the function.
605
   * @tparam T1 @deduced Actual type of the first argument.
606
   * @tparam T2 @deduced Actual type of the second argument.
607
   * @tparam T3 @deduced Actual type of the third argument.
608
   * @tparam T4 @deduced Actual type of the fourth 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
   * @param [in] a2 The second argument to pass to the function to invoke
614
   * @param [in] a3 The third argument to pass to the function to invoke
615
   * @param [in] a4 The fourth argument to pass to the function to invoke
616
   */
617
  template <typename U1, typename U2, typename U3, typename U4, 
618
            typename T1, typename T2, typename T3, typename T4>
619
  static void ScheduleWithContext (uint32_t context, Time const &delay, void (*f)(U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4);
620
621
  /**
622
   * @see ScheduleWithContext(uint32_t,const Time&,(*)())
623
   * @tparam U1 @deduced Formal type of the first argument to the function.
624
   * @tparam U2 @deduced Formal type of the second argument to the function.
625
   * @tparam U3 @deduced Formal type of the third argument to the function.
626
   * @tparam U4 @deduced Formal type of the fourth argument to the function.
627
   * @tparam U5 @deduced Formal type of the fifth argument to the function.
628
   * @tparam T1 @deduced Actual type of the first argument.
629
   * @tparam T2 @deduced Actual type of the second argument.
630
   * @tparam T3 @deduced Actual type of the third argument.
631
   * @tparam T4 @deduced Actual type of the fourth argument.
632
   * @tparam T5 @deduced Actual type of the fifth argument.
633
   * @param [in] context User-specified context parameter
634
   * @param [in] delay The relative expiration time of the event.
635
   * @param [in] f The function to invoke
636
   * @param [in] a1 The first argument to pass to the function to invoke
637
   * @param [in] a2 The second argument to pass to the function to invoke
638
   * @param [in] a3 The third argument to pass to the function to invoke
639
   * @param [in] a4 The fourth argument to pass to the function to invoke
640
   * @param [in] a5 The fifth argument to pass to the function to invoke
641
   */
642
  template <typename U1, typename U2, typename U3, typename U4, typename U5,
643
            typename T1, typename T2, typename T3, typename T4, typename T5>
644
  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);
645
646
  /** @} */
647
  
648
  /**
649
   * @name Schedule events (in the same context) to run now.
270
   * @name Schedule events (in the same context) to run now.
650
   */
271
   */
651
  /** @{ */
272
  /** @{ */
652
  /**
273
  /**
653
   * Schedule an event to expire Now. All events scheduled to
274
   * Schedule an event to expire Now. All events scheduled to
654
   * to expire "Now" are scheduled FIFO, after all normal events
275
   * to expire "Now" are scheduled FIFO, after all normal events
655
   * have expired. 
276
   * have expired.
656
   *
277
   *
657
   * @tparam MEM @deduced Class method function signature type.
278
   * @tparam Ts @deduced Actual function argument types.
658
   * @tparam OBJ @deduced Class type of the object.
279
   * @param [in] args Arguments to pass to the invoked function.
659
   * @param [in] mem_ptr Member method pointer to invoke
660
   * @param [in] obj The object on which to invoke the member method
661
   * @return The EventId of the scheduled event.
280
   * @return The EventId of the scheduled event.
662
   */
281
   */
663
  template <typename MEM, typename OBJ>
282
  template <typename... Ts>
664
  static EventId ScheduleNow (MEM mem_ptr, OBJ obj);
283
  static EventId ScheduleNow (Ts&&... args);
665
284
666
  /**
285
  /**
667
   * @see ScheduleNow(MEM,OBJ)
286
   * Schedule an event to expire Now. All events scheduled to
668
   * @tparam MEM @deduced Class method function signature type.
287
   * to expire "Now" are scheduled FIFO, after all normal events
669
   * @tparam OBJ @deduced Class type of the object.
288
   * have expired.
670
   * @tparam T1 @deduced Type of first argument.
289
   *
671
   * @param [in] mem_ptr Member method pointer to invoke
290
   * @tparam Us @deduced Formal function argument types.
672
   * @param [in] obj The object on which to invoke the member method
291
   * @tparam Ts @deduced Actual function argument types.
673
   * @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.
674
   * @return The EventId of the scheduled event.
294
   * @return The EventId of the scheduled event.
675
   */
295
   */
676
  template <typename MEM, typename OBJ, 
296
  template <typename... Us, typename... Ts>
677
            typename T1>
297
  static EventId ScheduleNow (void (*f)(Us...), Ts&&... args);
678
  static EventId ScheduleNow (MEM mem_ptr, OBJ obj, T1 a1);
679
680
  /**
681
   * @see ScheduleNow(MEM,OBJ)
682
   * @tparam MEM @deduced Class method function signature type.
683
   * @tparam OBJ @deduced Class type of the object.
684
   * @tparam T1 @deduced Type of first argument.
685
   * @tparam T2 @deduced Type of second argument.
686
   * @param [in] mem_ptr Member method pointer to invoke
687
   * @param [in] obj The object on which to invoke the member method
688
   * @param [in] a1 The first argument to pass to the invoked method
689
   * @param [in] a2 The second argument to pass to the invoked method
690
   * @return The EventId of the scheduled event.
691
   */
692
  template <typename MEM, typename OBJ, 
693
            typename T1, typename T2>
694
  static EventId ScheduleNow (MEM mem_ptr, OBJ obj, T1 a1, T2 a2);
695
696
  /**
697
   * @see ScheduleNow(MEM,OBJ)
698
   * @tparam MEM @deduced Class method function signature type.
699
   * @tparam OBJ @deduced Class type of the object.
700
   * @tparam T1 @deduced Type of first argument.
701
   * @tparam T2 @deduced Type of second argument.
702
   * @tparam T3 @deduced Type of third argument.
703
   * @param [in] mem_ptr Member method pointer to invoke
704
   * @param [in] obj The object on which to invoke the member method
705
   * @param [in] a1 The first argument to pass to the invoked method
706
   * @param [in] a2 The second argument to pass to the invoked method
707
   * @param [in] a3 The third argument to pass to the invoked method
708
   * @return The EventId of the scheduled event.
709
   */
710
  template <typename MEM, typename OBJ, 
711
            typename T1, typename T2, typename T3>
712
  static EventId ScheduleNow (MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3);
713
714
  /**
715
   * @see ScheduleNow(MEM,OBJ)
716
   * @tparam MEM @deduced Class method function signature type.
717
   * @tparam OBJ @deduced Class type of the object.
718
   * @tparam T1 @deduced Type of first argument.
719
   * @tparam T2 @deduced Type of second argument.
720
   * @tparam T3 @deduced Type of third argument.
721
   * @tparam T4 @deduced Type of fourth argument.
722
   * @param [in] mem_ptr Member method pointer to invoke
723
   * @param [in] obj The object on which to invoke the member method
724
   * @param [in] a1 The first argument to pass to the invoked method
725
   * @param [in] a2 The second argument to pass to the invoked method
726
   * @param [in] a3 The third argument to pass to the invoked method
727
   * @param [in] a4 The fourth argument to pass to the invoked method
728
   * @return The EventId of the scheduled event.
729
   */
730
  template <typename MEM, typename OBJ, 
731
            typename T1, typename T2, typename T3, typename T4>
732
  static EventId ScheduleNow (MEM mem_ptr, OBJ obj, 
733
                              T1 a1, T2 a2, T3 a3, T4 a4);
734
  /**
735
   * @see ScheduleNow(MEM,OBJ)
736
   * @tparam MEM @deduced Class method function signature type.
737
   * @tparam OBJ @deduced Class type of the object.
738
   * @tparam T1 @deduced Type of first argument.
739
   * @tparam T2 @deduced Type of second argument.
740
   * @tparam T3 @deduced Type of third argument.
741
   * @tparam T4 @deduced Type of fourth argument.
742
   * @tparam T5 @deduced Type of fifth argument.
743
   * @param [in] mem_ptr Member method pointer to invoke
744
   * @param [in] obj The object on which to invoke the member method
745
   * @param [in] a1 The first argument to pass to the invoked method
746
   * @param [in] a2 The second argument to pass to the invoked method
747
   * @param [in] a3 The third argument to pass to the invoked method
748
   * @param [in] a4 The fourth argument to pass to the invoked method
749
   * @param [in] a5 The fifth argument to pass to the invoked method
750
   * @return The EventId of the scheduled event.
751
   */
752
  template <typename MEM, typename OBJ, 
753
            typename T1, typename T2, typename T3, typename T4, typename T5>
754
  static EventId ScheduleNow (MEM mem_ptr, OBJ obj, 
755
                              T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
756
  /**
757
   * @copybrief ScheduleNow(MEM,OBJ)
758
   *
759
   * When the event expires (when it becomes due to be run), the
760
   * function will be invoked with any supplied arguments.
761
   * @param [in] f The function to invoke
762
   * @return The EventId of the scheduled event.
763
   */
764
  static EventId ScheduleNow (void (*f)(void));
765
766
  /**
767
   * @see ScheduleNow(*)
768
   * @tparam U1 @deduced Formal type of the first argument to the function.
769
   * @tparam T1 @deduced Actual type of the first argument.
770
   * @param [in] f The function to invoke
771
   * @param [in] a1 The first argument to pass to the function to invoke
772
   * @return The EventId of the scheduled event.
773
   */
774
  template <typename U1,
775
            typename T1>
776
  static EventId ScheduleNow (void (*f)(U1), T1 a1);
777
778
  /**
779
   * @see ScheduleNow(*)
780
   * @tparam U1 @deduced Formal type of the first argument to the function.
781
   * @tparam U2 @deduced Formal type of the second argument to the function.
782
   * @tparam T1 @deduced Actual type of the first argument.
783
   * @tparam T2 @deduced Actual type of the second argument.
784
   * @param [in] f The function to invoke
785
   * @param [in] a1 The first argument to pass to the function to invoke
786
   * @param [in] a2 The second argument to pass to the function to invoke
787
   * @return The EventId of the scheduled event.
788
   */
789
  template <typename U1, typename U2,
790
            typename T1, typename T2>
791
  static EventId ScheduleNow (void (*f)(U1,U2), T1 a1, T2 a2);
792
793
  /**
794
   * @see ScheduleNow(*)
795
   * @tparam U1 @deduced Formal type of the first argument to the function.
796
   * @tparam U2 @deduced Formal type of the second argument to the function.
797
   * @tparam U3 @deduced Formal type of the third argument to the function.
798
   * @tparam T1 @deduced Actual type of the first argument.
799
   * @tparam T2 @deduced Actual type of the second argument.
800
   * @tparam T3 @deduced Actual type of the third argument.
801
   * @param [in] f The function to invoke
802
   * @param [in] a1 The first argument to pass to the function to invoke
803
   * @param [in] a2 The second argument to pass to the function to invoke
804
   * @param [in] a3 The third argument to pass to the function to invoke
805
   * @return The EventId of the scheduled event.
806
   */
807
  template <typename U1, typename U2, typename U3,
808
            typename T1, typename T2, typename T3>
809
  static EventId ScheduleNow (void (*f)(U1,U2,U3), T1 a1, T2 a2, T3 a3);
810
811
  /**
812
   * @see ScheduleNow(*)
813
   * @tparam U1 @deduced Formal type of the first argument to the function.
814
   * @tparam U2 @deduced Formal type of the second argument to the function.
815
   * @tparam U3 @deduced Formal type of the third argument to the function.
816
   * @tparam U4 @deduced Formal type of the fourth argument to the function.
817
   * @tparam T1 @deduced Actual type of the first argument.
818
   * @tparam T2 @deduced Actual type of the second argument.
819
   * @tparam T3 @deduced Actual type of the third argument.
820
   * @tparam T4 @deduced Actual type of the fourth argument.
821
   * @param [in] f The function to invoke
822
   * @param [in] a1 The first argument to pass to the function to invoke
823
   * @param [in] a2 The second argument to pass to the function to invoke
824
   * @param [in] a3 The third argument to pass to the function to invoke
825
   * @param [in] a4 The fourth argument to pass to the function to invoke
826
   * @return The EventId of the scheduled event.
827
   */
828
  template <typename U1, typename U2, typename U3, typename U4,
829
            typename T1, typename T2, typename T3, typename T4>
830
  static EventId ScheduleNow (void (*f)(U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4);
831
832
  /**
833
   * @see ScheduleNow(*)
834
   * @tparam U1 @deduced Formal type of the first argument to the function.
835
   * @tparam U2 @deduced Formal type of the second argument to the function.
836
   * @tparam U3 @deduced Formal type of the third argument to the function.
837
   * @tparam U4 @deduced Formal type of the fourth argument to the function.
838
   * @tparam U5 @deduced Formal type of the fifth argument to the function.
839
   * @tparam T1 @deduced Actual type of the first argument.
840
   * @tparam T2 @deduced Actual type of the second argument.
841
   * @tparam T3 @deduced Actual type of the third argument.
842
   * @tparam T4 @deduced Actual type of the fourth argument.
843
   * @tparam T5 @deduced Actual type of the fifth argument.
844
   * @param [in] f The function to invoke
845
   * @param [in] a1 The first argument to pass to the function to invoke
846
   * @param [in] a2 The second argument to pass to the function to invoke
847
   * @param [in] a3 The third argument to pass to the function to invoke
848
   * @param [in] a4 The fourth argument to pass to the function to invoke
849
   * @param [in] a5 The fifth argument to pass to the function to invoke
850
   * @return The EventId of the scheduled event.
851
   */
852
  template <typename U1, typename U2, typename U3, typename U4, typename U5,
853
            typename T1, typename T2, typename T3, typename T4, typename T5>
854
  static EventId ScheduleNow (void (*f)(U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
855
856
  /** @} */
298
  /** @} */
857
299
858
  /**
300
  /**
 Lines 860-1068    Link Here 
860
   */
302
   */
861
  /** @{ */
303
  /** @{ */
862
  /**
304
  /**
863
   * 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.
864
   * All events scheduled to expire at "Destroy" time are scheduled FIFO, 
306
   * All events scheduled to expire at "Destroy" time are scheduled FIFO,
865
   * after all normal events have expired and only when 
307
   * after all normal events have expired and only when
866
   * Simulator::Destroy is invoked.
308
   * Simulator::Destroy is invoked.
867
   *
309
   *
868
   * @tparam MEM @deduced Class method function signature type.
310
   * @tparam Us @deduced Formal function argument types.
869
   * @tparam OBJ @deduced Class type of the object.
311
   * @tparam Ts @deduced Actual function argument types.
870
   * @param [in] mem_ptr Member method pointer to invoke
312
   * @param [in] args Arguments to pass to MakeEvent.
871
   * @param [in] obj The object on which to invoke the member method
872
   * @return The EventId of the scheduled event.
313
   * @return The EventId of the scheduled event.
873
   */
314
   */
874
  template <typename MEM, typename OBJ>
315
  template <typename... Ts>
875
  static EventId ScheduleDestroy (MEM mem_ptr, OBJ obj);
316
  static EventId ScheduleDestroy (Ts&&... args);
876
317
877
  /**
318
  /**
878
   * @see ScheduleDestroy(MEM,OBJ)
319
   * Schedule an event to run at the end of the simulation, when Simulator::Destroy() is called.
879
   * @tparam MEM @deduced Class method function signature type.
320
   * All events scheduled to expire at "Destroy" time are scheduled FIFO,
880
   * @tparam OBJ @deduced Class type of the object.
321
   * after all normal events have expired and only when
881
   * @tparam T1 @deduced Type of first argument.
322
   * Simulator::Destroy is invoked.
882
   * @param [in] mem_ptr Member method pointer to invoke
323
   *
883
   * @param [in] obj The object on which to invoke the member method
324
   * @tparam Us @deduced Formal function argument types.
884
   * @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.
885
   * @return The EventId of the scheduled event.
328
   * @return The EventId of the scheduled event.
886
   */
329
   */
887
  template <typename MEM, typename OBJ, 
330
  template <typename... Us, typename... Ts>
888
            typename T1>
331
  static EventId ScheduleDestroy (void (*f)(Us...), Ts&&... args);
889
  static EventId ScheduleDestroy (MEM mem_ptr, OBJ obj, T1 a1);
890
891
  /**
892
   * @see ScheduleDestroy(MEM,OBJ)
893
   * @tparam MEM @deduced Class method function signature type.
894
   * @tparam OBJ @deduced Class type of the object.
895
   * @tparam T1 @deduced Type of first argument.
896
   * @tparam T2 @deduced Type of second argument.
897
   * @param [in] mem_ptr Member method pointer to invoke
898
   * @param [in] obj The object on which to invoke the member method
899
   * @param [in] a1 The first argument to pass to the invoked method
900
   * @param [in] a2 The second argument to pass to the invoked method
901
   * @return The EventId of the scheduled event.
902
   */
903
  template <typename MEM, typename OBJ,
904
            typename T1, typename T2>
905
  static EventId ScheduleDestroy (MEM mem_ptr, OBJ obj, T1 a1, T2 a2);
906
907
  /**
908
   * @see ScheduleDestroy(MEM,OBJ)
909
   * @tparam MEM @deduced Class method function signature type.
910
   * @tparam OBJ @deduced Class type of the object.
911
   * @tparam T1 @deduced Type of first argument.
912
   * @tparam T2 @deduced Type of second argument.
913
   * @tparam T3 @deduced Type of third argument.
914
   * @param [in] mem_ptr Member method pointer to invoke
915
   * @param [in] obj The object on which to invoke the member method
916
   * @param [in] a1 The first argument to pass to the invoked method
917
   * @param [in] a2 The second argument to pass to the invoked method
918
   * @param [in] a3 The third argument to pass to the invoked method
919
   * @return The EventId of the scheduled event.
920
   */
921
  template <typename MEM, typename OBJ, 
922
            typename T1, typename T2, typename T3>
923
  static EventId ScheduleDestroy (MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3);
924
925
  /**
926
   * @see ScheduleDestroy(MEM,OBJ)
927
   * @tparam MEM @deduced Class method function signature type.
928
   * @tparam OBJ @deduced Class type of the object.
929
   * @tparam T1 @deduced Type of first argument.
930
   * @tparam T2 @deduced Type of second argument.
931
   * @tparam T3 @deduced Type of third argument.
932
   * @tparam T4 @deduced Type of fourth argument.
933
   * @param [in] mem_ptr Member method pointer to invoke
934
   * @param [in] obj The object on which to invoke the member method
935
   * @param [in] a1 The first argument to pass to the invoked method
936
   * @param [in] a2 The second argument to pass to the invoked method
937
   * @param [in] a3 The third argument to pass to the invoked method
938
   * @param [in] a4 The fourth argument to pass to the invoked method
939
   * @return The EventId of the scheduled event.
940
   */
941
  template <typename MEM, typename OBJ, 
942
            typename T1, typename T2, typename T3, typename T4>
943
  static EventId ScheduleDestroy (MEM mem_ptr, OBJ obj, 
944
                                  T1 a1, T2 a2, T3 a3, T4 a4);
945
  /**
946
   * @see ScheduleDestroy(MEM,OBJ)
947
   * @tparam MEM @deduced Class method function signature type.
948
   * @tparam OBJ @deduced Class type of the object.
949
   * @tparam T1 @deduced Type of first argument.
950
   * @tparam T2 @deduced Type of second argument.
951
   * @tparam T3 @deduced Type of third argument.
952
   * @tparam T4 @deduced Type of fourth argument.
953
   * @tparam T5 @deduced Type of fifth argument.
954
   * @param [in] mem_ptr Member method pointer to invoke
955
   * @param [in] obj The object on which to invoke the member method
956
   * @param [in] a1 The first argument to pass to the invoked method
957
   * @param [in] a2 The second argument to pass to the invoked method
958
   * @param [in] a3 The third argument to pass to the invoked method
959
   * @param [in] a4 The fourth argument to pass to the invoked method
960
   * @param [in] a5 The fifth argument to pass to the invoked method
961
   * @return The EventId of the scheduled event.
962
   */
963
  template <typename MEM, typename OBJ, 
964
            typename T1, typename T2, typename T3, typename T4, typename T5>
965
  static EventId ScheduleDestroy (MEM mem_ptr, OBJ obj, 
966
                                  T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
967
  /**
968
   * @copybrief ScheduleDestroy(MEM,OBJ)
969
   * When Simulator::Destroy() is called, the
970
   * function will be invoked with any supplied arguments.
971
   * @param [in] f The function to invoke
972
   * @return The EventId of the scheduled event.
973
   */
974
  static EventId ScheduleDestroy (void (*f)(void));
975
976
  /**
977
   * @see ScheduleDestory((*)())
978
   * @tparam U1 @deduced Formal type of the first argument to the function.
979
   * @tparam T1 @deduced Actual type of the first argument.
980
   * @param [in] f The function to invoke
981
   * @param [in] a1 The first argument to pass to the function to invoke
982
   * @return The EventId of the scheduled event.
983
   */
984
  template <typename U1,
985
            typename T1>
986
  static EventId ScheduleDestroy (void (*f)(U1), T1 a1);
987
988
  /**
989
   * @see ScheduleDestory((*)())
990
   * @tparam U1 @deduced Formal type of the first argument to the function.
991
   * @tparam U2 @deduced Formal type of the second argument to the function.
992
   * @tparam T1 @deduced Actual type of the first argument.
993
   * @tparam T2 @deduced Actual type of the second argument.
994
   * @param [in] f The function to invoke
995
   * @param [in] a1 The first argument to pass to the function to invoke
996
   * @param [in] a2 The second argument to pass to the function to invoke
997
   * @return The EventId of the scheduled event.
998
   */
999
  template <typename U1, typename U2,
1000
            typename T1, typename T2>
1001
  static EventId ScheduleDestroy (void (*f)(U1,U2), T1 a1, T2 a2);
1002
1003
  /**
1004
   * @see ScheduleDestory((*)())
1005
   * @tparam U1 @deduced Formal type of the first argument to the function.
1006
   * @tparam U2 @deduced Formal type of the second argument to the function.
1007
   * @tparam U3 @deduced Formal type of the third argument to the function.
1008
   * @tparam T1 @deduced Actual type of the first argument.
1009
   * @tparam T2 @deduced Actual type of the second argument.
1010
   * @tparam T3 @deduced Actual type of the third argument.
1011
   * @param [in] f The function to invoke
1012
   * @param [in] a1 The first argument to pass to the function to invoke
1013
   * @param [in] a2 The second argument to pass to the function to invoke
1014
   * @param [in] a3 The third argument to pass to the function to invoke
1015
   * @return The EventId of the scheduled event.
1016
   */
1017
  template <typename U1, typename U2, typename U3,
1018
            typename T1, typename T2, typename T3>
1019
  static EventId ScheduleDestroy (void (*f)(U1,U2,U3), T1 a1, T2 a2, T3 a3);
1020
1021
  /**
1022
   * @see ScheduleDestory((*)())
1023
   * @tparam U1 @deduced Formal type of the first argument to the function.
1024
   * @tparam U2 @deduced Formal type of the second argument to the function.
1025
   * @tparam U3 @deduced Formal type of the third argument to the function.
1026
   * @tparam U4 @deduced Formal type of the fourth argument to the function.
1027
   * @tparam T1 @deduced Actual type of the first argument.
1028
   * @tparam T2 @deduced Actual type of the second argument.
1029
   * @tparam T3 @deduced Actual type of the third argument.
1030
   * @tparam T4 @deduced Actual type of the fourth argument.
1031
   * @param [in] f The function to invoke
1032
   * @param [in] a1 The first argument to pass to the function to invoke
1033
   * @param [in] a2 The second argument to pass to the function to invoke
1034
   * @param [in] a3 The third argument to pass to the function to invoke
1035
   * @param [in] a4 The fourth argument to pass to the function to invoke
1036
   * @return The EventId of the scheduled event.
1037
   */
1038
  template <typename U1, typename U2, typename U3, typename U4,
1039
            typename T1, typename T2, typename T3, typename T4>
1040
  static EventId ScheduleDestroy (void (*f)(U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4);
1041
1042
  /**
1043
   * @see ScheduleDestory((*)())
1044
   * @tparam U1 @deduced Formal type of the first argument to the function.
1045
   * @tparam U2 @deduced Formal type of the second argument to the function.
1046
   * @tparam U3 @deduced Formal type of the third argument to the function.
1047
   * @tparam U4 @deduced Formal type of the fourth argument to the function.
1048
   * @tparam U5 @deduced Formal type of the fifth argument to the function.
1049
   * @tparam T1 @deduced Actual type of the first argument.
1050
   * @tparam T2 @deduced Actual type of the second argument.
1051
   * @tparam T3 @deduced Actual type of the third argument.
1052
   * @tparam T4 @deduced Actual type of the fourth argument.
1053
   * @tparam T5 @deduced Actual type of the fifth argument.
1054
   * @param [in] f The function to invoke
1055
   * @param [in] a1 The first argument to pass to the function to invoke
1056
   * @param [in] a2 The second argument to pass to the function to invoke
1057
   * @param [in] a3 The third argument to pass to the function to invoke
1058
   * @param [in] a4 The fourth argument to pass to the function to invoke
1059
   * @param [in] a5 The fifth argument to pass to the function to invoke
1060
   * @return The EventId of the scheduled event.
1061
   */
1062
  template <typename U1, typename U2, typename U3, typename U4, typename U5,
1063
            typename T1, typename T2, typename T3, typename T4, typename T5>
1064
  static EventId ScheduleDestroy (void (*f)(U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
1065
1066
  /** @} */
332
  /** @} */
1067
333
1068
  /**
334
  /**
 Lines 1234-1579    Link Here 
1234
500
1235
namespace ns3 {
501
namespace ns3 {
1236
502
1237
template <typename MEM, typename OBJ>
503
template <typename... Ts>
1238
EventId Simulator::Schedule (Time const &delay, MEM mem_ptr, OBJ obj) 
504
EventId Simulator::Schedule (Time const &delay, Ts&&... args)
1239
{
505
{
1240
  return DoSchedule (delay, MakeEvent (mem_ptr, obj));
506
  return DoSchedule (delay, MakeEvent (std::forward<Ts> (args)...));
1241
}
507
}
1242
508
1243
509
template <typename... Us, typename... Ts>
1244
template <typename MEM, typename OBJ,
510
EventId Simulator::Schedule (Time const &delay, void (*f)(Us...), Ts&&... args)
1245
          typename T1>
1246
EventId Simulator::Schedule (Time const &delay, MEM mem_ptr, OBJ obj, T1 a1) 
1247
{
511
{
1248
  return DoSchedule (delay, MakeEvent (mem_ptr, obj, a1));
512
  return DoSchedule (delay, MakeEvent (f, std::forward<Ts> (args)...));
1249
}
513
}
1250
514
1251
template <typename MEM, typename OBJ, 
515
template <typename... Ts>
1252
          typename T1, typename T2>
516
void Simulator::ScheduleWithContext (uint32_t context, Time const &delay, Ts&&... args)
1253
EventId Simulator::Schedule (Time const &delay, MEM mem_ptr, OBJ obj, T1 a1, T2 a2)
1254
{
517
{
1255
  return DoSchedule (delay, MakeEvent (mem_ptr, obj, a1, a2));
518
  return ScheduleWithContext (context, delay, MakeEvent (std::forward<Ts> (args)...));
1256
}
519
}
1257
520
1258
template <typename MEM, typename OBJ,
521
template <typename... Us, typename... Ts>
1259
          typename T1, typename T2, typename T3>
522
void Simulator::ScheduleWithContext (uint32_t context, Time const &delay, void (*f)(Us...), Ts&&... args)
1260
EventId Simulator::Schedule (Time const &delay, MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3) 
1261
{
523
{
1262
  return DoSchedule (delay, MakeEvent (mem_ptr, obj, a1, a2, a3));
524
  return ScheduleWithContext (context, delay, MakeEvent (f, std::forward<Ts> (args)...));
1263
}
525
}
1264
526
1265
template <typename MEM, typename OBJ, 
527
template <typename... Ts>
1266
          typename T1, typename T2, typename T3, typename T4>
528
EventId
1267
EventId Simulator::Schedule (Time const &delay, MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4) 
529
Simulator::ScheduleNow (Ts&&... args)
1268
{
530
{
1269
  return DoSchedule (delay, MakeEvent (mem_ptr, obj, a1, a2, a3, a4));
531
  return DoScheduleNow (MakeEvent (std::forward<Ts> (args)...));
1270
}
532
}
1271
533
1272
template <typename MEM, typename OBJ, 
534
template <typename... Us, typename... Ts>
1273
          typename T1, typename T2, typename T3, typename T4, typename T5>
535
EventId
1274
EventId Simulator::Schedule (Time const &delay, MEM mem_ptr, OBJ obj, 
536
Simulator::ScheduleNow (void (*f)(Us...), Ts&&... args)
1275
                             T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) 
1276
{
537
{
1277
  return DoSchedule (delay, MakeEvent (mem_ptr, obj, a1, a2, a3, a4, a5));
538
  return DoScheduleNow (MakeEvent (f, std::forward<Ts> (args)...));
1278
}
539
}
1279
540
1280
template <typename U1,
541
template <typename... Ts>
1281
          typename T1>
542
EventId
1282
EventId Simulator::Schedule (Time const &delay, void (*f)(U1), T1 a1)
543
Simulator::ScheduleDestroy (Ts&&... args)
1283
{
544
{
1284
  return DoSchedule (delay, MakeEvent (f, a1));
545
  return DoScheduleDestroy (MakeEvent (std::forward<Ts> (args)...));
1285
}
546
}
1286
547
1287
template <typename U1, typename U2, 
548
template <typename... Us, typename... Ts>
1288
          typename T1, typename T2>
549
EventId
1289
EventId Simulator::Schedule (Time const &delay, void (*f)(U1,U2), T1 a1, T2 a2)
550
Simulator::ScheduleDestroy (void (*f)(Us...), Ts&&... args)
1290
{
551
{
1291
  return DoSchedule (delay, MakeEvent (f, a1, a2));
552
  return DoScheduleDestroy (MakeEvent (f, std::forward<Ts> (args)...));
1292
}
1293
1294
template <typename U1, typename U2, typename U3,
1295
          typename T1, typename T2, typename T3>
1296
EventId Simulator::Schedule (Time const &delay, void (*f)(U1,U2,U3), T1 a1, T2 a2, T3 a3)
1297
{
1298
  return DoSchedule (delay, MakeEvent (f, a1, a2, a3));
1299
}
1300
1301
template <typename U1, typename U2, typename U3, typename U4,
1302
          typename T1, typename T2, typename T3, typename T4>
1303
EventId Simulator::Schedule (Time const &delay, void (*f)(U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4)
1304
{
1305
  return DoSchedule (delay, MakeEvent (f, a1, a2, a3, a4));
1306
}
1307
1308
template <typename U1, typename U2, typename U3, typename U4, typename U5,
1309
          typename T1, typename T2, typename T3, typename T4, typename T5>
1310
EventId Simulator::Schedule (Time const &delay, void (*f)(U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
1311
{
1312
  return DoSchedule (delay, MakeEvent (f, a1, a2, a3, a4, a5));
1313
}
1314
1315
1316
1317
1318
template <typename MEM, typename OBJ>
1319
void Simulator::ScheduleWithContext (uint32_t context, Time const &delay, MEM mem_ptr, OBJ obj)
1320
{
1321
  ScheduleWithContext (context, delay, MakeEvent (mem_ptr, obj));
1322
}
1323
1324
1325
template <typename MEM, typename OBJ,
1326
          typename T1>
1327
void Simulator::ScheduleWithContext (uint32_t context, Time const &delay, MEM mem_ptr, OBJ obj, T1 a1)
1328
{
1329
  return ScheduleWithContext (context, delay, MakeEvent (mem_ptr, obj, a1));
1330
}
1331
1332
template <typename MEM, typename OBJ,
1333
          typename T1, typename T2>
1334
void Simulator::ScheduleWithContext (uint32_t context, Time const &delay, MEM mem_ptr, OBJ obj, T1 a1, T2 a2)
1335
{
1336
  return ScheduleWithContext (context, delay, MakeEvent (mem_ptr, obj, a1, a2));
1337
}
1338
1339
template <typename MEM, typename OBJ,
1340
          typename T1, typename T2, typename T3>
1341
void Simulator::ScheduleWithContext (uint32_t context, Time const &delay, MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3)
1342
{
1343
  return ScheduleWithContext (context, delay, MakeEvent (mem_ptr, obj, a1, a2, a3));
1344
}
1345
1346
template <typename MEM, typename OBJ,
1347
          typename T1, typename T2, typename T3, typename T4>
1348
void Simulator::ScheduleWithContext (uint32_t context, Time const &delay, MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4)
1349
{
1350
  return ScheduleWithContext (context, delay, MakeEvent (mem_ptr, obj, a1, a2, a3, a4));
1351
}
1352
1353
template <typename MEM, typename OBJ,
1354
          typename T1, typename T2, typename T3, typename T4, typename T5>
1355
void Simulator::ScheduleWithContext (uint32_t context, Time const &delay, MEM mem_ptr, OBJ obj,
1356
                                     T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
1357
{
1358
  return ScheduleWithContext (context, delay, MakeEvent (mem_ptr, obj, a1, a2, a3, a4, a5));
1359
}
1360
1361
template <typename U1,
1362
          typename T1>
1363
void Simulator::ScheduleWithContext (uint32_t context, Time const &delay, void (*f)(U1), T1 a1)
1364
{
1365
  return ScheduleWithContext (context, delay, MakeEvent (f, a1));
1366
}
1367
1368
template <typename U1, typename U2,
1369
          typename T1, typename T2>
1370
void Simulator::ScheduleWithContext (uint32_t context, Time const &delay, void (*f)(U1,U2), T1 a1, T2 a2)
1371
{
1372
  return ScheduleWithContext (context, delay, MakeEvent (f, a1, a2));
1373
}
1374
1375
template <typename U1, typename U2, typename U3,
1376
          typename T1, typename T2, typename T3>
1377
void Simulator::ScheduleWithContext (uint32_t context, Time const &delay, void (*f)(U1,U2,U3), T1 a1, T2 a2, T3 a3)
1378
{
1379
  return ScheduleWithContext (context, delay, MakeEvent (f, a1, a2, a3));
1380
}
1381
1382
template <typename U1, typename U2, typename U3, typename U4,
1383
          typename T1, typename T2, typename T3, typename T4>
1384
void Simulator::ScheduleWithContext (uint32_t context, Time const &delay, void (*f)(U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4)
1385
{
1386
  return ScheduleWithContext (context, delay, MakeEvent (f, a1, a2, a3, a4));
1387
}
1388
1389
template <typename U1, typename U2, typename U3, typename U4, typename U5,
1390
          typename T1, typename T2, typename T3, typename T4, typename T5>
1391
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)
1392
{
1393
  return ScheduleWithContext (context, delay, MakeEvent (f, a1, a2, a3, a4, a5));
1394
}
1395
1396
1397
1398
1399
template <typename MEM, typename OBJ>
1400
EventId
1401
Simulator::ScheduleNow (MEM mem_ptr, OBJ obj) 
1402
{
1403
  return DoScheduleNow (MakeEvent (mem_ptr, obj));
1404
}
1405
1406
1407
template <typename MEM, typename OBJ, 
1408
          typename T1>
1409
EventId
1410
Simulator::ScheduleNow (MEM mem_ptr, OBJ obj, T1 a1) 
1411
{
1412
  return DoScheduleNow (MakeEvent (mem_ptr, obj, a1));
1413
}
1414
1415
template <typename MEM, typename OBJ, 
1416
          typename T1, typename T2>
1417
EventId
1418
Simulator::ScheduleNow (MEM mem_ptr, OBJ obj, T1 a1, T2 a2) 
1419
{
1420
  return DoScheduleNow (MakeEvent (mem_ptr, obj, a1, a2));
1421
}
1422
1423
template <typename MEM, typename OBJ, 
1424
          typename T1, typename T2, typename T3>
1425
EventId
1426
Simulator::ScheduleNow (MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3) 
1427
{
1428
  return DoScheduleNow (MakeEvent (mem_ptr, obj, a1, a2, a3));
1429
}
1430
1431
template <typename MEM, typename OBJ, 
1432
          typename T1, typename T2, typename T3, typename T4>
1433
EventId
1434
Simulator::ScheduleNow (MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4) 
1435
{
1436
  return DoScheduleNow (MakeEvent (mem_ptr, obj, a1, a2, a3, a4));
1437
}
1438
1439
template <typename MEM, typename OBJ, 
1440
          typename T1, typename T2, typename T3, typename T4, typename T5>
1441
EventId
1442
Simulator::ScheduleNow (MEM mem_ptr, OBJ obj, 
1443
                        T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) 
1444
{
1445
  return DoScheduleNow (MakeEvent (mem_ptr, obj, a1, a2, a3, a4, a5));
1446
}
1447
1448
template <typename U1,
1449
          typename T1>
1450
EventId
1451
Simulator::ScheduleNow (void (*f)(U1), T1 a1)
1452
{
1453
  return DoScheduleNow (MakeEvent (f, a1));
1454
}
1455
1456
template <typename U1, typename U2,
1457
          typename T1, typename T2>
1458
EventId
1459
Simulator::ScheduleNow (void (*f)(U1,U2), T1 a1, T2 a2)
1460
{
1461
  return DoScheduleNow (MakeEvent (f, a1, a2));
1462
}
1463
1464
template <typename U1, typename U2, typename U3,
1465
          typename T1, typename T2, typename T3>
1466
EventId
1467
Simulator::ScheduleNow (void (*f)(U1,U2,U3), T1 a1, T2 a2, T3 a3)
1468
{
1469
  return DoScheduleNow (MakeEvent (f, a1, a2, a3));
1470
}
1471
1472
template <typename U1, typename U2, typename U3, typename U4,
1473
          typename T1, typename T2, typename T3, typename T4>
1474
EventId
1475
Simulator::ScheduleNow (void (*f)(U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4)
1476
{
1477
  return DoScheduleNow (MakeEvent (f, a1, a2, a3, a4));
1478
}
1479
1480
template <typename U1, typename U2, typename U3, typename U4, typename U5,
1481
          typename T1, typename T2, typename T3, typename T4, typename T5>
1482
EventId
1483
Simulator::ScheduleNow (void (*f)(U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
1484
{
1485
  return DoScheduleNow (MakeEvent (f, a1, a2, a3, a4, a5));
1486
}
1487
1488
1489
1490
template <typename MEM, typename OBJ>
1491
EventId
1492
Simulator::ScheduleDestroy (MEM mem_ptr, OBJ obj) 
1493
{
1494
  return DoScheduleDestroy (MakeEvent (mem_ptr, obj));
1495
}
1496
1497
1498
template <typename MEM, typename OBJ, 
1499
          typename T1>
1500
EventId
1501
Simulator::ScheduleDestroy (MEM mem_ptr, OBJ obj, T1 a1) 
1502
{
1503
  return DoScheduleDestroy (MakeEvent (mem_ptr, obj, a1));
1504
}
1505
1506
template <typename MEM, typename OBJ, 
1507
          typename T1, typename T2>
1508
EventId
1509
Simulator::ScheduleDestroy (MEM mem_ptr, OBJ obj, T1 a1, T2 a2) 
1510
{
1511
  return DoScheduleDestroy (MakeEvent (mem_ptr, obj, a1, a2));
1512
}
1513
1514
template <typename MEM, typename OBJ, 
1515
          typename T1, typename T2, typename T3>
1516
EventId
1517
Simulator::ScheduleDestroy (MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3) 
1518
{
1519
  return DoScheduleDestroy (MakeEvent (mem_ptr, obj, a1, a2, a3));
1520
}
1521
1522
template <typename MEM, typename OBJ,
1523
          typename T1, typename T2, typename T3, typename T4>
1524
EventId
1525
Simulator::ScheduleDestroy (MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4) 
1526
{
1527
  return DoScheduleDestroy (MakeEvent (mem_ptr, obj, a1, a2, a3, a4));
1528
}
1529
1530
template <typename MEM, typename OBJ, 
1531
          typename T1, typename T2, typename T3, typename T4, typename T5>
1532
EventId
1533
Simulator::ScheduleDestroy (MEM mem_ptr, OBJ obj, 
1534
                            T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) 
1535
{
1536
  return DoScheduleDestroy (MakeEvent (mem_ptr, obj, a1, a2, a3, a4, a5));
1537
}
1538
1539
template <typename U1,
1540
          typename T1>
1541
EventId
1542
Simulator::ScheduleDestroy (void (*f)(U1), T1 a1)
1543
{
1544
  return DoScheduleDestroy (MakeEvent (f, a1));
1545
}
1546
1547
template <typename U1, typename U2,
1548
          typename T1, typename T2>
1549
EventId
1550
Simulator::ScheduleDestroy (void (*f)(U1,U2), T1 a1, T2 a2)
1551
{
1552
  return DoScheduleDestroy (MakeEvent (f, a1, a2));
1553
}
1554
1555
template <typename U1, typename U2, typename U3,
1556
          typename T1, typename T2, typename T3>
1557
EventId
1558
Simulator::ScheduleDestroy (void (*f)(U1,U2,U3), T1 a1, T2 a2, T3 a3)
1559
{
1560
  return DoScheduleDestroy (MakeEvent (f, a1, a2, a3));
1561
}
1562
1563
template <typename U1, typename U2, typename U3, typename U4,
1564
          typename T1, typename T2, typename T3, typename T4>
1565
EventId
1566
Simulator::ScheduleDestroy (void (*f)(U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4)
1567
{
1568
  return DoScheduleDestroy (MakeEvent (f, a1, a2, a3, a4));
1569
}
1570
1571
template <typename U1, typename U2, typename U3, typename U4, typename U5,
1572
          typename T1, typename T2, typename T3, typename T4, typename T5>
1573
EventId
1574
Simulator::ScheduleDestroy (void (*f)(U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
1575
{
1576
  return DoScheduleDestroy (MakeEvent (f, a1, a2, a3, a4, a5));
1577
}
553
}
1578
554
1579
} // 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