A Discrete-Event Network Simulator
API
callback.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2005,2006 INRIA
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19  */
20 
21 #ifndef CALLBACK_H
22 #define CALLBACK_H
23 
24 #include "ptr.h"
25 #include "fatal-error.h"
26 #include "empty.h"
27 #include "type-traits.h"
28 #include "attribute.h"
29 #include "attribute-helper.h"
30 #include "simple-ref-count.h"
31 #include <typeinfo>
32 
39 namespace ns3 {
40 
41 // Define the doxygen subgroups all at once,
42 // since the implementations are interleaved.
43 
112 template <typename T>
114 
121 template <typename T>
122 struct CallbackTraits<T *>
123 {
128  static T & GetReference (T * const p)
129  {
130  return *p;
131  }
132 };
133 
139 class CallbackImplBase : public SimpleRefCount<CallbackImplBase>
140 {
141 public:
143  virtual ~CallbackImplBase () {}
150  virtual bool IsEqual (Ptr<const CallbackImplBase> other) const = 0;
155  virtual std::string GetTypeid (void) const = 0;
156 
157 protected:
162  static std::string Demangle (const std::string& mangled);
169  template <typename T>
170  static std::string GetCppTypeid (void)
171  {
172  std::string typeName;
173  try
174  {
175  typeName = typeid (T).name ();
176  typeName = Demangle (typeName);
177  }
178  catch (const std::bad_typeid &e)
179  {
180  typeName = e.what ();
181  }
182  return typeName;
183  }
184 };
185 
190 template <typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>
192 
200 template <typename R>
202 public:
203  virtual ~CallbackImpl () {}
204  virtual R operator() (void) = 0;
205  virtual std::string GetTypeid (void) const
206  {
207  return DoGetTypeid ();
208  }
210  static std::string DoGetTypeid (void)
211  {
212  static std::string id = "CallbackImpl<" +
213  GetCppTypeid<R> () +
214  ">";
215  return id;
216  }
217 };
219 template <typename R, typename T1>
221 public:
222  virtual ~CallbackImpl () {}
223  virtual R operator() (T1) = 0;
224  virtual std::string GetTypeid (void) const
225  {
226  return DoGetTypeid ();
227  }
229  static std::string DoGetTypeid (void)
230  {
231  static std::string id = "CallbackImpl<" +
232  GetCppTypeid<R> () + "," +
233  GetCppTypeid<T1> () +
234  ">";
235  return id;
236  }
237 };
239 template <typename R, typename T1, typename T2>
241 public:
242  virtual ~CallbackImpl () {}
243  virtual R operator() (T1, T2) = 0;
244  virtual std::string GetTypeid (void) const
245  {
246  return DoGetTypeid ();
247  }
249  static std::string DoGetTypeid (void)
250  {
251  static std::string id = "CallbackImpl<" +
252  GetCppTypeid<R> () + "," +
253  GetCppTypeid<T1> () + "," +
254  GetCppTypeid<T2> () +
255  ">";
256  return id;
257  }
258 };
260 template <typename R, typename T1, typename T2, typename T3>
262 public:
263  virtual ~CallbackImpl () {}
264  virtual R operator() (T1, T2, T3) = 0;
265  virtual std::string GetTypeid (void) const
266  {
267  return DoGetTypeid ();
268  }
270  static std::string DoGetTypeid (void)
271  {
272  static std::string id = "CallbackImpl<" +
273  GetCppTypeid<R> () + "," +
274  GetCppTypeid<T1> () + "," +
275  GetCppTypeid<T2> () + "," +
276  GetCppTypeid<T3> () +
277  ">";
278  return id;
279  }
280 };
282 template <typename R, typename T1, typename T2, typename T3, typename T4>
283 class CallbackImpl<R,T1,T2,T3,T4,empty,empty,empty,empty,empty> : public CallbackImplBase {
284 public:
285  virtual ~CallbackImpl () {}
286  virtual R operator() (T1, T2, T3, T4) = 0;
287  virtual std::string GetTypeid (void) const
288  {
289  return DoGetTypeid ();
290  }
292  static std::string DoGetTypeid (void)
293  {
294  static std::string id = "CallbackImpl<" +
295  GetCppTypeid<R> () + "," +
296  GetCppTypeid<T1> () + "," +
297  GetCppTypeid<T2> () + "," +
298  GetCppTypeid<T3> () + "," +
299  GetCppTypeid<T4> () +
300  ">";
301  return id;
302  }
303 };
305 template <typename R, typename T1, typename T2, typename T3, typename T4, typename T5>
306 class CallbackImpl<R,T1,T2,T3,T4,T5,empty,empty,empty,empty> : public CallbackImplBase {
307 public:
308  virtual ~CallbackImpl () {}
309  virtual R operator() (T1, T2, T3, T4, T5) = 0;
310  virtual std::string GetTypeid (void) const
311  {
312  return DoGetTypeid ();
313  }
315  static std::string DoGetTypeid (void)
316  {
317  static std::string id = "CallbackImpl<" +
318  GetCppTypeid<R> () + "," +
319  GetCppTypeid<T1> () + "," +
320  GetCppTypeid<T2> () + "," +
321  GetCppTypeid<T3> () + "," +
322  GetCppTypeid<T4> () + "," +
323  GetCppTypeid<T5> () +
324  ">";
325  return id;
326  }
327 };
329 template <typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
330 class CallbackImpl<R,T1,T2,T3,T4,T5,T6,empty,empty,empty> : public CallbackImplBase {
331 public:
332  virtual ~CallbackImpl () {}
333  virtual R operator() (T1, T2, T3, T4, T5, T6) = 0;
334  virtual std::string GetTypeid (void) const
335  {
336  return DoGetTypeid ();
337  }
339  static std::string DoGetTypeid (void)
340  {
341  static std::string id = "CallbackImpl<" +
342  GetCppTypeid<R> () + "," +
343  GetCppTypeid<T1> () + "," +
344  GetCppTypeid<T2> () + "," +
345  GetCppTypeid<T3> () + "," +
346  GetCppTypeid<T4> () + "," +
347  GetCppTypeid<T5> () + "," +
348  GetCppTypeid<T6> () +
349  ">";
350  return id;
351  }
352 };
354 template <typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
355 class CallbackImpl<R,T1,T2,T3,T4,T5,T6,T7,empty,empty> : public CallbackImplBase {
356 public:
357  virtual ~CallbackImpl () {}
358  virtual R operator() (T1, T2, T3, T4, T5, T6, T7) = 0;
359  virtual std::string GetTypeid (void) const
360  {
361  return DoGetTypeid ();
362  }
364  static std::string DoGetTypeid (void)
365  {
366  static std::string id = "CallbackImpl<" +
367  GetCppTypeid<R> () + "," +
368  GetCppTypeid<T1> () + "," +
369  GetCppTypeid<T2> () + "," +
370  GetCppTypeid<T3> () + "," +
371  GetCppTypeid<T4> () + "," +
372  GetCppTypeid<T5> () + "," +
373  GetCppTypeid<T6> () + "," +
374  GetCppTypeid<T7> () +
375  ">";
376  return id;
377  }
378 };
380 template <typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8>
381 class CallbackImpl<R,T1,T2,T3,T4,T5,T6,T7,T8,empty> : public CallbackImplBase {
382 public:
383  virtual ~CallbackImpl () {}
384  virtual R operator() (T1, T2, T3, T4, T5, T6, T7, T8) = 0;
385  virtual std::string GetTypeid (void) const
386  {
387  return DoGetTypeid ();
388  }
390  static std::string DoGetTypeid (void)
391  {
392  static std::string id = "CallbackImpl<" +
393  GetCppTypeid<R> () + "," +
394  GetCppTypeid<T1> () + "," +
395  GetCppTypeid<T2> () + "," +
396  GetCppTypeid<T3> () + "," +
397  GetCppTypeid<T4> () + "," +
398  GetCppTypeid<T5> () + "," +
399  GetCppTypeid<T6> () + "," +
400  GetCppTypeid<T7> () + "," +
401  GetCppTypeid<T8> () +
402  ">";
403  return id;
404  }
405 };
407 template <typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>
408 class CallbackImpl : public CallbackImplBase {
409 public:
410  virtual ~CallbackImpl () {}
411  virtual R operator() (T1, T2, T3, T4, T5, T6, T7, T8, T9) = 0;
412  virtual std::string GetTypeid (void) const
413  {
414  return DoGetTypeid ();
415  }
417  static std::string DoGetTypeid (void)
418  {
419  static std::string id = "CallbackImpl<" +
420  GetCppTypeid<R> () + "," +
421  GetCppTypeid<T1> () + "," +
422  GetCppTypeid<T2> () + "," +
423  GetCppTypeid<T3> () + "," +
424  GetCppTypeid<T4> () + "," +
425  GetCppTypeid<T5> () + "," +
426  GetCppTypeid<T6> () + "," +
427  GetCppTypeid<T7> () + "," +
428  GetCppTypeid<T8> () + "," +
429  GetCppTypeid<T9> () +
430  ">";
431  return id;
432  }
433 };
441 template <typename T, typename R, typename T1, typename T2, typename T3, typename T4,typename T5, typename T6, typename T7, typename T8, typename T9>
442 class FunctorCallbackImpl : public CallbackImpl<R,T1,T2,T3,T4,T5,T6,T7,T8,T9> {
443 public:
449  FunctorCallbackImpl (T const &functor)
450  : m_functor (functor) {}
451  virtual ~FunctorCallbackImpl () {}
457  R operator() (void) {
458  return m_functor ();
459  }
464  R operator() (T1 a1) {
465  return m_functor (a1);
466  }
472  R operator() (T1 a1,T2 a2) {
473  return m_functor (a1,a2);
474  }
481  R operator() (T1 a1,T2 a2,T3 a3) {
482  return m_functor (a1,a2,a3);
483  }
491  R operator() (T1 a1,T2 a2,T3 a3,T4 a4) {
492  return m_functor (a1,a2,a3,a4);
493  }
502  R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5) {
503  return m_functor (a1,a2,a3,a4,a5);
504  }
514  R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6) {
515  return m_functor (a1,a2,a3,a4,a5,a6);
516  }
527  R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7) {
528  return m_functor (a1,a2,a3,a4,a5,a6,a7);
529  }
541  R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7,T8 a8) {
542  return m_functor (a1,a2,a3,a4,a5,a6,a7,a8);
543  }
556  R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7,T8 a8,T9 a9) {
557  return m_functor (a1,a2,a3,a4,a5,a6,a7,a8,a9);
558  }
566  virtual bool IsEqual (Ptr<const CallbackImplBase> other) const {
569  if (otherDerived == 0)
570  {
571  return false;
572  }
573  else if (otherDerived->m_functor != m_functor)
574  {
575  return false;
576  }
577  return true;
578  }
579 private:
581 };
582 
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>
588 class MemPtrCallbackImpl : public CallbackImpl<R,T1,T2,T3,T4,T5,T6,T7,T8,T9> {
589 public:
596  MemPtrCallbackImpl (OBJ_PTR const&objPtr, MEM_PTR memPtr)
597  : m_objPtr (objPtr), m_memPtr (memPtr) {}
598  virtual ~MemPtrCallbackImpl () {}
604  R operator() (void) {
606  }
611  R operator() (T1 a1) {
613  }
619  R operator() (T1 a1,T2 a2) {
621  }
628  R operator() (T1 a1,T2 a2,T3 a3) {
629  return ((CallbackTraits<OBJ_PTR>::GetReference (m_objPtr)).*m_memPtr)(a1, a2, a3);
630  }
638  R operator() (T1 a1,T2 a2,T3 a3,T4 a4) {
639  return ((CallbackTraits<OBJ_PTR>::GetReference (m_objPtr)).*m_memPtr)(a1, a2, a3, a4);
640  }
649  R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5) {
650  return ((CallbackTraits<OBJ_PTR>::GetReference (m_objPtr)).*m_memPtr)(a1, a2, a3, a4, a5);
651  }
661  R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6) {
662  return ((CallbackTraits<OBJ_PTR>::GetReference (m_objPtr)).*m_memPtr)(a1, a2, a3, a4, a5, a6);
663  }
674  R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7) {
675  return ((CallbackTraits<OBJ_PTR>::GetReference (m_objPtr)).*m_memPtr)(a1, a2, a3, a4, a5, a6, a7);
676  }
688  R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7,T8 a8) {
689  return ((CallbackTraits<OBJ_PTR>::GetReference (m_objPtr)).*m_memPtr)(a1, a2, a3, a4, a5, a6, a7, a8);
690  }
703  R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7,T8 a8, T9 a9) {
704  return ((CallbackTraits<OBJ_PTR>::GetReference (m_objPtr)).*m_memPtr)(a1, a2, a3, a4, a5, a6, a7, a8, a9);
705  }
713  virtual bool IsEqual (Ptr<const CallbackImplBase> other) const {
716  if (otherDerived == 0)
717  {
718  return false;
719  }
720  else if (otherDerived->m_objPtr != m_objPtr ||
721  otherDerived->m_memPtr != m_memPtr)
722  {
723  return false;
724  }
725  return true;
726  }
727 private:
728  OBJ_PTR const m_objPtr;
729  MEM_PTR m_memPtr;
730 };
731 
736 template <typename T, typename R, typename TX, typename T1, typename T2, typename T3, typename T4,typename T5, typename T6, typename T7, typename T8>
737 class BoundFunctorCallbackImpl : public CallbackImpl<R,T1,T2,T3,T4,T5,T6,T7,T8,empty> {
738 public:
744  template <typename FUNCTOR, typename ARG>
745  BoundFunctorCallbackImpl (FUNCTOR functor, ARG a)
746  : m_functor (functor), m_a (a) {}
753  R operator() (void) {
754  return m_functor (m_a);
755  }
760  R operator() (T1 a1) {
761  return m_functor (m_a,a1);
762  }
768  R operator() (T1 a1,T2 a2) {
769  return m_functor (m_a,a1,a2);
770  }
777  R operator() (T1 a1,T2 a2,T3 a3) {
778  return m_functor (m_a,a1,a2,a3);
779  }
787  R operator() (T1 a1,T2 a2,T3 a3,T4 a4) {
788  return m_functor (m_a,a1,a2,a3,a4);
789  }
798  R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5) {
799  return m_functor (m_a,a1,a2,a3,a4,a5);
800  }
810  R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6) {
811  return m_functor (m_a,a1,a2,a3,a4,a5,a6);
812  }
823  R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7) {
824  return m_functor (m_a,a1,a2,a3,a4,a5,a6,a7);
825  }
837  R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7,T8 a8) {
838  return m_functor (m_a,a1,a2,a3,a4,a5,a6,a7,a8);
839  }
847  virtual bool IsEqual (Ptr<const CallbackImplBase> other) const {
850  if (otherDerived == 0)
851  {
852  return false;
853  }
854  else if (otherDerived->m_functor != m_functor ||
855  otherDerived->m_a != m_a)
856  {
857  return false;
858  }
859  return true;
860  }
861 private:
864 };
865 
870 template <typename T, typename R, typename TX1, typename TX2, typename T1, typename T2, typename T3, typename T4,typename T5, typename T6, typename T7>
871 class TwoBoundFunctorCallbackImpl : public CallbackImpl<R,T1,T2,T3,T4,T5,T6,T7,empty,empty> {
872 public:
879  template <typename FUNCTOR, typename ARG1, typename ARG2>
880  TwoBoundFunctorCallbackImpl (FUNCTOR functor, ARG1 arg1, ARG2 arg2)
881  : m_functor (functor), m_a1 (arg1), m_a2 (arg2) {}
888  R operator() (void) {
889  return m_functor (m_a1,m_a2);
890  }
895  R operator() (T1 a1) {
896  return m_functor (m_a1,m_a2,a1);
897  }
903  R operator() (T1 a1,T2 a2) {
904  return m_functor (m_a1,m_a2,a1,a2);
905  }
912  R operator() (T1 a1,T2 a2,T3 a3) {
913  return m_functor (m_a1,m_a2,a1,a2,a3);
914  }
922  R operator() (T1 a1,T2 a2,T3 a3,T4 a4) {
923  return m_functor (m_a1,m_a2,a1,a2,a3,a4);
924  }
933  R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5) {
934  return m_functor (m_a1,m_a2,a1,a2,a3,a4,a5);
935  }
945  R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6) {
946  return m_functor (m_a1,m_a2,a1,a2,a3,a4,a5,a6);
947  }
958  R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7) {
959  return m_functor (m_a1,m_a2,a1,a2,a3,a4,a5,a6,a7);
960  }
968  virtual bool IsEqual (Ptr<const CallbackImplBase> other) const {
971  if (otherDerived == 0)
972  {
973  return false;
974  }
975  else if (otherDerived->m_functor != m_functor ||
976  otherDerived->m_a1 != m_a1 || otherDerived->m_a2 != m_a2)
977  {
978  return false;
979  }
980  return true;
981  }
982 private:
986 };
987 
992 template <typename T, typename R, typename TX1, typename TX2, typename TX3, typename T1, typename T2, typename T3, typename T4,typename T5, typename T6>
993 class ThreeBoundFunctorCallbackImpl : public CallbackImpl<R,T1,T2,T3,T4,T5,T6,empty,empty,empty> {
994 public:
1002  template <typename FUNCTOR, typename ARG1, typename ARG2, typename ARG3>
1003  ThreeBoundFunctorCallbackImpl (FUNCTOR functor, ARG1 arg1, ARG2 arg2, ARG3 arg3)
1004  : m_functor (functor), m_a1 (arg1), m_a2 (arg2), m_a3 (arg3) {}
1011  R operator() (void) {
1012  return m_functor (m_a1,m_a2,m_a3);
1013  }
1018  R operator() (T1 a1) {
1019  return m_functor (m_a1,m_a2,m_a3,a1);
1020  }
1026  R operator() (T1 a1,T2 a2) {
1027  return m_functor (m_a1,m_a2,m_a3,a1,a2);
1028  }
1035  R operator() (T1 a1,T2 a2,T3 a3) {
1036  return m_functor (m_a1,m_a2,m_a3,a1,a2,a3);
1037  }
1045  R operator() (T1 a1,T2 a2,T3 a3,T4 a4) {
1046  return m_functor (m_a1,m_a2,m_a3,a1,a2,a3,a4);
1047  }
1056  R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5) {
1057  return m_functor (m_a1,m_a2,m_a3,a1,a2,a3,a4,a5);
1058  }
1068  R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6) {
1069  return m_functor (m_a1,m_a2,m_a3,a1,a2,a3,a4,a5,a6);
1070  }
1078  virtual bool IsEqual (Ptr<const CallbackImplBase> other) const {
1081  if (otherDerived == 0)
1082  {
1083  return false;
1084  }
1085  else if (otherDerived->m_functor != m_functor ||
1086  otherDerived->m_a1 != m_a1 || otherDerived->m_a2 != m_a2 || otherDerived->m_a3 != m_a3)
1087  {
1088  return false;
1089  }
1090  return true;
1091  }
1092 private:
1097 };
1098 
1105 public:
1108  Ptr<CallbackImplBase> GetImpl (void) const { return m_impl; }
1109 protected:
1116 };
1117 
1170 template<typename R,
1171  typename T1 = empty, typename T2 = empty,
1172  typename T3 = empty, typename T4 = empty,
1173  typename T5 = empty, typename T6 = empty,
1174  typename T7 = empty, typename T8 = empty,
1175  typename T9 = empty>
1176 class Callback : public CallbackBase {
1177 public:
1178  Callback () {}
1179 
1189  template <typename FUNCTOR>
1190  Callback (FUNCTOR const &functor, bool, bool)
1191  : CallbackBase (Create<FunctorCallbackImpl<FUNCTOR,R,T1,T2,T3,T4,T5,T6,T7,T8,T9> > (functor))
1192  {}
1193 
1200  template <typename OBJ_PTR, typename MEM_PTR>
1201  Callback (OBJ_PTR const &objPtr, MEM_PTR memPtr)
1202  : CallbackBase (Create<MemPtrCallbackImpl<OBJ_PTR,MEM_PTR,R,T1,T2,T3,T4,T5,T6,T7,T8,T9> > (objPtr, memPtr))
1203  {}
1204 
1211  : CallbackBase (impl)
1212  {}
1213 
1220  template <typename T>
1226  R,T1,T2,T3,T4,T5,T6,T7,T8,T9> (*this, a), false);
1228  }
1229 
1237  template <typename TX1, typename TX2>
1243  R,T1,T2,T3,T4,T5,T6,T7,T8,T9> (*this, a1, a2), false);
1244  return Callback<R,T3,T4,T5,T6,T7,T8,T9> (impl);
1245  }
1246 
1255  template <typename TX1, typename TX2, typename TX3>
1256  Callback<R,T4,T5,T6,T7,T8,T9> ThreeBind (TX1 a1, TX2 a2, TX3 a3) {
1261  R,T1,T2,T3,T4,T5,T6,T7,T8,T9> (*this, a1, a2, a3), false);
1262  return Callback<R,T4,T5,T6,T7,T8,T9> (impl);
1263  }
1264 
1270  bool IsNull (void) const {
1271  return (DoPeekImpl () == 0) ? true : false;
1272  }
1274  void Nullify (void) {
1275  m_impl = 0;
1276  }
1277 
1283  R operator() (void) const {
1284  return (*(DoPeekImpl ()))();
1285  }
1290  R operator() (T1 a1) const {
1291  return (*(DoPeekImpl ()))(a1);
1292  }
1298  R operator() (T1 a1, T2 a2) const {
1299  return (*(DoPeekImpl ()))(a1,a2);
1300  }
1307  R operator() (T1 a1, T2 a2, T3 a3) const {
1308  return (*(DoPeekImpl ()))(a1,a2,a3);
1309  }
1317  R operator() (T1 a1, T2 a2, T3 a3, T4 a4) const {
1318  return (*(DoPeekImpl ()))(a1,a2,a3,a4);
1319  }
1328  R operator() (T1 a1, T2 a2, T3 a3, T4 a4,T5 a5) const {
1329  return (*(DoPeekImpl ()))(a1,a2,a3,a4,a5);
1330  }
1340  R operator() (T1 a1, T2 a2, T3 a3, T4 a4,T5 a5,T6 a6) const {
1341  return (*(DoPeekImpl ()))(a1,a2,a3,a4,a5,a6);
1342  }
1353  R operator() (T1 a1, T2 a2, T3 a3, T4 a4,T5 a5,T6 a6,T7 a7) const {
1354  return (*(DoPeekImpl ()))(a1,a2,a3,a4,a5,a6,a7);
1355  }
1367  R operator() (T1 a1, T2 a2, T3 a3, T4 a4,T5 a5,T6 a6,T7 a7,T8 a8) const {
1368  return (*(DoPeekImpl ()))(a1,a2,a3,a4,a5,a6,a7,a8);
1369  }
1382  R operator() (T1 a1, T2 a2, T3 a3, T4 a4,T5 a5,T6 a6,T7 a7,T8 a8, T9 a9) const {
1383  return (*(DoPeekImpl ()))(a1,a2,a3,a4,a5,a6,a7,a8,a9);
1384  }
1393  bool IsEqual (const CallbackBase &other) const {
1394  return m_impl->IsEqual (other.GetImpl ());
1395  }
1396 
1403  bool CheckType (const CallbackBase & other) const {
1404  return DoCheckType (other.GetImpl ());
1405  }
1412  bool Assign (const CallbackBase &other) {
1413  return DoAssign (other.GetImpl ());
1414  }
1415 private:
1419  }
1427  if (other != 0 &&
1428  dynamic_cast<const CallbackImpl<R,T1,T2,T3,T4,T5,T6,T7,T8,T9> *> (PeekPointer (other)) != 0)
1429  {
1430  return true;
1431  }
1432  else if (other == 0)
1433  {
1434  return true;
1435  }
1436  else
1437  {
1438  return false;
1439  }
1440  }
1443  if (!DoCheckType (other))
1444  {
1445  std::string othTid = other->GetTypeid ();
1447  NS_FATAL_ERROR_CONT ("Incompatible types. (feed to \"c++filt -t\" if needed)" << std::endl <<
1448  "got=" << othTid << std::endl <<
1449  "expected=" << myTid);
1450  return false;
1451  }
1452  m_impl = const_cast<CallbackImplBase *> (PeekPointer (other));
1453  return true;
1454  }
1455 };
1456 
1457 
1466 template <typename R, typename T1, typename T2,
1467  typename T3, typename T4,
1468  typename T5, typename T6,
1469  typename T7, typename T8,
1470  typename T9>
1472 {
1473  return !a.IsEqual (b);
1474 }
1475 
1488 template <typename T, typename OBJ, typename R>
1489 Callback<R> MakeCallback (R (T::*memPtr)(void), OBJ objPtr) {
1490  return Callback<R> (objPtr, memPtr);
1491 }
1492 template <typename T, typename OBJ, typename R>
1493 Callback<R> MakeCallback (R (T::*memPtr)() const, OBJ objPtr) {
1494  return Callback<R> (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 }
1581 template <typename R>
1582 Callback<R> MakeCallback (R (*fnPtr)()) {
1583  return Callback<R> (fnPtr, true, true);
1584 }
1585 template <typename R, typename T1>
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 }
1634 template <typename R>
1636  return Callback<R> ();
1637 }
1638 template <typename R, typename T1>
1640  return Callback<R,T1> ();
1641 }
1642 template <typename R, typename T1, typename T2>
1644  return Callback<R,T1,T2> ();
1645 }
1646 template <typename R, typename T1, typename T2,typename T3>
1648  return Callback<R,T1,T2,T3> ();
1649 }
1650 template <typename R, typename T1, typename T2,typename T3,typename T4>
1652  return Callback<R,T1,T2,T3,T4> ();
1653 }
1654 template <typename R, typename T1, typename T2,typename T3,typename T4,typename T5>
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>
1661 }
1662 template <typename R, typename T1, typename T2,typename T3,typename T4,typename T5,typename T6, typename T7>
1665 }
1666 template <typename R, typename T1, typename T2,typename T3,typename T4,typename T5,typename T6, typename T7, typename T8>
1669 }
1670 template <typename R, typename T1, typename T2,typename T3,typename T4,typename T5,typename T6, typename T7, typename T8, typename T9>
1673 }
1685 template <typename R, typename TX, typename ARG>
1686 Callback<R> MakeBoundCallback (R (*fnPtr)(TX), ARG a1) {
1688  Create<BoundFunctorCallbackImpl<R (*)(TX),R,TX,empty,empty,empty,empty,empty,empty,empty,empty> >(fnPtr, a1);
1689  return Callback<R> (impl);
1690 }
1691 template <typename R, typename TX, typename ARG,
1692  typename T1>
1693 Callback<R,T1> MakeBoundCallback (R (*fnPtr)(TX,T1), ARG a1) {
1695  Create<BoundFunctorCallbackImpl<R (*)(TX,T1),R,TX,T1,empty,empty,empty,empty,empty,empty,empty> > (fnPtr, a1);
1696  return Callback<R,T1> (impl);
1697 }
1698 template <typename R, typename TX, typename ARG,
1699  typename T1, typename T2>
1700 Callback<R,T1,T2> MakeBoundCallback (R (*fnPtr)(TX,T1,T2), ARG a1) {
1702  Create<BoundFunctorCallbackImpl<R (*)(TX,T1,T2),R,TX,T1,T2,empty,empty,empty,empty,empty,empty> > (fnPtr, a1);
1703  return Callback<R,T1,T2> (impl);
1704 }
1705 template <typename R, typename TX, typename ARG,
1706  typename T1, typename T2,typename T3>
1707 Callback<R,T1,T2,T3> MakeBoundCallback (R (*fnPtr)(TX,T1,T2,T3), ARG a1) {
1709  Create<BoundFunctorCallbackImpl<R (*)(TX,T1,T2,T3),R,TX,T1,T2,T3,empty,empty,empty,empty,empty> > (fnPtr, a1);
1710  return Callback<R,T1,T2,T3> (impl);
1711 }
1712 template <typename R, typename TX, typename ARG,
1713  typename T1, typename T2,typename T3,typename T4>
1714 Callback<R,T1,T2,T3,T4> MakeBoundCallback (R (*fnPtr)(TX,T1,T2,T3,T4), ARG a1) {
1716  Create<BoundFunctorCallbackImpl<R (*)(TX,T1,T2,T3,T4),R,TX,T1,T2,T3,T4,empty,empty,empty,empty> > (fnPtr, a1);
1717  return Callback<R,T1,T2,T3,T4> (impl);
1718 }
1719 template <typename R, typename TX, typename ARG,
1720  typename T1, typename T2,typename T3,typename T4,typename T5>
1721 Callback<R,T1,T2,T3,T4,T5> MakeBoundCallback (R (*fnPtr)(TX,T1,T2,T3,T4,T5), ARG a1) {
1723  Create<BoundFunctorCallbackImpl<R (*)(TX,T1,T2,T3,T4,T5),R,TX,T1,T2,T3,T4,T5,empty,empty,empty> > (fnPtr, a1);
1724  return Callback<R,T1,T2,T3,T4,T5> (impl);
1725 }
1726 template <typename R, typename TX, typename ARG,
1727  typename T1, typename T2,typename T3,typename T4,typename T5, typename T6>
1728 Callback<R,T1,T2,T3,T4,T5,T6> MakeBoundCallback (R (*fnPtr)(TX,T1,T2,T3,T4,T5,T6), ARG a1) {
1730  Create<BoundFunctorCallbackImpl<R (*)(TX,T1,T2,T3,T4,T5,T6),R,TX,T1,T2,T3,T4,T5,T6,empty,empty> > (fnPtr, a1);
1731  return Callback<R,T1,T2,T3,T4,T5,T6> (impl);
1732 }
1733 template <typename R, typename TX, typename ARG,
1734  typename T1, typename T2,typename T3,typename T4,typename T5, typename T6, typename T7>
1735 Callback<R,T1,T2,T3,T4,T5,T6,T7> MakeBoundCallback (R (*fnPtr)(TX,T1,T2,T3,T4,T5,T6,T7), ARG a1) {
1737  Create<BoundFunctorCallbackImpl<R (*)(TX,T1,T2,T3,T4,T5,T6,T7),R,TX,T1,T2,T3,T4,T5,T6,T7,empty> > (fnPtr, a1);
1738  return Callback<R,T1,T2,T3,T4,T5,T6,T7> (impl);
1739 }
1740 template <typename R, typename TX, typename ARG,
1741  typename T1, typename T2,typename T3,typename T4,typename T5, typename T6, typename T7, typename T8>
1742 Callback<R,T1,T2,T3,T4,T5,T6,T7,T8> MakeBoundCallback (R (*fnPtr)(TX,T1,T2,T3,T4,T5,T6,T7,T8), ARG a1) {
1744  Create<BoundFunctorCallbackImpl<R (*)(TX,T1,T2,T3,T4,T5,T6,T7,T8),R,TX,T1,T2,T3,T4,T5,T6,T7,T8> > (fnPtr, a1);
1746 }
1758 template <typename R, typename TX1, typename TX2, typename ARG1, typename ARG2>
1759 Callback<R> MakeBoundCallback (R (*fnPtr)(TX1,TX2), ARG1 a1, ARG2 a2) {
1761  Create<TwoBoundFunctorCallbackImpl<R (*)(TX1,TX2),R,TX1,TX2,empty,empty,empty,empty,empty,empty,empty> >(fnPtr, a1, a2);
1762  return Callback<R> (impl);
1763 }
1764 template <typename R, typename TX1, typename TX2, typename ARG1, typename ARG2,
1765  typename T1>
1766 Callback<R,T1> MakeBoundCallback (R (*fnPtr)(TX1,TX2,T1), ARG1 a1, ARG2 a2) {
1768  Create<TwoBoundFunctorCallbackImpl<R (*)(TX1,TX2,T1),R,TX1,TX2,T1,empty,empty,empty,empty,empty,empty> > (fnPtr, a1, a2);
1769  return Callback<R,T1> (impl);
1770 }
1771 template <typename R, typename TX1, typename TX2, typename ARG1, typename ARG2,
1772  typename T1, typename T2>
1773 Callback<R,T1,T2> MakeBoundCallback (R (*fnPtr)(TX1,TX2,T1,T2), ARG1 a1, ARG2 a2) {
1775  Create<TwoBoundFunctorCallbackImpl<R (*)(TX1,TX2,T1,T2),R,TX1,TX2,T1,T2,empty,empty,empty,empty,empty> > (fnPtr, a1, a2);
1776  return Callback<R,T1,T2> (impl);
1777 }
1778 template <typename R, typename TX1, typename TX2, typename ARG1, typename ARG2,
1779  typename T1, typename T2,typename T3>
1780 Callback<R,T1,T2,T3> MakeBoundCallback (R (*fnPtr)(TX1,TX2,T1,T2,T3), ARG1 a1, ARG2 a2) {
1782  Create<TwoBoundFunctorCallbackImpl<R (*)(TX1,TX2,T1,T2,T3),R,TX1,TX2,T1,T2,T3,empty,empty,empty,empty> > (fnPtr, a1, a2);
1783  return Callback<R,T1,T2,T3> (impl);
1784 }
1785 template <typename R, typename TX1, typename TX2, typename ARG1, typename ARG2,
1786  typename T1, typename T2,typename T3,typename T4>
1787 Callback<R,T1,T2,T3,T4> MakeBoundCallback (R (*fnPtr)(TX1,TX2,T1,T2,T3,T4), ARG1 a1, ARG2 a2) {
1789  Create<TwoBoundFunctorCallbackImpl<R (*)(TX1,TX2,T1,T2,T3,T4),R,TX1,TX2,T1,T2,T3,T4,empty,empty,empty> > (fnPtr, a1, a2);
1790  return Callback<R,T1,T2,T3,T4> (impl);
1791 }
1792 template <typename R, typename TX1, typename TX2, typename ARG1, typename ARG2,
1793  typename T1, typename T2,typename T3,typename T4,typename T5>
1794 Callback<R,T1,T2,T3,T4,T5> MakeBoundCallback (R (*fnPtr)(TX1,TX2,T1,T2,T3,T4,T5), ARG1 a1, ARG2 a2) {
1796  Create<TwoBoundFunctorCallbackImpl<R (*)(TX1,TX2,T1,T2,T3,T4,T5),R,TX1,TX2,T1,T2,T3,T4,T5,empty,empty> > (fnPtr, a1, a2);
1797  return Callback<R,T1,T2,T3,T4,T5> (impl);
1798 }
1799 template <typename R, typename TX1, typename TX2, typename ARG1, typename ARG2,
1800  typename T1, typename T2,typename T3,typename T4,typename T5, typename T6>
1801 Callback<R,T1,T2,T3,T4,T5,T6> MakeBoundCallback (R (*fnPtr)(TX1,TX2,T1,T2,T3,T4,T5,T6), ARG1 a1, ARG2 a2) {
1803  Create<TwoBoundFunctorCallbackImpl<R (*)(TX1,TX2,T1,T2,T3,T4,T5,T6),R,TX1,TX2,T1,T2,T3,T4,T5,T6,empty> > (fnPtr, a1, a2);
1804  return Callback<R,T1,T2,T3,T4,T5,T6> (impl);
1805 }
1806 template <typename R, typename TX1, typename TX2, typename ARG1, typename ARG2,
1807  typename T1, typename T2,typename T3,typename T4,typename T5, typename T6, typename T7>
1808 Callback<R,T1,T2,T3,T4,T5,T6,T7> MakeBoundCallback (R (*fnPtr)(TX1,TX2,T1,T2,T3,T4,T5,T6,T7), ARG1 a1, ARG2 a2) {
1810  Create<TwoBoundFunctorCallbackImpl<R (*)(TX1,TX2,T1,T2,T3,T4,T5,T6,T7),R,TX1,TX2,T1,T2,T3,T4,T5,T6,T7> > (fnPtr, a1, a2);
1811  return Callback<R,T1,T2,T3,T4,T5,T6,T7> (impl);
1812 }
1825 template <typename R, typename TX1, typename TX2, typename TX3, typename ARG1, typename ARG2, typename ARG3>
1826 Callback<R> MakeBoundCallback (R (*fnPtr)(TX1,TX2,TX3), ARG1 a1, ARG2 a2, ARG3 a3) {
1828  Create<ThreeBoundFunctorCallbackImpl<R (*)(TX1,TX2,TX3),R,TX1,TX2,TX3,empty,empty,empty,empty,empty,empty> >(fnPtr, a1, a2, a3);
1829  return Callback<R> (impl);
1830 }
1831 template <typename R, typename TX1, typename TX2, typename TX3, typename ARG1, typename ARG2, typename ARG3,
1832  typename T1>
1833 Callback<R,T1> MakeBoundCallback (R (*fnPtr)(TX1,TX2,TX3,T1), ARG1 a1, ARG2 a2, ARG3 a3) {
1835  Create<ThreeBoundFunctorCallbackImpl<R (*)(TX1,TX2,TX3,T1),R,TX1,TX2,TX3,T1,empty,empty,empty,empty,empty> > (fnPtr, a1, a2, a3);
1836  return Callback<R,T1> (impl);
1837 }
1838 template <typename R, typename TX1, typename TX2, typename TX3, typename ARG1, typename ARG2, typename ARG3,
1839  typename T1, typename T2>
1840 Callback<R,T1,T2> MakeBoundCallback (R (*fnPtr)(TX1,TX2,TX3,T1,T2), ARG1 a1, ARG2 a2, ARG3 a3) {
1842  Create<ThreeBoundFunctorCallbackImpl<R (*)(TX1,TX2,TX3,T1,T2),R,TX1,TX2,TX3,T1,T2,empty,empty,empty,empty> > (fnPtr, a1, a2, a3);
1843  return Callback<R,T1,T2> (impl);
1844 }
1845 template <typename R, typename TX1, typename TX2, typename TX3, typename ARG1, typename ARG2, typename ARG3,
1846  typename T1, typename T2,typename T3>
1847 Callback<R,T1,T2,T3> MakeBoundCallback (R (*fnPtr)(TX1,TX2,TX3,T1,T2,T3), ARG1 a1, ARG2 a2, ARG3 a3) {
1849  Create<ThreeBoundFunctorCallbackImpl<R (*)(TX1,TX2,TX3,T1,T2,T3),R,TX1,TX2,TX3,T1,T2,T3,empty,empty,empty> > (fnPtr, a1, a2, a3);
1850  return Callback<R,T1,T2,T3> (impl);
1851 }
1852 template <typename R, typename TX1, typename TX2, typename TX3, typename ARG1, typename ARG2, typename ARG3,
1853  typename T1, typename T2,typename T3,typename T4>
1854 Callback<R,T1,T2,T3,T4> MakeBoundCallback (R (*fnPtr)(TX1,TX2,TX3,T1,T2,T3,T4), ARG1 a1, ARG2 a2, ARG3 a3) {
1856  Create<ThreeBoundFunctorCallbackImpl<R (*)(TX1,TX2,TX3,T1,T2,T3,T4),R,TX1,TX2,TX3,T1,T2,T3,T4,empty,empty> > (fnPtr, a1, a2, a3);
1857  return Callback<R,T1,T2,T3,T4> (impl);
1858 }
1859 template <typename R, typename TX1, typename TX2, typename TX3, typename ARG1, typename ARG2, typename ARG3,
1860  typename T1, typename T2,typename T3,typename T4,typename T5>
1861 Callback<R,T1,T2,T3,T4,T5> MakeBoundCallback (R (*fnPtr)(TX1,TX2,TX3,T1,T2,T3,T4,T5), ARG1 a1, ARG2 a2, ARG3 a3) {
1863  Create<ThreeBoundFunctorCallbackImpl<R (*)(TX1,TX2,TX3,T1,T2,T3,T4,T5),R,TX1,TX2,TX3,T1,T2,T3,T4,T5,empty> > (fnPtr, a1, a2, a3);
1864  return Callback<R,T1,T2,T3,T4,T5> (impl);
1865 }
1866 template <typename R, typename TX1, typename TX2, typename TX3, typename ARG1, typename ARG2, typename ARG3,
1867  typename T1, typename T2,typename T3,typename T4,typename T5, typename T6>
1868 Callback<R,T1,T2,T3,T4,T5,T6> MakeBoundCallback (R (*fnPtr)(TX1,TX2,TX3,T1,T2,T3,T4,T5,T6), ARG1 a1, ARG2 a2, ARG3 a3) {
1870  Create<ThreeBoundFunctorCallbackImpl<R (*)(TX1,TX2,TX3,T1,T2,T3,T4,T5,T6),R,TX1,TX2,TX3,T1,T2,T3,T4,T5,T6> > (fnPtr, a1, a2, a3);
1871  return Callback<R,T1,T2,T3,T4,T5,T6> (impl);
1872 }
1876 } // namespace ns3
1877 
1878 namespace ns3 {
1879 
1881 {
1882 public:
1884  CallbackValue ();
1889  CallbackValue (const CallbackBase &base);
1891  virtual ~CallbackValue ();
1893  void Set (CallbackBase base);
1900  template <typename T>
1901  bool GetAccessor (T &value) const;
1903  virtual Ptr<AttributeValue> Copy (void) const;
1909  virtual std::string SerializeToString (Ptr<const AttributeChecker> checker) const;
1917  virtual bool DeserializeFromString (std::string value, Ptr<const AttributeChecker> checker);
1918 private:
1920 };
1921 
1924 
1925 } // namespace ns3
1926 
1927 namespace ns3 {
1928 
1929 template <typename T>
1930 bool CallbackValue::GetAccessor (T &value) const
1931 {
1932  if (value.CheckType (m_value))
1933  {
1934  if (!value.Assign (m_value))
1936  return true;
1937  }
1938  return false;
1939 }
1940 
1941 } // namespace ns3
1942 
1943 
1944 #endif /* CALLBACK_H */
NS_FATAL_x macro definitions.
static std::string DoGetTypeid(void)
Get the name of this object type.
Definition: callback.h:229
CallbackValue()
Constructor.
Definition: callback.cc:34
static std::string GetCppTypeid(void)
Helper to get the C++ typeid as a string.
Definition: callback.h:170
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:73
#define NS_FATAL_ERROR_CONT(msg)
Report a fatal error with a message, deferring termination.
Definition: fatal-error.h:178
virtual ~MemPtrCallbackImpl()
Definition: callback.h:598
Callback template class.
Definition: callback.h:1176
virtual ~BoundFunctorCallbackImpl()
Definition: callback.h:747
virtual ~FunctorCallbackImpl()
Definition: callback.h:451
ns3::Ptr smart pointer declaration and implementation.
Hold a value for an Attribute.
Definition: attribute.h:68
virtual bool IsEqual(Ptr< const CallbackImplBase > other) const
Equality test.
Definition: callback.h:968
virtual bool IsEqual(Ptr< const CallbackImplBase > other) const =0
Equality test.
Callback< R > MakeBoundCallback(R(*fnPtr)(TX), ARG a1)
Make Callbacks with one bound argument.
Definition: callback.h:1686
virtual std::string SerializeToString(Ptr< const AttributeChecker > checker) const
Serialize to string.
Definition: callback.cc:61
Callback< R, T3, T4, T5, T6, T7, T8, T9 > TwoBind(TX1 a1, TX2 a2)
Bind the first two arguments.
Definition: callback.h:1238
static std::string DoGetTypeid(void)
Get the name of this object type.
Definition: callback.h:339
U * PeekPointer(const Ptr< U > &p)
Definition: ptr.h:564
R operator()(void)
Functor with varying numbers of arguments.
Definition: callback.h:753
Callback< R, T2, T3, T4, T5, T6, T7, T8, T9 > Bind(T a)
Bind the first arguments.
Definition: callback.h:1221
Base class for Callback class.
Definition: callback.h:1104
MemPtrCallbackImpl(OBJ_PTR const &objPtr, MEM_PTR memPtr)
Construct from an object pointer and member function pointer.
Definition: callback.h:596
bool CheckType(const CallbackBase &other) const
Check for compatible types.
Definition: callback.h:1403
virtual ~CallbackValue()
Destructor.
Definition: callback.cc:43
bool Assign(const CallbackBase &other)
Adopt the other&#39;s implementation, if type compatible.
Definition: callback.h:1412
Callback< R > MakeNullCallback(void)
Definition: callback.h:1635
CallbackBase m_value
the CallbackBase
Definition: callback.h:1919
bool IsEqual(const CallbackBase &other) const
Equality test.
Definition: callback.h:1393
virtual bool IsEqual(Ptr< const CallbackImplBase > other) const
Equality test.
Definition: callback.h:566
CallbackImpl for functors with first three arguments bound at construction.
Definition: callback.h:993
bool DoAssign(Ptr< const CallbackImplBase > other)
Adopt the other&#39;s implementation, if type compatible.
Definition: callback.h:1442
AttributeValue implementation for Callback.
Definition: callback.h:1880
virtual bool IsEqual(Ptr< const CallbackImplBase > other) const
Equality test.
Definition: callback.h:1078
virtual std::string GetTypeid(void) const
Get the name of this object type.
Definition: callback.h:310
The unqualified CallbackImpl class.
Definition: callback.h:191
#define ATTRIBUTE_CHECKER_DEFINE(type)
Declare the AttributeChecker class typeChecker and the MaketypeChecker function for class type...
virtual std::string GetTypeid(void) const =0
Get the name of this object type.
static std::string DoGetTypeid(void)
Get the name of this object type.
Definition: callback.h:292
R operator()(void)
Functor with varying numbers of arguments.
Definition: callback.h:457
TypeTraits< TX >::ReferencedType m_a
the bound argument
Definition: callback.h:863
make Callback use a separate empty type
Definition: empty.h:33
R operator()(void)
Functor with varying numbers of arguments.
Definition: callback.h:604
FunctorCallbackImpl(T const &functor)
Construct from a functor.
Definition: callback.h:449
Trait class to convert a pointer into a reference, used by MemPtrCallBackImpl.
Definition: callback.h:113
BoundFunctorCallbackImpl(FUNCTOR functor, ARG a)
Construct from functor and a bound argument.
Definition: callback.h:745
OBJ_PTR const m_objPtr
the object pointer
Definition: callback.h:728
ns3::AttributeValue, ns3::AttributeAccessor and ns3::AttributeChecker declarations.
MEM_PTR m_memPtr
the member function pointer
Definition: callback.h:729
static std::string DoGetTypeid(void)
Get the name of this object type.
Definition: callback.h:364
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
Definition: callback.h:1489
virtual Ptr< AttributeValue > Copy(void) const
Definition: callback.cc:55
CallbackImpl for pointer to member functions.
Definition: callback.h:588
Callback< R, T4, T5, T6, T7, T8, T9 > ThreeBind(TX1 a1, TX2 a2, TX3 a3)
Bind the first three arguments.
Definition: callback.h:1256
Abstract base class for CallbackImpl Provides reference counting and equality test.
Definition: callback.h:139
static std::string DoGetTypeid(void)
Get the name of this object type.
Definition: callback.h:390
virtual std::string GetTypeid(void) const
Get the name of this object type.
Definition: callback.h:265
CallbackImpl for functors with first two arguments bound at construction.
Definition: callback.h:871
R operator()(void) const
Functor with varying numbers of arguments.
Definition: callback.h:1283
Callback(Ptr< CallbackImpl< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 > > const &impl)
Construct from a CallbackImpl pointer.
Definition: callback.h:1210
CallbackImpl< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 > * DoPeekImpl(void) const
Definition: callback.h:1417
bool DoCheckType(Ptr< const CallbackImplBase > other) const
Check for compatible types.
Definition: callback.h:1426
TypeTraits< TX3 >::ReferencedType m_a3
third bound argument
Definition: callback.h:1096
bool operator!=(Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 > a, Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 > b)
Inequality test.
Definition: callback.h:1471
virtual ~CallbackImplBase()
Virtual destructor.
Definition: callback.h:143
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static std::string DoGetTypeid(void)
Get the name of this object type.
Definition: callback.h:417
virtual std::string GetTypeid(void) const
Get the name of this object type.
Definition: callback.h:359
#define NS_FATAL_ERROR_NO_MSG()
Report a fatal error and terminate.
Definition: fatal-error.h:125
Ptr< T > Create(void)
Create class instances by constructors with varying numbers of arguments and return them by Ptr...
Definition: ptr.h:516
virtual std::string GetTypeid(void) const
Get the name of this object type.
Definition: callback.h:205
virtual std::string GetTypeid(void) const
Get the name of this object type.
Definition: callback.h:244
virtual std::string GetTypeid(void) const
Get the name of this object type.
Definition: callback.h:287
static T & GetReference(T *const p)
Definition: callback.h:128
static std::string DoGetTypeid(void)
Get the name of this object type.
Definition: callback.h:249
TypeTraits< TX1 >::ReferencedType m_a1
first bound argument
Definition: callback.h:1094
static std::string DoGetTypeid(void)
Get the name of this object type.
Definition: callback.h:315
Callback(OBJ_PTR const &objPtr, MEM_PTR memPtr)
Construct a member function pointer call back.
Definition: callback.h:1201
Attribute helper (ATTRIBUTE_ )macros definition.
static std::string DoGetTypeid(void)
Get the name of this object type.
Definition: callback.h:210
T m_functor
the functor
Definition: callback.h:580
static std::string DoGetTypeid(void)
Get the name of this object type.
Definition: callback.h:270
#define ATTRIBUTE_ACCESSOR_DEFINE(type)
Define the attribute accessor functions MakeTypeAccessor for class type.
R operator()(void)
Functor with varying numbers of arguments.
Definition: callback.h:888
virtual ~CallbackImpl()
Definition: callback.h:410
TypeTraits< TX1 >::ReferencedType m_a1
first bound argument
Definition: callback.h:984
Inspect a type to deduce its features.
Definition: type-traits.h:39
The PHY layer is sending a packet.
Callback(FUNCTOR const &functor, bool, bool)
Construct a functor call back, supporting operator() calls.
Definition: callback.h:1190
CallbackImpl for functors with first argument bound at construction.
Definition: callback.h:737
TwoBoundFunctorCallbackImpl(FUNCTOR functor, ARG1 arg1, ARG2 arg2)
Construct from functor and two arguments.
Definition: callback.h:880
CallbackImpl with functors.
Definition: callback.h:442
virtual bool DeserializeFromString(std::string value, Ptr< const AttributeChecker > checker)
Deserialize from string (not implemented)
Definition: callback.cc:69
virtual R operator()(T1, T2, T3, T4, T5, T6, T7, T8, T9)=0
Abstract operator.
T m_functor
The functor.
Definition: callback.h:862
virtual bool IsEqual(Ptr< const CallbackImplBase > other) const
Equality test.
Definition: callback.h:847
virtual bool IsEqual(Ptr< const CallbackImplBase > other) const
Equality test.
Definition: callback.h:713
bool GetAccessor(T &value) const
Give value my callback, if type compatible.
Definition: callback.h:1930
void Nullify(void)
Discard the implementation, set it to null.
Definition: callback.h:1274
ns3::empty declaration, used by callbacks.
virtual std::string GetTypeid(void) const
Get the name of this object type.
Definition: callback.h:224
TypeTraits< TX2 >::ReferencedType m_a2
second bound argument
Definition: callback.h:1095
CallbackBase(Ptr< CallbackImplBase > impl)
Construct from a pimpl.
Definition: callback.h:1114
Ptr< CallbackImplBase > GetImpl(void) const
Definition: callback.h:1108
bool IsNull(void) const
Check for null implementation.
Definition: callback.h:1270
A template-based reference counting class.
static std::string Demangle(const std::string &mangled)
Definition: callback.cc:129
virtual std::string GetTypeid(void) const
Get the name of this object type.
Definition: callback.h:334
virtual std::string GetTypeid(void) const
Get the name of this object type.
Definition: callback.h:385
Ptr< CallbackImplBase > m_impl
the pimpl
Definition: callback.h:1115
void Set(CallbackBase base)
Definition: callback.cc:48
ns3::SimpleRefCount declaration and template implementation.
TypeTraits< TX2 >::ReferencedType m_a2
second bound argument
Definition: callback.h:985
virtual std::string GetTypeid(void) const
Get the name of this object type.
Definition: callback.h:412
ns3::TypeTraits introspection declaration and template implementation.
ThreeBoundFunctorCallbackImpl(FUNCTOR functor, ARG1 arg1, ARG2 arg2, ARG3 arg3)
Construct from functor and three arguments.
Definition: callback.h:1003
R operator()(void)
Functor with varying numbers of arguments.
Definition: callback.h:1011