21 #ifndef TRACED_CALLBACK_H 22 #define TRACED_CALLBACK_H 58 template<
typename T1 = empty,
typename T2 = empty,
59 typename T3 = empty,
typename T4 = empty,
60 typename T5 = empty,
typename T6 = empty,
61 typename T7 = empty,
typename T8 = empty>
141 void operator() (T1 a1, T2 a2, T3 a3, T4 a4)
const;
155 void operator() (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
const;
171 void operator() (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6)
const;
189 void operator() (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7)
const;
209 void operator() (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8)
const;
237 typedef std::list<Callback<void,T1,T2,T3,T4,T5,T6,T7,T8> >
CallbackList;
251 template<
typename T1,
typename T2,
252 typename T3,
typename T4,
253 typename T5,
typename T6,
254 typename T7,
typename T8>
259 template<
typename T1,
typename T2,
260 typename T3,
typename T4,
261 typename T5,
typename T6,
262 typename T7,
typename T8>
267 if (!cb.
Assign (callback))
269 m_callbackList.push_back (cb);
271 template<
typename T1,
typename T2,
272 typename T3,
typename T4,
273 typename T5,
typename T6,
274 typename T7,
typename T8>
279 if (!cb.
Assign (callback))
282 m_callbackList.push_back (realCb);
284 template<
typename T1,
typename T2,
285 typename T3,
typename T4,
286 typename T5,
typename T6,
287 typename T7,
typename T8>
291 for (
typename CallbackList::iterator i = m_callbackList.begin ();
292 i != m_callbackList.end (); )
294 if ((*i).IsEqual (callback))
296 i = m_callbackList.erase (i);
304 template<
typename T1,
typename T2,
305 typename T3,
typename T4,
306 typename T5,
typename T6,
307 typename T7,
typename T8>
312 if (!cb.
Assign (callback))
317 template<
typename T1,
typename T2,
318 typename T3,
typename T4,
319 typename T5,
typename T6,
320 typename T7,
typename T8>
324 for (
typename CallbackList::const_iterator i = m_callbackList.begin ();
325 i != m_callbackList.end (); i++)
330 template<
typename T1,
typename T2,
331 typename T3,
typename T4,
332 typename T5,
typename T6,
333 typename T7,
typename T8>
337 for (
typename CallbackList::const_iterator i = m_callbackList.begin ();
338 i != m_callbackList.end (); i++)
343 template<
typename T1,
typename T2,
344 typename T3,
typename T4,
345 typename T5,
typename T6,
346 typename T7,
typename T8>
350 for (
typename CallbackList::const_iterator i = m_callbackList.begin ();
351 i != m_callbackList.end (); i++)
356 template<
typename T1,
typename T2,
357 typename T3,
typename T4,
358 typename T5,
typename T6,
359 typename T7,
typename T8>
363 for (
typename CallbackList::const_iterator i = m_callbackList.begin ();
364 i != m_callbackList.end (); i++)
369 template<
typename T1,
typename T2,
370 typename T3,
typename T4,
371 typename T5,
typename T6,
372 typename T7,
typename T8>
374 TracedCallback<T1,T2,T3,T4,T5,T6,T7,T8>::operator() (T1 a1, T2 a2, T3 a3, T4 a4)
const 376 for (
typename CallbackList::const_iterator i = m_callbackList.begin ();
377 i != m_callbackList.end (); i++)
379 (*i)(a1, a2, a3, a4);
382 template<
typename T1,
typename T2,
383 typename T3,
typename T4,
384 typename T5,
typename T6,
385 typename T7,
typename T8>
387 TracedCallback<T1,T2,T3,T4,T5,T6,T7,T8>::operator() (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
const 389 for (
typename CallbackList::const_iterator i = m_callbackList.begin ();
390 i != m_callbackList.end (); i++)
392 (*i)(a1, a2, a3, a4, a5);
395 template<
typename T1,
typename T2,
396 typename T3,
typename T4,
397 typename T5,
typename T6,
398 typename T7,
typename T8>
400 TracedCallback<T1,T2,T3,T4,T5,T6,T7,T8>::operator() (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6)
const 402 for (
typename CallbackList::const_iterator i = m_callbackList.begin ();
403 i != m_callbackList.end (); i++)
405 (*i)(a1, a2, a3, a4, a5, a6);
408 template<
typename T1,
typename T2,
409 typename T3,
typename T4,
410 typename T5,
typename T6,
411 typename T7,
typename T8>
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 415 for (
typename CallbackList::const_iterator i = m_callbackList.begin ();
416 i != m_callbackList.end (); i++)
418 (*i)(a1, a2, a3, a4, a5, a6, a7);
421 template<
typename T1,
typename T2,
422 typename T3,
typename T4,
423 typename T5,
typename T6,
424 typename T7,
typename T8>
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 428 for (
typename CallbackList::const_iterator i = m_callbackList.begin ();
429 i != m_callbackList.end (); i++)
431 (*i)(a1, a2, a3, a4, a5, a6, a7, a8);
Forward calls to a chain of Callback.
Callback< R, T2, T3, T4, T5, T6, T7, T8, T9 > Bind(T a)
Bind the first arguments.
Base class for Callback class.
void DisconnectWithoutContext(std::string path, const CallbackBase &cb)
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
bool Assign(const CallbackBase &other)
Adopt the other's implementation, if type compatible.
Declaration of the various callback functions.
void(* Uint32Callback)(const uint32_t value)
TracedCallback signature for POD.
void DisconnectWithoutContext(const CallbackBase &callback)
Remove from the chain a Callback which was connected without a context.
void ConnectWithoutContext(std::string path, const CallbackBase &cb)
void Disconnect(const CallbackBase &callback, std::string path)
Remove from the chain a Callback which was connected with a context.
void Connect(std::string path, const CallbackBase &cb)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
#define NS_FATAL_ERROR_NO_MSG()
Report a fatal error and terminate.
void Connect(const CallbackBase &callback, std::string path)
Append a Callback to the chain with a context.
CallbackList m_callbackList
The chain of Callbacks.
void ConnectWithoutContext(const CallbackBase &callback)
Append a Callback to the chain (without a context).
void operator()(void) const
Functor which invokes the chain of Callbacks.
TracedCallback()
Constructor.
void Disconnect(std::string path, const CallbackBase &cb)
std::list< Callback< void, T1, T2, T3, T4, T5, T6, T7, T8 > > CallbackList
Container type for holding the chain of Callbacks.