--- a/src/core/model/make-event.h Sat Aug 22 01:27:44 2015 +0200
+++ b/src/core/model/make-event.h Sat Aug 22 10:20:11 2015 +0200
@@ -144,6 +144,32 @@
typename T1, typename T2, typename T3, typename T4, typename T5>
EventImpl * MakeEvent (MEM mem_ptr, OBJ obj,
T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
+
+/**
+ * \copybrief MakeEvent(MEM,OBJ)
+ * \tparam MEM The class method function signature.
+ * \tparam OBJ The class type holding the method.
+ * \tparam T1 Type of the first argument to the underlying function.
+ * \tparam T2 Type of the second argument to the underlying function.
+ * \tparam T3 Type of the third argument to the underlying function.
+ * \tparam T4 Type of the fourth argument to the underlying function.
+ * \tparam T5 Type of the fifth argument to the underlying function.
+ * \tparam T6 Type of the sixth argument to the underlying function.
+ * \param mem_ptr Class method member function pointer
+ * \param obj Class instance.
+ * \param a1 First argument value to be bound to the underlying function.
+ * \param a2 Second argument value to be bound to the underlying function.
+ * \param a3 Third argument value to be bound to the underlying function.
+ * \param a4 Fourth argument value to be bound to the underlying function.
+ * \param a5 Fifth argument value to be bound to the underlying function.
+ * \param a6 Sixth argument value to be bound to the underlying function.
+ * \returns The constructed EventImpl.
+ */
+template <typename MEM, typename OBJ,
+ typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
+EventImpl * MakeEvent (MEM mem_ptr, OBJ obj,
+ T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6);
+
/**@}*/
/**
@@ -253,6 +279,32 @@
template <typename U1, typename U2, typename U3, typename U4, typename U5,
typename T1, typename T2, typename T3, typename T4, typename T5>
EventImpl * MakeEvent (void (*f)(U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
+
+/**
+ * \copybrief MakeEvent(void(*f)(void))
+ * \tparam U1 Formal type of the first argument to the function.
+ * \tparam U2 Formal type of the second argument to the function.
+ * \tparam U3 Formal type of the third argument to the function.
+ * \tparam U4 Formal type of the fourth argument to the function.
+ * \tparam U5 Formal type of the fifth argument to the function.
+ * \tparam T1 Actual type of the first argument to the function.
+ * \tparam T2 Actual type of the second argument to the function.
+ * \tparam T3 Actual type of the third argument to the function.
+ * \tparam T4 Actual type of the fourth argument to the function.
+ * \tparam T5 Actual type of the fifth argument to the function.
+ * \tparam T6 Actual type of the sixth argument to the function.
+ * \param f The function pointer.
+ * \param a1 First argument to be bound to the function.
+ * \param a2 Second argument to be bound to the function.
+ * \param a3 Third argument to be bound to the function.
+ * \param a4 Fourth argument to be bound to the function.
+ * \param a5 Fifth argument to be bound to the function.
+ * \param a6 Sixth argument to be bound to the function.
+ * \returns The constructed EventImpl.
+ */
+template <typename U1, typename U2, typename U3, typename U4, typename U5, typename U6,
+ typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
+EventImpl * MakeEvent (void (*f)(U1,U2,U3,U4,U5,U6), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6);
/**@}*/
} // namespace ns3
@@ -500,6 +552,47 @@
return ev;
}
+template <typename MEM, typename OBJ,
+ typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
+EventImpl * MakeEvent (MEM mem_ptr, OBJ obj,
+ T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6)
+{
+ // six argument version
+ class EventMemberImpl6 : public EventImpl
+ {
+public:
+ EventMemberImpl6 (OBJ obj, MEM function, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6)
+ : m_obj (obj),
+ m_function (function),
+ m_a1 (a1),
+ m_a2 (a2),
+ m_a3 (a3),
+ m_a4 (a4),
+ m_a5 (a5),
+ m_a6 (a6)
+ {
+ }
+protected:
+ virtual ~EventMemberImpl6 ()
+ {
+ }
+private:
+ virtual void Notify (void)
+ {
+ (EventMemberImplObjTraits<OBJ>::GetReference (m_obj).*m_function)(m_a1, m_a2, m_a3, m_a4, m_a5, m_a6);
+ }
+ OBJ m_obj;
+ MEM m_function;
+ typename TypeTraits<T1>::ReferencedType m_a1;
+ typename TypeTraits<T2>::ReferencedType m_a2;
+ typename TypeTraits<T3>::ReferencedType m_a3;
+ typename TypeTraits<T4>::ReferencedType m_a4;
+ typename TypeTraits<T5>::ReferencedType m_a5;
+ typename TypeTraits<T6>::ReferencedType m_a6;
+ } *ev = new EventMemberImpl6 (obj, mem_ptr, a1, a2, a3, a4, a5, a6);
+ return ev;
+}
+
template <typename U1, typename T1>
EventImpl * MakeEvent (void (*f)(U1), T1 a1)
{
@@ -668,6 +761,46 @@
return ev;
}
+template <typename U1, typename U2, typename U3, typename U4, typename U5, typename U6,
+ typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
+EventImpl * MakeEvent (void (*f)(U1,U2,U3,U4,U5,U6), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6)
+{
+ // six arg version
+ class EventFunctionImpl6 : public EventImpl
+ {
+public:
+ typedef void (*F)(U1,U2,U3,U4,U5,U6);
+
+ EventFunctionImpl6 (F function, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6)
+ : m_function (function),
+ m_a1 (a1),
+ m_a2 (a2),
+ m_a3 (a3),
+ m_a4 (a4),
+ m_a5 (a5),
+ m_a6 (a6)
+ {
+ }
+protected:
+ virtual ~EventFunctionImpl6 ()
+ {
+ }
+private:
+ virtual void Notify (void)
+ {
+ (*m_function)(m_a1, m_a2, m_a3, m_a4, m_a5, m_a6);
+ }
+ F m_function;
+ typename TypeTraits<T1>::ReferencedType m_a1;
+ typename TypeTraits<T2>::ReferencedType m_a2;
+ typename TypeTraits<T3>::ReferencedType m_a3;
+ typename TypeTraits<T4>::ReferencedType m_a4;
+ typename TypeTraits<T5>::ReferencedType m_a5;
+ typename TypeTraits<T6>::ReferencedType m_a6;
+ } *ev = new EventFunctionImpl6 (f, a1, a2, a3, a4, a5, a6);
+ return ev;
+}
+
} // namespace ns3
#endif /* MAKE_EVENT_H */
--- a/src/core/model/simulator.h Sat Aug 22 01:27:44 2015 +0200
+++ b/src/core/model/simulator.h Sat Aug 22 10:20:11 2015 +0200
@@ -62,7 +62,7 @@
* expire first.
*
* A simple example of how to use the Simulator class to schedule events
- * is shown in sample-simulator.cc:
+ * is shown in sample-simulator.cc ::
* \include src/core/examples/sample-simulator.cc
*
* \todo Define what the simulation or event context means.
@@ -211,6 +211,24 @@
typename T1, typename T2, typename T3, typename T4, typename T5>
static EventId Schedule (Time const &time, MEM mem_ptr, OBJ obj,
T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
+
+ /**
+ * @param time the relative expiration time of the event.
+ * @param mem_ptr member method pointer to invoke
+ * @param obj the object on which to invoke the member method
+ * @param a1 the first argument to pass to the invoked method
+ * @param a2 the second argument to pass to the invoked method
+ * @param a3 the third argument to pass to the invoked method
+ * @param a4 the fourth argument to pass to the invoked method
+ * @param a5 the fifth argument to pass to the invoked method
+ * @param a6 the sixth argument to pass to the invoked method
+ * @returns an id for the scheduled event.
+ */
+ template <typename MEM, typename OBJ,
+ typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
+ static EventId Schedule (Time const &time, MEM mem_ptr, OBJ obj,
+ T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6);
+
/**
* @param time the relative expiration time of the event.
* @param f the function to invoke
@@ -275,6 +293,21 @@
typename T1, typename T2, typename T3, typename T4, typename T5>
static EventId Schedule (Time const &time, void (*f)(U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
+ /**
+ * @param time the relative expiration time of the event.
+ * @param f the function to invoke
+ * @param a1 the first argument to pass to the function to invoke
+ * @param a2 the second argument to pass to the function to invoke
+ * @param a3 the third argument to pass to the function to invoke
+ * @param a4 the fourth argument to pass to the function to invoke
+ * @param a5 the fifth argument to pass to the function to invoke
+ * @param a6 the sixth argument to pass to the function to invoke
+ * @returns an id for the scheduled event.
+ */
+ template <typename U1, typename U2, typename U3, typename U4, typename U5, typename U6,
+ typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
+ static EventId Schedule (Time const &time, void (*f)(U1,U2,U3,U4,U5,U6), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6);
+
/** @} */
/**
@@ -369,6 +402,26 @@
typename T1, typename T2, typename T3, typename T4, typename T5>
static void ScheduleWithContext (uint32_t context, Time const &time, MEM mem_ptr, OBJ obj,
T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
+
+ /**
+ * This method is thread-safe: it can be called from any thread.
+ *
+ * @param time the relative expiration time of the event.
+ * @param context user-specified context parameter
+ * @param mem_ptr member method pointer to invoke
+ * @param obj the object on which to invoke the member method
+ * @param a1 the first argument to pass to the invoked method
+ * @param a2 the second argument to pass to the invoked method
+ * @param a3 the third argument to pass to the invoked method
+ * @param a4 the fourth argument to pass to the invoked method
+ * @param a5 the fifth argument to pass to the invoked method
+ * @param a6 the sixth argument to pass to the invoked method
+ */
+ template <typename MEM, typename OBJ,
+ typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
+ static void ScheduleWithContext (uint32_t context, Time const &time, MEM mem_ptr, OBJ obj,
+ T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6);
+
/**
* This method is thread-safe: it can be called from any thread.
*
@@ -445,6 +498,23 @@
typename T1, typename T2, typename T3, typename T4, typename T5>
static void ScheduleWithContext (uint32_t context, Time const &time, void (*f)(U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
+ /**
+ * This method is thread-safe: it can be called from any thread.
+ *
+ * @param time the relative expiration time of the event.
+ * @param context user-specified context parameter
+ * @param f the function to invoke
+ * @param a1 the first argument to pass to the function to invoke
+ * @param a2 the second argument to pass to the function to invoke
+ * @param a3 the third argument to pass to the function to invoke
+ * @param a4 the fourth argument to pass to the function to invoke
+ * @param a5 the fifth argument to pass to the function to invoke
+ * @param a6 the sixth argument to pass to the function to invoke
+ */
+ template <typename U1, typename U2, typename U3, typename U4, typename U5, typename U6,
+ typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
+ static void ScheduleWithContext (uint32_t context, Time const &time, void (*f)(U1,U2,U3,U4,U5,U6), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6);
+
/** @} */
/**
@@ -523,6 +593,23 @@
typename T1, typename T2, typename T3, typename T4, typename T5>
static EventId ScheduleNow (MEM mem_ptr, OBJ obj,
T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
+
+ /**
+ * @param mem_ptr member method pointer to invoke
+ * @param obj the object on which to invoke the member method
+ * @param a1 the first argument to pass to the invoked method
+ * @param a2 the second argument to pass to the invoked method
+ * @param a3 the third argument to pass to the invoked method
+ * @param a4 the fourth argument to pass to the invoked method
+ * @param a5 the fifth argument to pass to the invoked method
+ * @param a6 the sixth argument to pass to the invoked method
+ * @return The EventId of the scheduled event.
+ */
+ template <typename MEM, typename OBJ,
+ typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
+ static EventId ScheduleNow (MEM mem_ptr, OBJ obj,
+ T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6);
+
/**
* @param f the function to invoke
* @return The EventId of the scheduled event.
@@ -584,6 +671,20 @@
typename T1, typename T2, typename T3, typename T4, typename T5>
static EventId ScheduleNow (void (*f)(U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
+ /**
+ * @param f the function to invoke
+ * @param a1 the first argument to pass to the function to invoke
+ * @param a2 the second argument to pass to the function to invoke
+ * @param a3 the third argument to pass to the function to invoke
+ * @param a4 the fourth argument to pass to the function to invoke
+ * @param a5 the fifth argument to pass to the function to invoke
+ * @param a6 the sixth argument to pass to the function to invoke
+ * @return The EventId of the scheduled event.
+ */
+ template <typename U1, typename U2, typename U3, typename U4, typename U5, typename U6,
+ typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
+ static EventId ScheduleNow (void (*f)(U1,U2,U3,U4,U5,U6), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6);
+
/** @} */
/**
@@ -663,6 +764,23 @@
typename T1, typename T2, typename T3, typename T4, typename T5>
static EventId ScheduleDestroy (MEM mem_ptr, OBJ obj,
T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
+
+ /**
+ * @param mem_ptr member method pointer to invoke
+ * @param obj the object on which to invoke the member method
+ * @param a1 the first argument to pass to the invoked method
+ * @param a2 the second argument to pass to the invoked method
+ * @param a3 the third argument to pass to the invoked method
+ * @param a4 the fourth argument to pass to the invoked method
+ * @param a5 the fifth argument to pass to the invoked method
+ * @param a6 the sixth argument to pass to the invoked method
+ * @return The EventId of the scheduled event.
+ */
+ template <typename MEM, typename OBJ,
+ typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
+ static EventId ScheduleDestroy (MEM mem_ptr, OBJ obj,
+ T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6);
+
/**
* @param f the function to invoke
* @return The EventId of the scheduled event.
@@ -724,6 +842,20 @@
typename T1, typename T2, typename T3, typename T4, typename T5>
static EventId ScheduleDestroy (void (*f)(U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
+ /**
+ * @param f the function to invoke
+ * @param a1 the first argument to pass to the function to invoke
+ * @param a2 the second argument to pass to the function to invoke
+ * @param a3 the third argument to pass to the function to invoke
+ * @param a4 the fourth argument to pass to the function to invoke
+ * @param a5 the fifth argument to pass to the function to invoke
+ * @param a6 the sixth argument to pass to the function to invoke
+ * @return The EventId of the scheduled event.
+ */
+ template <typename U1, typename U2, typename U3, typename U4, typename U5, typename U6,
+ typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
+ static EventId ScheduleDestroy (void (*f)(U1,U2,U3,U4,U5,U6), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6);
+
/** @} */
/** \copydoc SimulatorImpl::Remove */
@@ -858,6 +990,14 @@
return DoSchedule (time, MakeEvent (mem_ptr, obj, a1, a2, a3, a4, a5));
}
+template <typename MEM, typename OBJ,
+ typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
+EventId Simulator::Schedule (Time const &time, MEM mem_ptr, OBJ obj,
+ T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6)
+{
+ return DoSchedule (time, MakeEvent (mem_ptr, obj, a1, a2, a3, a4, a5, a6));
+}
+
template <typename U1, typename T1>
EventId Simulator::Schedule (Time const &time, void (*f)(U1), T1 a1)
{
@@ -892,6 +1032,12 @@
return DoSchedule (time, MakeEvent (f, a1, a2, a3, a4, a5));
}
+template <typename U1, typename U2, typename U3, typename U4, typename U5, typename U6,
+ typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
+EventId Simulator::Schedule (Time const &time, void (*f)(U1,U2,U3,U4,U5,U6), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6)
+{
+ return DoSchedule (time, MakeEvent (f, a1, a2, a3, a4, a5, a6));
+}
@@ -938,6 +1084,14 @@
return ScheduleWithContext (context, time, MakeEvent (mem_ptr, obj, a1, a2, a3, a4, a5));
}
+template <typename MEM, typename OBJ,
+ typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
+void Simulator::ScheduleWithContext (uint32_t context, Time const &time, MEM mem_ptr, OBJ obj,
+ T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6)
+{
+ return ScheduleWithContext (context, time, MakeEvent (mem_ptr, obj, a1, a2, a3, a4, a5, a6));
+}
+
template <typename U1, typename T1>
void Simulator::ScheduleWithContext (uint32_t context, Time const &time, void (*f)(U1), T1 a1)
{
@@ -972,7 +1126,12 @@
return ScheduleWithContext (context, time, MakeEvent (f, a1, a2, a3, a4, a5));
}
-
+template <typename U1, typename U2, typename U3, typename U4, typename U5, typename U6,
+ typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
+void Simulator::ScheduleWithContext (uint32_t context, Time const &time, void (*f)(U1,U2,U3,U4,U5,U6), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6)
+{
+ return ScheduleWithContext (context, time, MakeEvent (f, a1, a2, a3, a4, a5, a6));
+}
template <typename MEM, typename OBJ>
@@ -1024,6 +1183,15 @@
return DoScheduleNow (MakeEvent (mem_ptr, obj, a1, a2, a3, a4, a5));
}
+template <typename MEM, typename OBJ,
+ typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
+EventId
+Simulator::ScheduleNow (MEM mem_ptr, OBJ obj,
+ T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6)
+{
+ return DoScheduleNow (MakeEvent (mem_ptr, obj, a1, a2, a3, a4, a5, a6));
+}
+
template <typename U1,
typename T1>
EventId
@@ -1064,6 +1232,14 @@
return DoScheduleNow (MakeEvent (f, a1, a2, a3, a4, a5));
}
+template <typename U1, typename U2, typename U3, typename U4, typename U5, typename U6,
+ typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
+EventId
+Simulator::ScheduleNow (void (*f)(U1,U2,U3,U4,U5,U6), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6)
+{
+ return DoScheduleNow (MakeEvent (f, a1, a2, a3, a4, a5, a6));
+}
+
template <typename MEM, typename OBJ>
@@ -1115,6 +1291,15 @@
return DoScheduleDestroy (MakeEvent (mem_ptr, obj, a1, a2, a3, a4, a5));
}
+template <typename MEM, typename OBJ,
+ typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
+EventId
+Simulator::ScheduleDestroy (MEM mem_ptr, OBJ obj,
+ T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6)
+{
+ return DoScheduleDestroy (MakeEvent (mem_ptr, obj, a1, a2, a3, a4, a5, a6));
+}
+
template <typename U1,
typename T1>
EventId
@@ -1155,6 +1340,14 @@
return DoScheduleDestroy (MakeEvent (f, a1, a2, a3, a4, a5));
}
+template <typename U1, typename U2, typename U3, typename U4, typename U5, typename U6,
+ typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
+EventId
+Simulator::ScheduleDestroy (void (*f)(U1,U2,U3,U4,U5,U6), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6)
+{
+ return DoScheduleDestroy (MakeEvent (f, a1, a2, a3, a4, a5, a6));
+}
+
} // namespace ns3
#endif /* SIMULATOR_H */