52template <
typename MEM,
typename OBJ,
typename... Ts>
53std::enable_if_t<std::is_member_pointer_v<MEM>, EventImpl*>
MakeEvent(MEM mem_ptr,
76template <
typename... Us,
typename... Ts>
77EventImpl*
MakeEvent(
void (*f)(Us...), Ts... args);
142template <
typename MEM,
typename OBJ,
typename... Ts>
143std::enable_if_t<std::is_member_pointer_v<MEM>, EventImpl*>
149 EventMemberImpl() =
delete;
151 EventMemberImpl(OBJ obj, MEM function, Ts... args)
152 : m_function(std::bind(function, obj, args...))
157 ~EventMemberImpl()
override
162 void Notify()
override
167 std::function<void()> m_function;
168 }* ev =
new EventMemberImpl(obj, mem_ptr, args...);
173template <
typename... Us,
typename... Ts>
177 class EventFunctionImpl :
public EventImpl
180 EventFunctionImpl(
void (*function)(Us...), Ts... args)
181 : m_function(function),
187 ~EventFunctionImpl()
override
192 void Notify()
override
194 std::apply([
this](Ts... args) { (*m_function)(args...); }, m_arguments);
197 void (*m_function)(Us...);
198 std::tuple<std::remove_reference_t<Ts>...> m_arguments;
199 }* ev =
new EventFunctionImpl(f, args...);
208 class EventImplFunctional :
public EventImpl
211 EventImplFunctional(T function)
212 : m_function(function)
216 ~EventImplFunctional()
override
221 void Notify()
override
227 }* ev =
new EventImplFunctional(function);
ns3::EventImpl declarations.
std::enable_if_t< std::is_member_pointer_v< MEM >, EventImpl * > MakeEvent(MEM mem_ptr, OBJ obj, Ts... args)
Make an EventImpl from class method members which take varying numbers of arguments.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static T & GetReference(T *p)
Helper for the MakeEvent functions which take a class method.