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 ()
144  {}
151  virtual bool IsEqual (Ptr<const CallbackImplBase> other) const = 0;
156  virtual std::string GetTypeid (void) const = 0;
157 
158 protected:
163  static std::string Demangle (const std::string& mangled);
170  template <typename T>
171  static std::string GetCppTypeid (void)
172  {
173  std::string typeName;
174  try
175  {
176  typeName = typeid (T).name ();
177  typeName = Demangle (typeName);
178  }
179  catch (const std::bad_typeid &e)
180  {
181  typeName = e.what ();
182  }
183  return typeName;
184  }
185 };
186 
191 template <typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>
193 
201 template <typename R>
203 {
204 public:
205  virtual ~CallbackImpl ()
206  {}
207  virtual R operator() (void) = 0;
208  virtual std::string GetTypeid (void) const
209  {
210  return DoGetTypeid ();
211  }
213  static std::string DoGetTypeid (void)
214  {
215  static std::string id = "CallbackImpl<" +
216  GetCppTypeid<R> () +
217  ">";
218  return id;
219  }
220 };
222 template <typename R, typename T1>
224 {
225 public:
226  virtual ~CallbackImpl ()
227  {}
228  virtual R operator() (T1) = 0;
229  virtual std::string GetTypeid (void) const
230  {
231  return DoGetTypeid ();
232  }
234  static std::string DoGetTypeid (void)
235  {
236  static std::string id = "CallbackImpl<" +
237  GetCppTypeid<R> () + "," +
238  GetCppTypeid<T1> () +
239  ">";
240  return id;
241  }
242 };
244 template <typename R, typename T1, typename T2>
246 {
247 public:
248  virtual ~CallbackImpl ()
249  {}
250  virtual R operator() (T1, T2) = 0;
251  virtual std::string GetTypeid (void) const
252  {
253  return DoGetTypeid ();
254  }
256  static std::string DoGetTypeid (void)
257  {
258  static std::string id = "CallbackImpl<" +
259  GetCppTypeid<R> () + "," +
260  GetCppTypeid<T1> () + "," +
261  GetCppTypeid<T2> () +
262  ">";
263  return id;
264  }
265 };
267 template <typename R, typename T1, typename T2, typename T3>
269 {
270 public:
271  virtual ~CallbackImpl ()
272  {}
273  virtual R operator() (T1, T2, T3) = 0;
274  virtual std::string GetTypeid (void) const
275  {
276  return DoGetTypeid ();
277  }
279  static std::string DoGetTypeid (void)
280  {
281  static std::string id = "CallbackImpl<" +
282  GetCppTypeid<R> () + "," +
283  GetCppTypeid<T1> () + "," +
284  GetCppTypeid<T2> () + "," +
285  GetCppTypeid<T3> () +
286  ">";
287  return id;
288  }
289 };
291 template <typename R, typename T1, typename T2, typename T3, typename T4>
292 class CallbackImpl<R,T1,T2,T3,T4,empty,empty,empty,empty,empty> : public CallbackImplBase
293 {
294 public:
295  virtual ~CallbackImpl ()
296  {}
297  virtual R operator() (T1, T2, T3, T4) = 0;
298  virtual std::string GetTypeid (void) const
299  {
300  return DoGetTypeid ();
301  }
303  static std::string DoGetTypeid (void)
304  {
305  static std::string id = "CallbackImpl<" +
306  GetCppTypeid<R> () + "," +
307  GetCppTypeid<T1> () + "," +
308  GetCppTypeid<T2> () + "," +
309  GetCppTypeid<T3> () + "," +
310  GetCppTypeid<T4> () +
311  ">";
312  return id;
313  }
314 };
316 template <typename R, typename T1, typename T2, typename T3, typename T4, typename T5>
317 class CallbackImpl<R,T1,T2,T3,T4,T5,empty,empty,empty,empty> : public CallbackImplBase
318 {
319 public:
320  virtual ~CallbackImpl ()
321  {}
322  virtual R operator() (T1, T2, T3, T4, T5) = 0;
323  virtual std::string GetTypeid (void) const
324  {
325  return DoGetTypeid ();
326  }
328  static std::string DoGetTypeid (void)
329  {
330  static std::string id = "CallbackImpl<" +
331  GetCppTypeid<R> () + "," +
332  GetCppTypeid<T1> () + "," +
333  GetCppTypeid<T2> () + "," +
334  GetCppTypeid<T3> () + "," +
335  GetCppTypeid<T4> () + "," +
336  GetCppTypeid<T5> () +
337  ">";
338  return id;
339  }
340 };
342 template <typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
343 class CallbackImpl<R,T1,T2,T3,T4,T5,T6,empty,empty,empty> : public CallbackImplBase
344 {
345 public:
346  virtual ~CallbackImpl ()
347  {}
348  virtual R operator() (T1, T2, T3, T4, T5, T6) = 0;
349  virtual std::string GetTypeid (void) const
350  {
351  return DoGetTypeid ();
352  }
354  static std::string DoGetTypeid (void)
355  {
356  static std::string id = "CallbackImpl<" +
357  GetCppTypeid<R> () + "," +
358  GetCppTypeid<T1> () + "," +
359  GetCppTypeid<T2> () + "," +
360  GetCppTypeid<T3> () + "," +
361  GetCppTypeid<T4> () + "," +
362  GetCppTypeid<T5> () + "," +
363  GetCppTypeid<T6> () +
364  ">";
365  return id;
366  }
367 };
369 template <typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
370 class CallbackImpl<R,T1,T2,T3,T4,T5,T6,T7,empty,empty> : public CallbackImplBase
371 {
372 public:
373  virtual ~CallbackImpl ()
374  {}
375  virtual R operator() (T1, T2, T3, T4, T5, T6, T7) = 0;
376  virtual std::string GetTypeid (void) const
377  {
378  return DoGetTypeid ();
379  }
381  static std::string DoGetTypeid (void)
382  {
383  static std::string id = "CallbackImpl<" +
384  GetCppTypeid<R> () + "," +
385  GetCppTypeid<T1> () + "," +
386  GetCppTypeid<T2> () + "," +
387  GetCppTypeid<T3> () + "," +
388  GetCppTypeid<T4> () + "," +
389  GetCppTypeid<T5> () + "," +
390  GetCppTypeid<T6> () + "," +
391  GetCppTypeid<T7> () +
392  ">";
393  return id;
394  }
395 };
397 template <typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8>
398 class CallbackImpl<R,T1,T2,T3,T4,T5,T6,T7,T8,empty> : public CallbackImplBase
399 {
400 public:
401  virtual ~CallbackImpl ()
402  {}
403  virtual R operator() (T1, T2, T3, T4, T5, T6, T7, T8) = 0;
404  virtual std::string GetTypeid (void) const
405  {
406  return DoGetTypeid ();
407  }
409  static std::string DoGetTypeid (void)
410  {
411  static std::string id = "CallbackImpl<" +
412  GetCppTypeid<R> () + "," +
413  GetCppTypeid<T1> () + "," +
414  GetCppTypeid<T2> () + "," +
415  GetCppTypeid<T3> () + "," +
416  GetCppTypeid<T4> () + "," +
417  GetCppTypeid<T5> () + "," +
418  GetCppTypeid<T6> () + "," +
419  GetCppTypeid<T7> () + "," +
420  GetCppTypeid<T8> () +
421  ">";
422  return id;
423  }
424 };
426 template <typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>
427 class CallbackImpl : public CallbackImplBase
428 {
429 public:
430  virtual ~CallbackImpl ()
431  {}
432  virtual R operator() (T1, T2, T3, T4, T5, T6, T7, T8, T9) = 0;
433  virtual std::string GetTypeid (void) const
434  {
435  return DoGetTypeid ();
436  }
438  static std::string DoGetTypeid (void)
439  {
440  static std::string id = "CallbackImpl<" +
441  GetCppTypeid<R> () + "," +
442  GetCppTypeid<T1> () + "," +
443  GetCppTypeid<T2> () + "," +
444  GetCppTypeid<T3> () + "," +
445  GetCppTypeid<T4> () + "," +
446  GetCppTypeid<T5> () + "," +
447  GetCppTypeid<T6> () + "," +
448  GetCppTypeid<T7> () + "," +
449  GetCppTypeid<T8> () + "," +
450  GetCppTypeid<T9> () +
451  ">";
452  return id;
453  }
454 };
462 template <typename T, typename R, typename T1, typename T2, typename T3, typename T4,typename T5, typename T6, typename T7, typename T8, typename T9>
463 class FunctorCallbackImpl : public CallbackImpl<R,T1,T2,T3,T4,T5,T6,T7,T8,T9>
464 {
465 public:
471  FunctorCallbackImpl (T const &functor)
472  : m_functor (functor)
473  {}
475  {}
481  R operator() (void)
482  {
483  return m_functor ();
484  }
489  R operator() (T1 a1)
490  {
491  return m_functor (a1);
492  }
498  R operator() (T1 a1,T2 a2)
499  {
500  return m_functor (a1,a2);
501  }
508  R operator() (T1 a1,T2 a2,T3 a3)
509  {
510  return m_functor (a1,a2,a3);
511  }
519  R operator() (T1 a1,T2 a2,T3 a3,T4 a4)
520  {
521  return m_functor (a1,a2,a3,a4);
522  }
531  R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5)
532  {
533  return m_functor (a1,a2,a3,a4,a5);
534  }
544  R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6)
545  {
546  return m_functor (a1,a2,a3,a4,a5,a6);
547  }
558  R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7)
559  {
560  return m_functor (a1,a2,a3,a4,a5,a6,a7);
561  }
573  R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7,T8 a8)
574  {
575  return m_functor (a1,a2,a3,a4,a5,a6,a7,a8);
576  }
589  R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7,T8 a8,T9 a9)
590  {
591  return m_functor (a1,a2,a3,a4,a5,a6,a7,a8,a9);
592  }
600  virtual bool IsEqual (Ptr<const CallbackImplBase> other) const
601  {
604  if (otherDerived == 0)
605  {
606  return false;
607  }
608  else if (otherDerived->m_functor != m_functor)
609  {
610  return false;
611  }
612  return true;
613  }
614 
615 private:
617 };
618 
623 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>
624 class MemPtrCallbackImpl : public CallbackImpl<R,T1,T2,T3,T4,T5,T6,T7,T8,T9>
625 {
626 public:
633  MemPtrCallbackImpl (OBJ_PTR const&objPtr, MEM_PTR memPtr)
634  : m_objPtr (objPtr), m_memPtr (memPtr)
635  {}
637  {}
643  R operator() (void)
644  {
646  }
651  R operator() (T1 a1)
652  {
654  }
660  R operator() (T1 a1,T2 a2)
661  {
663  }
670  R operator() (T1 a1,T2 a2,T3 a3)
671  {
672  return ((CallbackTraits<OBJ_PTR>::GetReference (m_objPtr)).*m_memPtr)(a1, a2, a3);
673  }
681  R operator() (T1 a1,T2 a2,T3 a3,T4 a4)
682  {
683  return ((CallbackTraits<OBJ_PTR>::GetReference (m_objPtr)).*m_memPtr)(a1, a2, a3, a4);
684  }
693  R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5)
694  {
695  return ((CallbackTraits<OBJ_PTR>::GetReference (m_objPtr)).*m_memPtr)(a1, a2, a3, a4, a5);
696  }
706  R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6)
707  {
708  return ((CallbackTraits<OBJ_PTR>::GetReference (m_objPtr)).*m_memPtr)(a1, a2, a3, a4, a5, a6);
709  }
720  R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7)
721  {
722  return ((CallbackTraits<OBJ_PTR>::GetReference (m_objPtr)).*m_memPtr)(a1, a2, a3, a4, a5, a6, a7);
723  }
735  R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7,T8 a8)
736  {
737  return ((CallbackTraits<OBJ_PTR>::GetReference (m_objPtr)).*m_memPtr)(a1, a2, a3, a4, a5, a6, a7, a8);
738  }
751  R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7,T8 a8, T9 a9)
752  {
753  return ((CallbackTraits<OBJ_PTR>::GetReference (m_objPtr)).*m_memPtr)(a1, a2, a3, a4, a5, a6, a7, a8, a9);
754  }
762  virtual bool IsEqual (Ptr<const CallbackImplBase> other) const
763  {
766  if (otherDerived == 0)
767  {
768  return false;
769  }
770  else if (otherDerived->m_objPtr != m_objPtr
771  || otherDerived->m_memPtr != m_memPtr)
772  {
773  return false;
774  }
775  return true;
776  }
777 
778 private:
779  OBJ_PTR const m_objPtr;
780  MEM_PTR m_memPtr;
781 };
782 
787 template <typename T, typename R, typename TX, typename T1, typename T2, typename T3, typename T4,typename T5, typename T6, typename T7, typename T8>
788 class BoundFunctorCallbackImpl : public CallbackImpl<R,T1,T2,T3,T4,T5,T6,T7,T8,empty>
789 {
790 public:
796  template <typename FUNCTOR, typename ARG>
797  BoundFunctorCallbackImpl (FUNCTOR functor, ARG a)
798  : m_functor (functor), m_a (a)
799  {}
801  {}
807  R operator() (void)
808  {
809  return m_functor (m_a);
810  }
815  R operator() (T1 a1)
816  {
817  return m_functor (m_a,a1);
818  }
824  R operator() (T1 a1,T2 a2)
825  {
826  return m_functor (m_a,a1,a2);
827  }
834  R operator() (T1 a1,T2 a2,T3 a3)
835  {
836  return m_functor (m_a,a1,a2,a3);
837  }
845  R operator() (T1 a1,T2 a2,T3 a3,T4 a4)
846  {
847  return m_functor (m_a,a1,a2,a3,a4);
848  }
857  R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5)
858  {
859  return m_functor (m_a,a1,a2,a3,a4,a5);
860  }
870  R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6)
871  {
872  return m_functor (m_a,a1,a2,a3,a4,a5,a6);
873  }
884  R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7)
885  {
886  return m_functor (m_a,a1,a2,a3,a4,a5,a6,a7);
887  }
899  R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7,T8 a8)
900  {
901  return m_functor (m_a,a1,a2,a3,a4,a5,a6,a7,a8);
902  }
910  virtual bool IsEqual (Ptr<const CallbackImplBase> other) const
911  {
914  if (otherDerived == 0)
915  {
916  return false;
917  }
918  else if (otherDerived->m_functor != m_functor
919  || otherDerived->m_a != m_a)
920  {
921  return false;
922  }
923  return true;
924  }
925 
926 private:
929 };
930 
935 template <typename T, typename R, typename TX1, typename TX2, typename T1, typename T2, typename T3, typename T4,typename T5, typename T6, typename T7>
936 class TwoBoundFunctorCallbackImpl : public CallbackImpl<R,T1,T2,T3,T4,T5,T6,T7,empty,empty>
937 {
938 public:
945  template <typename FUNCTOR, typename ARG1, typename ARG2>
946  TwoBoundFunctorCallbackImpl (FUNCTOR functor, ARG1 arg1, ARG2 arg2)
947  : m_functor (functor), m_a1 (arg1), m_a2 (arg2)
948  {}
950  {}
956  R operator() (void)
957  {
958  return m_functor (m_a1,m_a2);
959  }
964  R operator() (T1 a1)
965  {
966  return m_functor (m_a1,m_a2,a1);
967  }
973  R operator() (T1 a1,T2 a2)
974  {
975  return m_functor (m_a1,m_a2,a1,a2);
976  }
983  R operator() (T1 a1,T2 a2,T3 a3)
984  {
985  return m_functor (m_a1,m_a2,a1,a2,a3);
986  }
994  R operator() (T1 a1,T2 a2,T3 a3,T4 a4)
995  {
996  return m_functor (m_a1,m_a2,a1,a2,a3,a4);
997  }
1006  R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5)
1007  {
1008  return m_functor (m_a1,m_a2,a1,a2,a3,a4,a5);
1009  }
1019  R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6)
1020  {
1021  return m_functor (m_a1,m_a2,a1,a2,a3,a4,a5,a6);
1022  }
1033  R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7)
1034  {
1035  return m_functor (m_a1,m_a2,a1,a2,a3,a4,a5,a6,a7);
1036  }
1044  virtual bool IsEqual (Ptr<const CallbackImplBase> other) const
1045  {
1048  if (otherDerived == 0)
1049  {
1050  return false;
1051  }
1052  else if (otherDerived->m_functor != m_functor
1053  || otherDerived->m_a1 != m_a1 || otherDerived->m_a2 != m_a2)
1054  {
1055  return false;
1056  }
1057  return true;
1058  }
1059 
1060 private:
1064 };
1065 
1070 template <typename T, typename R, typename TX1, typename TX2, typename TX3, typename T1, typename T2, typename T3, typename T4,typename T5, typename T6>
1071 class ThreeBoundFunctorCallbackImpl : public CallbackImpl<R,T1,T2,T3,T4,T5,T6,empty,empty,empty>
1072 {
1073 public:
1081  template <typename FUNCTOR, typename ARG1, typename ARG2, typename ARG3>
1082  ThreeBoundFunctorCallbackImpl (FUNCTOR functor, ARG1 arg1, ARG2 arg2, ARG3 arg3)
1083  : m_functor (functor), m_a1 (arg1), m_a2 (arg2), m_a3 (arg3)
1084  {}
1086  {}
1092  R operator() (void)
1093  {
1094  return m_functor (m_a1,m_a2,m_a3);
1095  }
1100  R operator() (T1 a1)
1101  {
1102  return m_functor (m_a1,m_a2,m_a3,a1);
1103  }
1109  R operator() (T1 a1,T2 a2)
1110  {
1111  return m_functor (m_a1,m_a2,m_a3,a1,a2);
1112  }
1119  R operator() (T1 a1,T2 a2,T3 a3)
1120  {
1121  return m_functor (m_a1,m_a2,m_a3,a1,a2,a3);
1122  }
1130  R operator() (T1 a1,T2 a2,T3 a3,T4 a4)
1131  {
1132  return m_functor (m_a1,m_a2,m_a3,a1,a2,a3,a4);
1133  }
1142  R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5)
1143  {
1144  return m_functor (m_a1,m_a2,m_a3,a1,a2,a3,a4,a5);
1145  }
1155  R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6)
1156  {
1157  return m_functor (m_a1,m_a2,m_a3,a1,a2,a3,a4,a5,a6);
1158  }
1166  virtual bool IsEqual (Ptr<const CallbackImplBase> other) const
1167  {
1170  if (otherDerived == 0)
1171  {
1172  return false;
1173  }
1174  else if (otherDerived->m_functor != m_functor
1175  || otherDerived->m_a1 != m_a1 || otherDerived->m_a2 != m_a2 || otherDerived->m_a3 != m_a3)
1176  {
1177  return false;
1178  }
1179  return true;
1180  }
1181 
1182 private:
1187 };
1188 
1195 {
1196 public:
1198  {}
1201  {
1202  return m_impl;
1203  }
1204 
1205 protected:
1211  {}
1213 };
1214 
1267 template<typename R,
1268  typename T1 = empty, typename T2 = empty,
1269  typename T3 = empty, typename T4 = empty,
1270  typename T5 = empty, typename T6 = empty,
1271  typename T7 = empty, typename T8 = empty,
1272  typename T9 = empty>
1273 class Callback : public CallbackBase
1274 {
1275 public:
1277  {}
1278 
1288  template <typename FUNCTOR>
1289  Callback (FUNCTOR const &functor, bool, bool)
1290  : CallbackBase (Create<FunctorCallbackImpl<FUNCTOR,R,T1,T2,T3,T4,T5,T6,T7,T8,T9> > (functor))
1291  {}
1292 
1299  template <typename OBJ_PTR, typename MEM_PTR>
1300  Callback (OBJ_PTR const &objPtr, MEM_PTR memPtr)
1301  : CallbackBase (Create<MemPtrCallbackImpl<OBJ_PTR,MEM_PTR,R,T1,T2,T3,T4,T5,T6,T7,T8,T9> > (objPtr, memPtr))
1302  {}
1303 
1310  : CallbackBase (impl)
1311  {}
1312 
1319  template <typename T>
1321  {
1326  R,T1,T2,T3,T4,T5,T6,T7,T8,T9> (*this, a), false);
1328  }
1329 
1337  template <typename TX1, typename TX2>
1339  {
1344  R,T1,T2,T3,T4,T5,T6,T7,T8,T9> (*this, a1, a2), false);
1345  return Callback<R,T3,T4,T5,T6,T7,T8,T9> (impl);
1346  }
1347 
1356  template <typename TX1, typename TX2, typename TX3>
1357  Callback<R,T4,T5,T6,T7,T8,T9> ThreeBind (TX1 a1, TX2 a2, TX3 a3)
1358  {
1363  R,T1,T2,T3,T4,T5,T6,T7,T8,T9> (*this, a1, a2, a3), false);
1364  return Callback<R,T4,T5,T6,T7,T8,T9> (impl);
1365  }
1366 
1372  bool IsNull (void) const
1373  {
1374  return (DoPeekImpl () == 0) ? true : false;
1375  }
1377  void Nullify (void)
1378  {
1379  m_impl = 0;
1380  }
1381 
1387  R operator() (void) const
1388  {
1389  return (*(DoPeekImpl ()))();
1390  }
1395  R operator() (T1 a1) const
1396  {
1397  return (*(DoPeekImpl ()))(a1);
1398  }
1404  R operator() (T1 a1, T2 a2) const
1405  {
1406  return (*(DoPeekImpl ()))(a1,a2);
1407  }
1414  R operator() (T1 a1, T2 a2, T3 a3) const
1415  {
1416  return (*(DoPeekImpl ()))(a1,a2,a3);
1417  }
1425  R operator() (T1 a1, T2 a2, T3 a3, T4 a4) const
1426  {
1427  return (*(DoPeekImpl ()))(a1,a2,a3,a4);
1428  }
1437  R operator() (T1 a1, T2 a2, T3 a3, T4 a4,T5 a5) const
1438  {
1439  return (*(DoPeekImpl ()))(a1,a2,a3,a4,a5);
1440  }
1450  R operator() (T1 a1, T2 a2, T3 a3, T4 a4,T5 a5,T6 a6) const
1451  {
1452  return (*(DoPeekImpl ()))(a1,a2,a3,a4,a5,a6);
1453  }
1464  R operator() (T1 a1, T2 a2, T3 a3, T4 a4,T5 a5,T6 a6,T7 a7) const
1465  {
1466  return (*(DoPeekImpl ()))(a1,a2,a3,a4,a5,a6,a7);
1467  }
1479  R operator() (T1 a1, T2 a2, T3 a3, T4 a4,T5 a5,T6 a6,T7 a7,T8 a8) const
1480  {
1481  return (*(DoPeekImpl ()))(a1,a2,a3,a4,a5,a6,a7,a8);
1482  }
1495  R operator() (T1 a1, T2 a2, T3 a3, T4 a4,T5 a5,T6 a6,T7 a7,T8 a8, T9 a9) const
1496  {
1497  return (*(DoPeekImpl ()))(a1,a2,a3,a4,a5,a6,a7,a8,a9);
1498  }
1507  bool IsEqual (const CallbackBase &other) const
1508  {
1509  return m_impl->IsEqual (other.GetImpl ());
1510  }
1511 
1518  bool CheckType (const CallbackBase & other) const
1519  {
1520  return DoCheckType (other.GetImpl ());
1521  }
1528  bool Assign (const CallbackBase &other)
1529  {
1530  return DoAssign (other.GetImpl ());
1531  }
1532 
1533 private:
1536  {
1538  }
1546  {
1547  if (other != 0
1548  && dynamic_cast<const CallbackImpl<R,T1,T2,T3,T4,T5,T6,T7,T8,T9> *> (PeekPointer (other)) != 0)
1549  {
1550  return true;
1551  }
1552  else if (other == 0)
1553  {
1554  return true;
1555  }
1556  else
1557  {
1558  return false;
1559  }
1560  }
1563  {
1564  if (!DoCheckType (other))
1565  {
1566  std::string othTid = other->GetTypeid ();
1568  NS_FATAL_ERROR_CONT ("Incompatible types. (feed to \"c++filt -t\" if needed)" << std::endl <<
1569  "got=" << othTid << std::endl <<
1570  "expected=" << myTid);
1571  return false;
1572  }
1573  m_impl = const_cast<CallbackImplBase *> (PeekPointer (other));
1574  return true;
1575  }
1576 };
1577 
1578 
1587 template <typename R, typename T1, typename T2,
1588  typename T3, typename T4,
1589  typename T5, typename T6,
1590  typename T7, typename T8,
1591  typename T9>
1593 {
1594  return !a.IsEqual (b);
1595 }
1596 
1609 template <typename T, typename OBJ, typename R>
1610 Callback<R> MakeCallback (R (T::*memPtr)(void), OBJ objPtr)
1611 {
1612  return Callback<R> (objPtr, memPtr);
1613 }
1614 template <typename T, typename OBJ, typename R>
1615 Callback<R> MakeCallback (R (T::*memPtr)() const, OBJ objPtr)
1616 {
1617  return Callback<R> (objPtr, memPtr);
1618 }
1619 template <typename T, typename OBJ, typename R, typename T1>
1620 Callback<R,T1> MakeCallback (R (T::*memPtr)(T1), OBJ objPtr)
1621 {
1622  return Callback<R,T1> (objPtr, memPtr);
1623 }
1624 template <typename T, typename OBJ, typename R, typename T1>
1625 Callback<R,T1> MakeCallback (R (T::*memPtr)(T1) const, OBJ objPtr)
1626 {
1627  return Callback<R,T1> (objPtr, memPtr);
1628 }
1629 template <typename T, typename OBJ, typename R, typename T1, typename T2>
1630 Callback<R,T1,T2> MakeCallback (R (T::*memPtr)(T1,T2), OBJ objPtr)
1631 {
1632  return Callback<R,T1,T2> (objPtr, memPtr);
1633 }
1634 template <typename T, typename OBJ, typename R, typename T1, typename T2>
1635 Callback<R,T1,T2> MakeCallback (R (T::*memPtr)(T1,T2) const, OBJ objPtr)
1636 {
1637  return Callback<R,T1,T2> (objPtr, memPtr);
1638 }
1639 template <typename T, typename OBJ, typename R, typename T1,typename T2, typename T3>
1640 Callback<R,T1,T2,T3> MakeCallback (R (T::*memPtr)(T1,T2,T3), OBJ objPtr)
1641 {
1642  return Callback<R,T1,T2,T3> (objPtr, memPtr);
1643 }
1644 template <typename T, typename OBJ, typename R, typename T1,typename T2, typename T3>
1645 Callback<R,T1,T2,T3> MakeCallback (R (T::*memPtr)(T1,T2,T3) const, OBJ objPtr)
1646 {
1647  return Callback<R,T1,T2,T3> (objPtr, memPtr);
1648 }
1649 template <typename T, typename OBJ, typename R, typename T1, typename T2, typename T3, typename T4>
1650 Callback<R,T1,T2,T3,T4> MakeCallback (R (T::*memPtr)(T1,T2,T3,T4), OBJ objPtr)
1651 {
1652  return Callback<R,T1,T2,T3,T4> (objPtr, memPtr);
1653 }
1654 template <typename T, typename OBJ, typename R, typename T1, typename T2, typename T3, typename T4>
1655 Callback<R,T1,T2,T3,T4> MakeCallback (R (T::*memPtr)(T1,T2,T3,T4) const, OBJ objPtr)
1656 {
1657  return Callback<R,T1,T2,T3,T4> (objPtr, memPtr);
1658 }
1659 template <typename T, typename OBJ, typename R, typename T1, typename T2, typename T3, typename T4,typename T5>
1660 Callback<R,T1,T2,T3,T4,T5> MakeCallback (R (T::*memPtr)(T1,T2,T3,T4,T5), OBJ objPtr)
1661 {
1662  return Callback<R,T1,T2,T3,T4,T5> (objPtr, memPtr);
1663 }
1664 template <typename T, typename OBJ, typename R, typename T1, typename T2, typename T3, typename T4,typename T5>
1665 Callback<R,T1,T2,T3,T4,T5> MakeCallback (R (T::*memPtr)(T1,T2,T3,T4,T5) const, OBJ objPtr)
1666 {
1667  return Callback<R,T1,T2,T3,T4,T5> (objPtr, memPtr);
1668 }
1669 template <typename T, typename OBJ, typename R, typename T1, typename T2, typename T3, typename T4,typename T5,typename T6>
1670 Callback<R,T1,T2,T3,T4,T5,T6> MakeCallback (R (T::*memPtr)(T1,T2,T3,T4,T5,T6), OBJ objPtr)
1671 {
1672  return Callback<R,T1,T2,T3,T4,T5,T6> (objPtr, memPtr);
1673 }
1674 template <typename T, typename OBJ, typename R, typename T1, typename T2, typename T3, typename T4,typename T5, typename T6>
1675 Callback<R,T1,T2,T3,T4,T5,T6> MakeCallback (R (T::*memPtr)(T1,T2,T3,T4,T5,T6) const, OBJ objPtr)
1676 {
1677  return Callback<R,T1,T2,T3,T4,T5,T6> (objPtr, memPtr);
1678 }
1679 template <typename T, typename OBJ, typename R, typename T1, typename T2, typename T3, typename T4,typename T5,typename T6, typename T7>
1680 Callback<R,T1,T2,T3,T4,T5,T6,T7> MakeCallback (R (T::*memPtr)(T1,T2,T3,T4,T5,T6,T7), OBJ objPtr)
1681 {
1682  return Callback<R,T1,T2,T3,T4,T5,T6,T7> (objPtr, memPtr);
1683 }
1684 template <typename T, typename OBJ, typename R, typename T1, typename T2, typename T3, typename T4,typename T5, typename T6, typename T7>
1685 Callback<R,T1,T2,T3,T4,T5,T6,T7> MakeCallback (R (T::*memPtr)(T1,T2,T3,T4,T5,T6,T7) const, OBJ objPtr)
1686 {
1687  return Callback<R,T1,T2,T3,T4,T5,T6,T7> (objPtr, memPtr);
1688 }
1689 template <typename T, typename OBJ, typename R, typename T1, typename T2, typename T3, typename T4,typename T5,typename T6, typename T7, typename T8>
1690 Callback<R,T1,T2,T3,T4,T5,T6,T7,T8> MakeCallback (R (T::*memPtr)(T1,T2,T3,T4,T5,T6,T7,T8), OBJ objPtr)
1691 {
1692  return Callback<R,T1,T2,T3,T4,T5,T6,T7,T8> (objPtr, memPtr);
1693 }
1694 template <typename T, typename OBJ, typename R, typename T1, typename T2, typename T3, typename T4,typename T5, typename T6, typename T7, typename T8>
1695 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)
1696 {
1697  return Callback<R,T1,T2,T3,T4,T5,T6,T7,T8> (objPtr, memPtr);
1698 }
1699 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>
1700 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)
1701 {
1702  return Callback<R,T1,T2,T3,T4,T5,T6,T7,T8,T9> (objPtr, memPtr);
1703 }
1704 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>
1705 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)
1706 {
1707  return Callback<R,T1,T2,T3,T4,T5,T6,T7,T8,T9> (objPtr, memPtr);
1708 }
1722 template <typename R>
1724 {
1725  return Callback<R> (fnPtr, true, true);
1726 }
1727 template <typename R, typename T1>
1729 {
1730  return Callback<R,T1> (fnPtr, true, true);
1731 }
1732 template <typename R, typename T1, typename T2>
1733 Callback<R,T1,T2> MakeCallback (R (*fnPtr)(T1,T2))
1734 {
1735  return Callback<R,T1,T2> (fnPtr, true, true);
1736 }
1737 template <typename R, typename T1, typename T2,typename T3>
1738 Callback<R,T1,T2,T3> MakeCallback (R (*fnPtr)(T1,T2,T3))
1739 {
1740  return Callback<R,T1,T2,T3> (fnPtr, true, true);
1741 }
1742 template <typename R, typename T1, typename T2,typename T3,typename T4>
1743 Callback<R,T1,T2,T3,T4> MakeCallback (R (*fnPtr)(T1,T2,T3,T4))
1744 {
1745  return Callback<R,T1,T2,T3,T4> (fnPtr, true, true);
1746 }
1747 template <typename R, typename T1, typename T2,typename T3,typename T4,typename T5>
1748 Callback<R,T1,T2,T3,T4,T5> MakeCallback (R (*fnPtr)(T1,T2,T3,T4,T5))
1749 {
1750  return Callback<R,T1,T2,T3,T4,T5> (fnPtr, true, true);
1751 }
1752 template <typename R, typename T1, typename T2,typename T3,typename T4,typename T5,typename T6>
1753 Callback<R,T1,T2,T3,T4,T5,T6> MakeCallback (R (*fnPtr)(T1,T2,T3,T4,T5,T6))
1754 {
1755  return Callback<R,T1,T2,T3,T4,T5,T6> (fnPtr, true, true);
1756 }
1757 template <typename R, typename T1, typename T2,typename T3,typename T4,typename T5,typename T6, typename T7>
1758 Callback<R,T1,T2,T3,T4,T5,T6,T7> MakeCallback (R (*fnPtr)(T1,T2,T3,T4,T5,T6,T7))
1759 {
1760  return Callback<R,T1,T2,T3,T4,T5,T6,T7> (fnPtr, true, true);
1761 }
1762 template <typename R, typename T1, typename T2,typename T3,typename T4,typename T5,typename T6, typename T7, typename T8>
1763 Callback<R,T1,T2,T3,T4,T5,T6,T7,T8> MakeCallback (R (*fnPtr)(T1,T2,T3,T4,T5,T6,T7,T8))
1764 {
1765  return Callback<R,T1,T2,T3,T4,T5,T6,T7,T8> (fnPtr, true, true);
1766 }
1767 template <typename R, typename T1, typename T2,typename T3,typename T4,typename T5,typename T6, typename T7, typename T8, typename T9>
1768 Callback<R,T1,T2,T3,T4,T5,T6,T7,T8,T9> MakeCallback (R (*fnPtr)(T1,T2,T3,T4,T5,T6,T7,T8,T9))
1769 {
1770  return Callback<R,T1,T2,T3,T4,T5,T6,T7,T8,T9> (fnPtr, true, true);
1771 }
1785 template <typename R>
1787 {
1788  return Callback<R> ();
1789 }
1790 template <typename R, typename T1>
1792 {
1793  return Callback<R,T1> ();
1794 }
1795 template <typename R, typename T1, typename T2>
1797 {
1798  return Callback<R,T1,T2> ();
1799 }
1800 template <typename R, typename T1, typename T2,typename T3>
1802 {
1803  return Callback<R,T1,T2,T3> ();
1804 }
1805 template <typename R, typename T1, typename T2,typename T3,typename T4>
1807 {
1808  return Callback<R,T1,T2,T3,T4> ();
1809 }
1810 template <typename R, typename T1, typename T2,typename T3,typename T4,typename T5>
1812 {
1813  return Callback<R,T1,T2,T3,T4,T5> ();
1814 }
1815 template <typename R, typename T1, typename T2,typename T3,typename T4,typename T5,typename T6>
1817 {
1819 }
1820 template <typename R, typename T1, typename T2,typename T3,typename T4,typename T5,typename T6, typename T7>
1822 {
1824 }
1825 template <typename R, typename T1, typename T2,typename T3,typename T4,typename T5,typename T6, typename T7, typename T8>
1827 {
1829 }
1830 template <typename R, typename T1, typename T2,typename T3,typename T4,typename T5,typename T6, typename T7, typename T8, typename T9>
1832 {
1834 }
1846 template <typename R, typename TX, typename ARG>
1847 Callback<R> MakeBoundCallback (R (*fnPtr)(TX), ARG a1)
1848 {
1850  Create<BoundFunctorCallbackImpl<R (*)(TX),R,TX,empty,empty,empty,empty,empty,empty,empty,empty> > (fnPtr, a1);
1851  return Callback<R> (impl);
1852 }
1853 template <typename R, typename TX, typename ARG,
1854  typename T1>
1855 Callback<R,T1> MakeBoundCallback (R (*fnPtr)(TX,T1), ARG a1)
1856 {
1858  Create<BoundFunctorCallbackImpl<R (*)(TX,T1),R,TX,T1,empty,empty,empty,empty,empty,empty,empty> > (fnPtr, a1);
1859  return Callback<R,T1> (impl);
1860 }
1861 template <typename R, typename TX, typename ARG,
1862  typename T1, typename T2>
1863 Callback<R,T1,T2> MakeBoundCallback (R (*fnPtr)(TX,T1,T2), ARG a1)
1864 {
1866  Create<BoundFunctorCallbackImpl<R (*)(TX,T1,T2),R,TX,T1,T2,empty,empty,empty,empty,empty,empty> > (fnPtr, a1);
1867  return Callback<R,T1,T2> (impl);
1868 }
1869 template <typename R, typename TX, typename ARG,
1870  typename T1, typename T2,typename T3>
1871 Callback<R,T1,T2,T3> MakeBoundCallback (R (*fnPtr)(TX,T1,T2,T3), ARG a1)
1872 {
1874  Create<BoundFunctorCallbackImpl<R (*)(TX,T1,T2,T3),R,TX,T1,T2,T3,empty,empty,empty,empty,empty> > (fnPtr, a1);
1875  return Callback<R,T1,T2,T3> (impl);
1876 }
1877 template <typename R, typename TX, typename ARG,
1878  typename T1, typename T2,typename T3,typename T4>
1879 Callback<R,T1,T2,T3,T4> MakeBoundCallback (R (*fnPtr)(TX,T1,T2,T3,T4), ARG a1)
1880 {
1882  Create<BoundFunctorCallbackImpl<R (*)(TX,T1,T2,T3,T4),R,TX,T1,T2,T3,T4,empty,empty,empty,empty> > (fnPtr, a1);
1883  return Callback<R,T1,T2,T3,T4> (impl);
1884 }
1885 template <typename R, typename TX, typename ARG,
1886  typename T1, typename T2,typename T3,typename T4,typename T5>
1887 Callback<R,T1,T2,T3,T4,T5> MakeBoundCallback (R (*fnPtr)(TX,T1,T2,T3,T4,T5), ARG a1)
1888 {
1890  Create<BoundFunctorCallbackImpl<R (*)(TX,T1,T2,T3,T4,T5),R,TX,T1,T2,T3,T4,T5,empty,empty,empty> > (fnPtr, a1);
1891  return Callback<R,T1,T2,T3,T4,T5> (impl);
1892 }
1893 template <typename R, typename TX, typename ARG,
1894  typename T1, typename T2,typename T3,typename T4,typename T5, typename T6>
1895 Callback<R,T1,T2,T3,T4,T5,T6> MakeBoundCallback (R (*fnPtr)(TX,T1,T2,T3,T4,T5,T6), ARG a1)
1896 {
1898  Create<BoundFunctorCallbackImpl<R (*)(TX,T1,T2,T3,T4,T5,T6),R,TX,T1,T2,T3,T4,T5,T6,empty,empty> > (fnPtr, a1);
1899  return Callback<R,T1,T2,T3,T4,T5,T6> (impl);
1900 }
1901 template <typename R, typename TX, typename ARG,
1902  typename T1, typename T2,typename T3,typename T4,typename T5, typename T6, typename T7>
1903 Callback<R,T1,T2,T3,T4,T5,T6,T7> MakeBoundCallback (R (*fnPtr)(TX,T1,T2,T3,T4,T5,T6,T7), ARG a1)
1904 {
1906  Create<BoundFunctorCallbackImpl<R (*)(TX,T1,T2,T3,T4,T5,T6,T7),R,TX,T1,T2,T3,T4,T5,T6,T7,empty> > (fnPtr, a1);
1907  return Callback<R,T1,T2,T3,T4,T5,T6,T7> (impl);
1908 }
1909 template <typename R, typename TX, typename ARG,
1910  typename T1, typename T2,typename T3,typename T4,typename T5, typename T6, typename T7, typename T8>
1911 Callback<R,T1,T2,T3,T4,T5,T6,T7,T8> MakeBoundCallback (R (*fnPtr)(TX,T1,T2,T3,T4,T5,T6,T7,T8), ARG a1)
1912 {
1914  Create<BoundFunctorCallbackImpl<R (*)(TX,T1,T2,T3,T4,T5,T6,T7,T8),R,TX,T1,T2,T3,T4,T5,T6,T7,T8> > (fnPtr, a1);
1916 }
1928 template <typename R, typename TX1, typename TX2, typename ARG1, typename ARG2>
1929 Callback<R> MakeBoundCallback (R (*fnPtr)(TX1,TX2), ARG1 a1, ARG2 a2)
1930 {
1932  Create<TwoBoundFunctorCallbackImpl<R (*)(TX1,TX2),R,TX1,TX2,empty,empty,empty,empty,empty,empty,empty> > (fnPtr, a1, a2);
1933  return Callback<R> (impl);
1934 }
1935 template <typename R, typename TX1, typename TX2, typename ARG1, typename ARG2,
1936  typename T1>
1937 Callback<R,T1> MakeBoundCallback (R (*fnPtr)(TX1,TX2,T1), ARG1 a1, ARG2 a2)
1938 {
1940  Create<TwoBoundFunctorCallbackImpl<R (*)(TX1,TX2,T1),R,TX1,TX2,T1,empty,empty,empty,empty,empty,empty> > (fnPtr, a1, a2);
1941  return Callback<R,T1> (impl);
1942 }
1943 template <typename R, typename TX1, typename TX2, typename ARG1, typename ARG2,
1944  typename T1, typename T2>
1945 Callback<R,T1,T2> MakeBoundCallback (R (*fnPtr)(TX1,TX2,T1,T2), ARG1 a1, ARG2 a2)
1946 {
1948  Create<TwoBoundFunctorCallbackImpl<R (*)(TX1,TX2,T1,T2),R,TX1,TX2,T1,T2,empty,empty,empty,empty,empty> > (fnPtr, a1, a2);
1949  return Callback<R,T1,T2> (impl);
1950 }
1951 template <typename R, typename TX1, typename TX2, typename ARG1, typename ARG2,
1952  typename T1, typename T2,typename T3>
1953 Callback<R,T1,T2,T3> MakeBoundCallback (R (*fnPtr)(TX1,TX2,T1,T2,T3), ARG1 a1, ARG2 a2)
1954 {
1956  Create<TwoBoundFunctorCallbackImpl<R (*)(TX1,TX2,T1,T2,T3),R,TX1,TX2,T1,T2,T3,empty,empty,empty,empty> > (fnPtr, a1, a2);
1957  return Callback<R,T1,T2,T3> (impl);
1958 }
1959 template <typename R, typename TX1, typename TX2, typename ARG1, typename ARG2,
1960  typename T1, typename T2,typename T3,typename T4>
1961 Callback<R,T1,T2,T3,T4> MakeBoundCallback (R (*fnPtr)(TX1,TX2,T1,T2,T3,T4), ARG1 a1, ARG2 a2)
1962 {
1964  Create<TwoBoundFunctorCallbackImpl<R (*)(TX1,TX2,T1,T2,T3,T4),R,TX1,TX2,T1,T2,T3,T4,empty,empty,empty> > (fnPtr, a1, a2);
1965  return Callback<R,T1,T2,T3,T4> (impl);
1966 }
1967 template <typename R, typename TX1, typename TX2, typename ARG1, typename ARG2,
1968  typename T1, typename T2,typename T3,typename T4,typename T5>
1969 Callback<R,T1,T2,T3,T4,T5> MakeBoundCallback (R (*fnPtr)(TX1,TX2,T1,T2,T3,T4,T5), ARG1 a1, ARG2 a2)
1970 {
1972  Create<TwoBoundFunctorCallbackImpl<R (*)(TX1,TX2,T1,T2,T3,T4,T5),R,TX1,TX2,T1,T2,T3,T4,T5,empty,empty> > (fnPtr, a1, a2);
1973  return Callback<R,T1,T2,T3,T4,T5> (impl);
1974 }
1975 template <typename R, typename TX1, typename TX2, typename ARG1, typename ARG2,
1976  typename T1, typename T2,typename T3,typename T4,typename T5, typename T6>
1977 Callback<R,T1,T2,T3,T4,T5,T6> MakeBoundCallback (R (*fnPtr)(TX1,TX2,T1,T2,T3,T4,T5,T6), ARG1 a1, ARG2 a2)
1978 {
1980  Create<TwoBoundFunctorCallbackImpl<R (*)(TX1,TX2,T1,T2,T3,T4,T5,T6),R,TX1,TX2,T1,T2,T3,T4,T5,T6,empty> > (fnPtr, a1, a2);
1981  return Callback<R,T1,T2,T3,T4,T5,T6> (impl);
1982 }
1983 template <typename R, typename TX1, typename TX2, typename ARG1, typename ARG2,
1984  typename T1, typename T2,typename T3,typename T4,typename T5, typename T6, typename T7>
1985 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)
1986 {
1988  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);
1989  return Callback<R,T1,T2,T3,T4,T5,T6,T7> (impl);
1990 }
2003 template <typename R, typename TX1, typename TX2, typename TX3, typename ARG1, typename ARG2, typename ARG3>
2004 Callback<R> MakeBoundCallback (R (*fnPtr)(TX1,TX2,TX3), ARG1 a1, ARG2 a2, ARG3 a3)
2005 {
2007  Create<ThreeBoundFunctorCallbackImpl<R (*)(TX1,TX2,TX3),R,TX1,TX2,TX3,empty,empty,empty,empty,empty,empty> > (fnPtr, a1, a2, a3);
2008  return Callback<R> (impl);
2009 }
2010 template <typename R, typename TX1, typename TX2, typename TX3, typename ARG1, typename ARG2, typename ARG3,
2011  typename T1>
2012 Callback<R,T1> MakeBoundCallback (R (*fnPtr)(TX1,TX2,TX3,T1), ARG1 a1, ARG2 a2, ARG3 a3)
2013 {
2015  Create<ThreeBoundFunctorCallbackImpl<R (*)(TX1,TX2,TX3,T1),R,TX1,TX2,TX3,T1,empty,empty,empty,empty,empty> > (fnPtr, a1, a2, a3);
2016  return Callback<R,T1> (impl);
2017 }
2018 template <typename R, typename TX1, typename TX2, typename TX3, typename ARG1, typename ARG2, typename ARG3,
2019  typename T1, typename T2>
2020 Callback<R,T1,T2> MakeBoundCallback (R (*fnPtr)(TX1,TX2,TX3,T1,T2), ARG1 a1, ARG2 a2, ARG3 a3)
2021 {
2023  Create<ThreeBoundFunctorCallbackImpl<R (*)(TX1,TX2,TX3,T1,T2),R,TX1,TX2,TX3,T1,T2,empty,empty,empty,empty> > (fnPtr, a1, a2, a3);
2024  return Callback<R,T1,T2> (impl);
2025 }
2026 template <typename R, typename TX1, typename TX2, typename TX3, typename ARG1, typename ARG2, typename ARG3,
2027  typename T1, typename T2,typename T3>
2028 Callback<R,T1,T2,T3> MakeBoundCallback (R (*fnPtr)(TX1,TX2,TX3,T1,T2,T3), ARG1 a1, ARG2 a2, ARG3 a3)
2029 {
2031  Create<ThreeBoundFunctorCallbackImpl<R (*)(TX1,TX2,TX3,T1,T2,T3),R,TX1,TX2,TX3,T1,T2,T3,empty,empty,empty> > (fnPtr, a1, a2, a3);
2032  return Callback<R,T1,T2,T3> (impl);
2033 }
2034 template <typename R, typename TX1, typename TX2, typename TX3, typename ARG1, typename ARG2, typename ARG3,
2035  typename T1, typename T2,typename T3,typename T4>
2036 Callback<R,T1,T2,T3,T4> MakeBoundCallback (R (*fnPtr)(TX1,TX2,TX3,T1,T2,T3,T4), ARG1 a1, ARG2 a2, ARG3 a3)
2037 {
2039  Create<ThreeBoundFunctorCallbackImpl<R (*)(TX1,TX2,TX3,T1,T2,T3,T4),R,TX1,TX2,TX3,T1,T2,T3,T4,empty,empty> > (fnPtr, a1, a2, a3);
2040  return Callback<R,T1,T2,T3,T4> (impl);
2041 }
2042 template <typename R, typename TX1, typename TX2, typename TX3, typename ARG1, typename ARG2, typename ARG3,
2043  typename T1, typename T2,typename T3,typename T4,typename T5>
2044 Callback<R,T1,T2,T3,T4,T5> MakeBoundCallback (R (*fnPtr)(TX1,TX2,TX3,T1,T2,T3,T4,T5), ARG1 a1, ARG2 a2, ARG3 a3)
2045 {
2047  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);
2048  return Callback<R,T1,T2,T3,T4,T5> (impl);
2049 }
2050 template <typename R, typename TX1, typename TX2, typename TX3, typename ARG1, typename ARG2, typename ARG3,
2051  typename T1, typename T2,typename T3,typename T4,typename T5, typename T6>
2052 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)
2053 {
2055  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);
2056  return Callback<R,T1,T2,T3,T4,T5,T6> (impl);
2057 }
2061 } // namespace ns3
2062 
2063 namespace ns3 {
2064 
2066 {
2067 public:
2069  CallbackValue ();
2074  CallbackValue (const CallbackBase &base);
2076  virtual ~CallbackValue ();
2078  void Set (CallbackBase base);
2085  template <typename T>
2086  bool GetAccessor (T &value) const;
2088  virtual Ptr<AttributeValue> Copy (void) const;
2094  virtual std::string SerializeToString (Ptr<const AttributeChecker> checker) const;
2102  virtual bool DeserializeFromString (std::string value, Ptr<const AttributeChecker> checker);
2103 
2104 private:
2106 };
2107 
2110 
2111 } // namespace ns3
2112 
2113 namespace ns3 {
2114 
2115 template <typename T>
2116 bool CallbackValue::GetAccessor (T &value) const
2117 {
2118  if (value.CheckType (m_value))
2119  {
2120  if (!value.Assign (m_value))
2121  {
2123  }
2124  return true;
2125  }
2126  return false;
2127 }
2128 
2129 } // namespace ns3
2130 
2131 
2132 #endif /* CALLBACK_H */
NS_FATAL_x macro definitions.
static std::string DoGetTypeid(void)
Get the name of this object type.
Definition: callback.h:234
CallbackValue()
Constructor.
Definition: callback.cc:34
static std::string GetCppTypeid(void)
Helper to get the C++ typeid as a string.
Definition: callback.h:171
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:636
Callback template class.
Definition: callback.h:1273
virtual ~BoundFunctorCallbackImpl()
Definition: callback.h:800
virtual ~FunctorCallbackImpl()
Definition: callback.h:474
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:1044
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:1847
virtual std::string SerializeToString(Ptr< const AttributeChecker > checker) const
Serialize to string.
Definition: callback.cc:60
Callback< R, T3, T4, T5, T6, T7, T8, T9 > TwoBind(TX1 a1, TX2 a2)
Bind the first two arguments.
Definition: callback.h:1338
static std::string DoGetTypeid(void)
Get the name of this object type.
Definition: callback.h:354
U * PeekPointer(const Ptr< U > &p)
Definition: ptr.h:566
R operator()(void)
Functor with varying numbers of arguments.
Definition: callback.h:807
Callback< R, T2, T3, T4, T5, T6, T7, T8, T9 > Bind(T a)
Bind the first arguments.
Definition: callback.h:1320
Base class for Callback class.
Definition: callback.h:1194
MemPtrCallbackImpl(OBJ_PTR const &objPtr, MEM_PTR memPtr)
Construct from an object pointer and member function pointer.
Definition: callback.h:633
bool CheckType(const CallbackBase &other) const
Check for compatible types.
Definition: callback.h:1518
virtual ~CallbackValue()
Destructor.
Definition: callback.cc:42
bool Assign(const CallbackBase &other)
Adopt the other&#39;s implementation, if type compatible.
Definition: callback.h:1528
Callback< R > MakeNullCallback(void)
Definition: callback.h:1786
CallbackBase m_value
the CallbackBase
Definition: callback.h:2105
bool IsEqual(const CallbackBase &other) const
Equality test.
Definition: callback.h:1507
virtual bool IsEqual(Ptr< const CallbackImplBase > other) const
Equality test.
Definition: callback.h:600
CallbackImpl for functors with first three arguments bound at construction.
Definition: callback.h:1071
bool DoAssign(Ptr< const CallbackImplBase > other)
Adopt the other&#39;s implementation, if type compatible.
Definition: callback.h:1562
AttributeValue implementation for Callback.
Definition: callback.h:2065
virtual bool IsEqual(Ptr< const CallbackImplBase > other) const
Equality test.
Definition: callback.h:1166
virtual std::string GetTypeid(void) const
Get the name of this object type.
Definition: callback.h:323
The unqualified CallbackImpl class.
Definition: callback.h:192
#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:303
R operator()(void)
Functor with varying numbers of arguments.
Definition: callback.h:481
TypeTraits< TX >::ReferencedType m_a
the bound argument
Definition: callback.h:928
make Callback use a separate empty type
Definition: empty.h:33
R operator()(void)
Functor with varying numbers of arguments.
Definition: callback.h:643
FunctorCallbackImpl(T const &functor)
Construct from a functor.
Definition: callback.h:471
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:797
OBJ_PTR const m_objPtr
the object pointer
Definition: callback.h:779
ns3::AttributeValue, ns3::AttributeAccessor and ns3::AttributeChecker declarations.
MEM_PTR m_memPtr
the member function pointer
Definition: callback.h:780
static std::string DoGetTypeid(void)
Get the name of this object type.
Definition: callback.h:381
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
Definition: callback.h:1610
virtual Ptr< AttributeValue > Copy(void) const
Definition: callback.cc:54
CallbackImpl for pointer to member functions.
Definition: callback.h:624
Callback< R, T4, T5, T6, T7, T8, T9 > ThreeBind(TX1 a1, TX2 a2, TX3 a3)
Bind the first three arguments.
Definition: callback.h:1357
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:409
virtual std::string GetTypeid(void) const
Get the name of this object type.
Definition: callback.h:274
CallbackImpl for functors with first two arguments bound at construction.
Definition: callback.h:936
R operator()(void) const
Functor with varying numbers of arguments.
Definition: callback.h:1387
Callback(Ptr< CallbackImpl< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 > > const &impl)
Construct from a CallbackImpl pointer.
Definition: callback.h:1309
CallbackImpl< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 > * DoPeekImpl(void) const
Definition: callback.h:1535
bool DoCheckType(Ptr< const CallbackImplBase > other) const
Check for compatible types.
Definition: callback.h:1545
TypeTraits< TX3 >::ReferencedType m_a3
third bound argument
Definition: callback.h:1186
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:1592
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:438
virtual std::string GetTypeid(void) const
Get the name of this object type.
Definition: callback.h:376
#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:518
virtual std::string GetTypeid(void) const
Get the name of this object type.
Definition: callback.h:208
virtual std::string GetTypeid(void) const
Get the name of this object type.
Definition: callback.h:251
virtual std::string GetTypeid(void) const
Get the name of this object type.
Definition: callback.h:298
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:256
TypeTraits< TX1 >::ReferencedType m_a1
first bound argument
Definition: callback.h:1184
static std::string DoGetTypeid(void)
Get the name of this object type.
Definition: callback.h:328
Callback(OBJ_PTR const &objPtr, MEM_PTR memPtr)
Construct a member function pointer call back.
Definition: callback.h:1300
Attribute helper (ATTRIBUTE_ )macros definition.
static std::string DoGetTypeid(void)
Get the name of this object type.
Definition: callback.h:213
T m_functor
the functor
Definition: callback.h:616
static std::string DoGetTypeid(void)
Get the name of this object type.
Definition: callback.h:279
#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:956
virtual ~CallbackImpl()
Definition: callback.h:430
TypeTraits< TX1 >::ReferencedType m_a1
first bound argument
Definition: callback.h:1062
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:1289
CallbackImpl for functors with first argument bound at construction.
Definition: callback.h:788
TwoBoundFunctorCallbackImpl(FUNCTOR functor, ARG1 arg1, ARG2 arg2)
Construct from functor and two arguments.
Definition: callback.h:946
CallbackImpl with functors.
Definition: callback.h:463
virtual bool DeserializeFromString(std::string value, Ptr< const AttributeChecker > checker)
Deserialize from string (not implemented)
Definition: callback.cc:68
virtual R operator()(T1, T2, T3, T4, T5, T6, T7, T8, T9)=0
Abstract operator.
T m_functor
The functor.
Definition: callback.h:927
virtual bool IsEqual(Ptr< const CallbackImplBase > other) const
Equality test.
Definition: callback.h:910
virtual bool IsEqual(Ptr< const CallbackImplBase > other) const
Equality test.
Definition: callback.h:762
bool GetAccessor(T &value) const
Give value my callback, if type compatible.
Definition: callback.h:2116
void Nullify(void)
Discard the implementation, set it to null.
Definition: callback.h:1377
ns3::empty declaration, used by callbacks.
virtual std::string GetTypeid(void) const
Get the name of this object type.
Definition: callback.h:229
TypeTraits< TX2 >::ReferencedType m_a2
second bound argument
Definition: callback.h:1185
CallbackBase(Ptr< CallbackImplBase > impl)
Construct from a pimpl.
Definition: callback.h:1210
Ptr< CallbackImplBase > GetImpl(void) const
Definition: callback.h:1200
bool IsNull(void) const
Check for null implementation.
Definition: callback.h:1372
A template-based reference counting class.
static std::string Demangle(const std::string &mangled)
Definition: callback.cc:134
virtual std::string GetTypeid(void) const
Get the name of this object type.
Definition: callback.h:349
virtual std::string GetTypeid(void) const
Get the name of this object type.
Definition: callback.h:404
Ptr< CallbackImplBase > m_impl
the pimpl
Definition: callback.h:1212
void Set(CallbackBase base)
Definition: callback.cc:47
ns3::SimpleRefCount declaration and template implementation.
TypeTraits< TX2 >::ReferencedType m_a2
second bound argument
Definition: callback.h:1063
virtual std::string GetTypeid(void) const
Get the name of this object type.
Definition: callback.h:433
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:1082
R operator()(void)
Functor with varying numbers of arguments.
Definition: callback.h:1092