39 #ifndef CGU_CALLBACK_H
40 #define CGU_CALLBACK_H
454 #include <functional>
457 #include <type_traits>
556 template <
class... FreeArgs>
596 #ifdef CGU_USE_GLIB_MEMORY_SLICES_NO_COMPAT
617 template <
class... T>
619 return (f1.cb_s.get() == f2.cb_s.get());
627 template <
class... T>
643 template <
class... T>
645 return std::less<
const CallbackArg<T...>*>()(f1.cb_s.get(), f2.cb_s.get());
653 template <
class... T>
655 return (f1.cb_s.get() == f2.cb_s.get());
663 template <
class... T>
674 template <
class... T>
676 return std::less<
const CallbackArg<T...>*>()(f1.cb_s.get(), f2.cb_s.get());
685 #ifndef DOXYGEN_PARSING
690 template <
class... T>
691 struct hash<Cgu::Callback::FunctorArg<T...>> {
692 typedef std::size_t result_type;
694 result_type operator()(
const argument_type& f)
const {
701 template <
class... T>
702 struct hash<Cgu::Callback::SafeFunctorArg<T...>> {
703 typedef std::size_t result_type;
705 result_type operator()(
const argument_type& f)
const {
714 #endif // DOXYGEN_PARSING
769 template <
class... FreeArgs>
771 SharedPtr<
const CallbackArg<FreeArgs...>> cb_s;
794 if (cb_s.get()) cb_s->dispatch(args...);
885 template <
class... FreeArgs>
886 class SafeFunctorArg {
901 if (cb_s.get()) cb_s->dispatch(args...);
982 template <
class T,
class... FreeArgs>
991 (obj->*func)(free_args...);
996 template <
bool unref,
class T,
class BoundArg,
class... FreeArgs>
999 typedef void (T::*
MemFunc)(BoundArg, FreeArgs...);
1006 (obj->*func)(arg, free_args...);
1008 template <
class Arg>
1010 Arg&& arg_): obj(&obj_), func(func_), arg(std::forward<Arg>(arg_)) {}
1013 template <
bool unref,
class T,
class BoundArg1,
class BoundArg2,
class... FreeArgs>
1016 typedef void (T::*
MemFunc)(BoundArg1, BoundArg2, FreeArgs...);
1024 (obj->*func)(arg1, arg2, free_args...);
1026 template <
class Arg1,
class Arg2>
1029 Arg2&& arg2_): obj(&obj_), func(func_),
1030 arg1(std::forward<Arg1>(arg1_)),
1031 arg2(std::forward<Arg2>(arg2_)) {}
1034 template <
bool unref,
class T,
class BoundArg1,
class BoundArg2,
class BoundArg3,
class... FreeArgs>
1037 typedef void (T::*
MemFunc)(BoundArg1, BoundArg2, BoundArg3, FreeArgs...);
1046 (obj->*func)(arg1, arg2, arg3, free_args...);
1048 template <
class Arg1,
class Arg2,
class Arg3>
1053 obj(&obj_), func(func_),
1054 arg1(std::forward<Arg1>(arg1_)),
1055 arg2(std::forward<Arg2>(arg2_)),
1056 arg3(std::forward<Arg3>(arg3_)) {}
1059 template <
bool unref,
class T,
class BoundArg1,
class BoundArg2,
class BoundArg3,
1060 class BoundArg4,
class... FreeArgs>
1063 typedef void (T::*
MemFunc)(BoundArg1, BoundArg2, BoundArg3, BoundArg4, FreeArgs...);
1073 (obj->*func)(arg1, arg2, arg3, arg4, free_args...);
1075 template <
class Arg1,
class Arg2,
class Arg3,
class Arg4>
1081 obj(&obj_), func(func_),
1082 arg1(std::forward<Arg1>(arg1_)),
1083 arg2(std::forward<Arg2>(arg2_)),
1084 arg3(std::forward<Arg3>(arg3_)),
1085 arg4(std::forward<Arg4>(arg4_)) {}
1088 template <
bool unref,
class T,
class BoundArg1,
class BoundArg2,
class BoundArg3,
1089 class BoundArg4,
class BoundArg5,
class... FreeArgs>
1092 typedef void (T::*
MemFunc)(BoundArg1, BoundArg2, BoundArg3,
1093 BoundArg4, BoundArg5, FreeArgs...);
1104 (obj->*func)(arg1, arg2, arg3, arg4, arg5, free_args...);
1106 template <
class Arg1,
class Arg2,
class Arg3,
class Arg4,
class Arg5>
1113 obj(&obj_), func(func_),
1114 arg1(std::forward<Arg1>(arg1_)),
1115 arg2(std::forward<Arg2>(arg2_)),
1116 arg3(std::forward<Arg3>(arg3_)),
1117 arg4(std::forward<Arg4>(arg4_)),
1118 arg5(std::forward<Arg5>(arg5_)) {}
1123 template <
class T,
class... FreeArgs>
1132 (obj->*func)(free_args...);
1137 template <
bool unref,
class T,
class BoundArg,
class... FreeArgs>
1140 typedef void (T::*
MemFunc)(BoundArg, FreeArgs...)
const;
1147 (obj->*func)(arg, free_args...);
1149 template <
class Arg>
1151 Arg&& arg_): obj(&obj_), func(func_), arg(std::forward<Arg>(arg_)) {}
1154 template <
bool unref,
class T,
class BoundArg1,
class BoundArg2,
class... FreeArgs>
1157 typedef void (T::*
MemFunc)(BoundArg1, BoundArg2, FreeArgs...)
const;
1165 (obj->*func)(arg1, arg2, free_args...);
1167 template <
class Arg1,
class Arg2>
1170 Arg2&& arg2_): obj(&obj_), func(func_),
1171 arg1(std::forward<Arg1>(arg1_)),
1172 arg2(std::forward<Arg2>(arg2_)) {}
1175 template <
bool unref,
class T,
class BoundArg1,
class BoundArg2,
class BoundArg3,
class... FreeArgs>
1178 typedef void (T::*
MemFunc)(BoundArg1, BoundArg2, BoundArg3, FreeArgs...)
const;
1187 (obj->*func)(arg1, arg2, arg3, free_args...);
1189 template <
class Arg1,
class Arg2,
class Arg3>
1194 obj(&obj_), func(func_),
1195 arg1(std::forward<Arg1>(arg1_)),
1196 arg2(std::forward<Arg2>(arg2_)),
1197 arg3(std::forward<Arg3>(arg3_)) {}
1200 template <
bool unref,
class T,
class BoundArg1,
class BoundArg2,
class BoundArg3,
1201 class BoundArg4,
class... FreeArgs>
1204 typedef void (T::*
MemFunc)(BoundArg1, BoundArg2, BoundArg3, BoundArg4, FreeArgs...)
const;
1214 (obj->*func)(arg1, arg2, arg3, arg4, free_args...);
1216 template <
class Arg1,
class Arg2,
class Arg3,
class Arg4>
1222 obj(&obj_), func(func_),
1223 arg1(std::forward<Arg1>(arg1_)),
1224 arg2(std::forward<Arg2>(arg2_)),
1225 arg3(std::forward<Arg3>(arg3_)),
1226 arg4(std::forward<Arg4>(arg4_)) {}
1229 template <
bool unref,
class T,
class BoundArg1,
class BoundArg2,
class BoundArg3,
1230 class BoundArg4,
class BoundArg5,
class... FreeArgs>
1233 typedef void (T::*
MemFunc)(BoundArg1, BoundArg2, BoundArg3,
1234 BoundArg4, BoundArg5, FreeArgs...)
const;
1245 (obj->*func)(arg1, arg2, arg3, arg4, arg5, free_args...);
1247 template <
class Arg1,
class Arg2,
class Arg3,
class Arg4,
class Arg5>
1254 obj(&obj_), func(func_),
1255 arg1(std::forward<Arg1>(arg1_)),
1256 arg2(std::forward<Arg2>(arg2_)),
1257 arg3(std::forward<Arg3>(arg3_)),
1258 arg4(std::forward<Arg4>(arg4_)),
1259 arg5(std::forward<Arg5>(arg5_)) {}
1264 template <
class... FreeArgs>
1277 template <
bool unref,
class BoundArg,
class... FreeArgs>
1280 typedef void (*
Func)(BoundArg, FreeArgs...);
1286 func(arg, free_args...);
1288 template <
class Arg>
1292 template <
bool unref,
class BoundArg1,
class BoundArg2,
class... FreeArgs>
1295 typedef void (*
Func)(BoundArg1, BoundArg2, FreeArgs...);
1302 func(arg1, arg2, free_args...);
1304 template <
class Arg1,
class Arg2>
1306 Arg2&& arg2_): func(func_),
1307 arg1(std::forward<Arg1>(arg1_)),
1308 arg2(std::forward<Arg2>(arg2_)) {}
1311 template <
bool unref,
class BoundArg1,
class BoundArg2,
class BoundArg3,
class... FreeArgs>
1314 typedef void (*
Func)(BoundArg1, BoundArg2, BoundArg3, FreeArgs...);
1322 func(arg1, arg2, arg3, free_args...);
1324 template <
class Arg1,
class Arg2,
class Arg3>
1330 arg1(std::forward<Arg1>(arg1_)),
1331 arg2(std::forward<Arg2>(arg2_)),
1332 arg3(std::forward<Arg3>(arg3_)) {}
1335 template <
bool unref,
class BoundArg1,
class BoundArg2,
class BoundArg3,
1336 class BoundArg4,
class... FreeArgs>
1339 typedef void (*
Func)(BoundArg1, BoundArg2, BoundArg3, BoundArg4, FreeArgs...);
1348 func(arg1, arg2, arg3, arg4, free_args...);
1350 template <
class Arg1,
class Arg2,
class Arg3,
class Arg4>
1357 arg1(std::forward<Arg1>(arg1_)),
1358 arg2(std::forward<Arg2>(arg2_)),
1359 arg3(std::forward<Arg3>(arg3_)),
1360 arg4(std::forward<Arg4>(arg4_)) {}
1363 template <
bool unref,
class BoundArg1,
class BoundArg2,
class BoundArg3,
1364 class BoundArg4,
class BoundArg5,
class... FreeArgs>
1367 typedef void (*
Func)(BoundArg1, BoundArg2, BoundArg3,
1368 BoundArg4, BoundArg5, FreeArgs...);
1378 func(arg1, arg2, arg3, arg4, arg5, free_args...);
1380 template <
class Arg1,
class Arg2,
class Arg3,
class Arg4,
class Arg5>
1388 arg1(std::forward<Arg1>(arg1_)),
1389 arg2(std::forward<Arg2>(arg2_)),
1390 arg3(std::forward<Arg3>(arg3_)),
1391 arg4(std::forward<Arg4>(arg4_)),
1392 arg5(std::forward<Arg5>(arg5_)) {}
1396 template <
class Lambda,
class... FreeArgs>
1421 template <
class T,
class... FreeArgs>
1423 void (T::*func)(FreeArgs...)) {
1424 return new Callback0<T, FreeArgs...>{t, func};
1439 template <
class T,
class... FreeArgs>
1441 void (T::*func)(FreeArgs...)) {
1442 return new Callback0<T, FreeArgs...>{t, func};
1456 template <
class T,
class BoundArg,
class... FreeArgs>
1458 void (T::*func)(BoundArg, FreeArgs...),
1460 return new Callback1<
false, T, BoundArg, FreeArgs...>{t, func, arg};
1480 template <
class T,
class BoundArg,
class Arg,
class... FreeArgs>
1482 void (T::*func)(BoundArg, FreeArgs...),
1484 return new Callback1<
true, T, BoundArg, FreeArgs...>{t, func, std::forward<Arg>(arg)};
1498 template <
class T,
class BoundArg1,
class BoundArg2,
class... FreeArgs>
1500 void (T::*func)(BoundArg1, BoundArg2, FreeArgs...),
1503 return new Callback2<
false, T, BoundArg1, BoundArg2, FreeArgs...>{t, func, arg1, arg2};
1523 template <
class T,
class BoundArg1,
class BoundArg2,
1524 class Arg1,
class Arg2,
class... FreeArgs>
1526 void (T::*func)(BoundArg1, BoundArg2, FreeArgs...),
1529 return new Callback2<
true, T, BoundArg1, BoundArg2, FreeArgs...>{t, func,
1530 std::forward<Arg1>(arg1),
1531 std::forward<Arg2>(arg2)};
1545 template <
class T,
class BoundArg1,
class BoundArg2,
class BoundArg3,
class... FreeArgs>
1547 void (T::*func)(BoundArg1, BoundArg2, BoundArg3, FreeArgs...),
1551 return new Callback3<
false, T, BoundArg1, BoundArg2, BoundArg3, FreeArgs...>{t, func, arg1, arg2, arg3};
1571 template <
class T,
class BoundArg1,
class BoundArg2,
class BoundArg3,
1572 class Arg1,
class Arg2,
class Arg3,
class... FreeArgs>
1574 void (T::*func)(BoundArg1, BoundArg2, BoundArg3, FreeArgs...),
1578 return new Callback3<
true, T, BoundArg1, BoundArg2, BoundArg3, FreeArgs...>{t, func,
1579 std::forward<Arg1>(arg1),
1580 std::forward<Arg2>(arg2),
1581 std::forward<Arg3>(arg3)};
1595 template <
class T,
class BoundArg1,
class BoundArg2,
class BoundArg3,
1596 class BoundArg4,
class... FreeArgs>
1598 void (T::*func)(BoundArg1, BoundArg2, BoundArg3,
1599 BoundArg4, FreeArgs...),
1604 return new Callback4<
false, T, BoundArg1, BoundArg2, BoundArg3,
1605 BoundArg4, FreeArgs...>{t, func, arg1, arg2, arg3, arg4};
1625 template <
class T,
class BoundArg1,
class BoundArg2,
class BoundArg3,
class BoundArg4,
1626 class Arg1,
class Arg2,
class Arg3,
class Arg4,
class... FreeArgs>
1628 void (T::*func)(BoundArg1, BoundArg2, BoundArg3,
1629 BoundArg4, FreeArgs...),
1634 return new Callback4<
true, T, BoundArg1, BoundArg2, BoundArg3,
1635 BoundArg4, FreeArgs...>{t, func,
1636 std::forward<Arg1>(arg1),
1637 std::forward<Arg2>(arg2),
1638 std::forward<Arg3>(arg3),
1639 std::forward<Arg4>(arg4)};
1653 template <
class T,
class BoundArg1,
class BoundArg2,
class BoundArg3,
1654 class BoundArg4,
class BoundArg5,
class... FreeArgs>
1656 void (T::*func)(BoundArg1, BoundArg2, BoundArg3,
1657 BoundArg4, BoundArg5, FreeArgs...),
1663 return new Callback5<
false, T, BoundArg1, BoundArg2, BoundArg3,
1664 BoundArg4, BoundArg5, FreeArgs...>{t, func, arg1, arg2, arg3, arg4, arg5};
1684 template <
class T,
class BoundArg1,
class BoundArg2,
class BoundArg3,
class BoundArg4,
class BoundArg5,
1685 class Arg1,
class Arg2,
class Arg3,
class Arg4,
class Arg5,
class... FreeArgs>
1687 void (T::*func)(BoundArg1, BoundArg2, BoundArg3,
1688 BoundArg4, BoundArg5, FreeArgs...),
1694 return new Callback5<
true, T, BoundArg1, BoundArg2, BoundArg3,
1695 BoundArg4, BoundArg5, FreeArgs...>{t, func,
1696 std::forward<Arg1>(arg1),
1697 std::forward<Arg2>(arg2),
1698 std::forward<Arg3>(arg3),
1699 std::forward<Arg4>(arg4),
1700 std::forward<Arg5>(arg5)};
1714 template <
class T,
class... FreeArgs>
1716 void (T::*func)(FreeArgs...)
const) {
1732 template <
class T,
class... FreeArgs>
1734 void (T::*func)(FreeArgs...)
const) {
1749 template <
class T,
class BoundArg,
class... FreeArgs>
1751 void (T::*func)(BoundArg, FreeArgs...)
const,
1753 return new Callback1_const<
false, T, BoundArg, FreeArgs...>{t, func, arg};
1773 template <
class T,
class BoundArg,
class Arg,
class... FreeArgs>
1775 void (T::*func)(BoundArg, FreeArgs...)
const,
1777 return new Callback1_const<
true, T, BoundArg, FreeArgs...>{t, func, std::forward<Arg>(arg)};
1791 template <
class T,
class BoundArg1,
class BoundArg2,
class... FreeArgs>
1793 void (T::*func)(BoundArg1, BoundArg2, FreeArgs...)
const,
1796 return new Callback2_const<
false, T, BoundArg1, BoundArg2, FreeArgs...>{t, func, arg1, arg2};
1816 template <
class T,
class BoundArg1,
class BoundArg2,
1817 class Arg1,
class Arg2,
class... FreeArgs>
1819 void (T::*func)(BoundArg1, BoundArg2, FreeArgs...)
const,
1822 return new Callback2_const<
true, T, BoundArg1, BoundArg2, FreeArgs...>{t, func,
1823 std::forward<Arg1>(arg1),
1824 std::forward<Arg2>(arg2)};
1838 template <
class T,
class BoundArg1,
class BoundArg2,
class BoundArg3,
class... FreeArgs>
1840 void (T::*func)(BoundArg1, BoundArg2, BoundArg3, FreeArgs...)
const,
1844 return new Callback3_const<
false, T, BoundArg1, BoundArg2, BoundArg3, FreeArgs...>{t, func, arg1, arg2, arg3};
1864 template <
class T,
class BoundArg1,
class BoundArg2,
class BoundArg3,
1865 class Arg1,
class Arg2,
class Arg3,
class... FreeArgs>
1867 void (T::*func)(BoundArg1, BoundArg2, BoundArg3, FreeArgs...)
const,
1871 return new Callback3_const<
true, T, BoundArg1, BoundArg2, BoundArg3, FreeArgs...>{t, func,
1872 std::forward<Arg1>(arg1),
1873 std::forward<Arg2>(arg2),
1874 std::forward<Arg3>(arg3)};
1888 template <
class T,
class BoundArg1,
class BoundArg2,
class BoundArg3,
1889 class BoundArg4,
class... FreeArgs>
1891 void (T::*func)(BoundArg1, BoundArg2, BoundArg3,
1892 BoundArg4, FreeArgs...)
const,
1898 BoundArg4, FreeArgs...>{t, func, arg1, arg2, arg3, arg4};
1918 template <
class T,
class BoundArg1,
class BoundArg2,
class BoundArg3,
class BoundArg4,
1919 class Arg1,
class Arg2,
class Arg3,
class Arg4,
class... FreeArgs>
1921 void (T::*func)(BoundArg1, BoundArg2, BoundArg3,
1922 BoundArg4, FreeArgs...)
const,
1928 BoundArg4, FreeArgs...>{t, func,
1929 std::forward<Arg1>(arg1),
1930 std::forward<Arg2>(arg2),
1931 std::forward<Arg3>(arg3),
1932 std::forward<Arg4>(arg4)};
1946 template <
class T,
class BoundArg1,
class BoundArg2,
class BoundArg3,
1947 class BoundArg4,
class BoundArg5,
class... FreeArgs>
1949 void (T::*func)(BoundArg1, BoundArg2, BoundArg3,
1950 BoundArg4, BoundArg5, FreeArgs...)
const,
1957 BoundArg4, BoundArg5, FreeArgs...>{t, func, arg1, arg2, arg3, arg4, arg5};
1977 template <
class T,
class BoundArg1,
class BoundArg2,
class BoundArg3,
class BoundArg4,
class BoundArg5,
1978 class Arg1,
class Arg2,
class Arg3,
class Arg4,
class Arg5,
class... FreeArgs>
1980 void (T::*func)(BoundArg1, BoundArg2, BoundArg3,
1981 BoundArg4, BoundArg5, FreeArgs...)
const,
1988 BoundArg4, BoundArg5, FreeArgs...>{t, func,
1989 std::forward<Arg1>(arg1),
1990 std::forward<Arg2>(arg2),
1991 std::forward<Arg3>(arg3),
1992 std::forward<Arg4>(arg4),
1993 std::forward<Arg5>(arg5)};
2007 template <
class... FreeArgs>
2024 template <
class... FreeArgs>
2040 template <
class BoundArg,
class... FreeArgs>
2063 template <
class BoundArg,
class Arg,
class... FreeArgs>
2066 return new Callback1_static<
true, BoundArg, FreeArgs...>{func, std::forward<Arg>(arg)};
2080 template <
class BoundArg1,
class BoundArg2,
class... FreeArgs>
2084 return new Callback2_static<
false, BoundArg1, BoundArg2, FreeArgs...>{func, arg1, arg2};
2104 template <
class BoundArg1,
class BoundArg2,
class Arg1,
class Arg2,
class... FreeArgs>
2109 std::forward<Arg1>(arg1),
2110 std::forward<Arg2>(arg2)};
2124 template <
class BoundArg1,
class BoundArg2,
class BoundArg3,
class... FreeArgs>
2125 CallbackArg<FreeArgs...>*
make(
void (*func)(BoundArg1, BoundArg2, BoundArg3, FreeArgs...),
2129 return new Callback3_static<
false, BoundArg1, BoundArg2, BoundArg3, FreeArgs...>{func, arg1, arg2, arg3};
2149 template <
class BoundArg1,
class BoundArg2,
class BoundArg3,
2150 class Arg1,
class Arg2,
class Arg3,
class... FreeArgs>
2155 return new Callback3_static<
true, BoundArg1, BoundArg2, BoundArg3, FreeArgs...>{func,
2156 std::forward<Arg1>(arg1),
2157 std::forward<Arg2>(arg2),
2158 std::forward<Arg3>(arg3)};
2172 template <
class BoundArg1,
class BoundArg2,
class BoundArg3,
2173 class BoundArg4,
class... FreeArgs>
2175 BoundArg4, FreeArgs...),
2181 BoundArg4, FreeArgs...>{func, arg1, arg2, arg3, arg4};
2201 template <
class BoundArg1,
class BoundArg2,
class BoundArg3,
class BoundArg4,
2202 class Arg1,
class Arg2,
class Arg3,
class Arg4,
class... FreeArgs>
2204 BoundArg4, FreeArgs...),
2210 BoundArg4, FreeArgs...>{func,
2211 std::forward<Arg1>(arg1),
2212 std::forward<Arg2>(arg2),
2213 std::forward<Arg3>(arg3),
2214 std::forward<Arg4>(arg4)};
2228 template <
class BoundArg1,
class BoundArg2,
class BoundArg3,
2229 class BoundArg4,
class BoundArg5,
class... FreeArgs>
2231 BoundArg4, BoundArg5, FreeArgs...),
2238 BoundArg4, BoundArg5, FreeArgs...>{func, arg1, arg2, arg3, arg4, arg5};
2258 template <
class BoundArg1,
class BoundArg2,
class BoundArg3,
class BoundArg4,
class BoundArg5,
2259 class Arg1,
class Arg2,
class Arg3,
class Arg4,
class Arg5,
class... FreeArgs>
2261 BoundArg4, BoundArg5, FreeArgs...),
2268 BoundArg4, BoundArg5, FreeArgs...>{func,
2269 std::forward<Arg1>(arg1),
2270 std::forward<Arg2>(arg2),
2271 std::forward<Arg3>(arg3),
2272 std::forward<Arg4>(arg4),
2273 std::forward<Arg5>(arg5)};
2290 template <
class... FreeArgs>
2292 typedef std::function<void(FreeArgs...)> LType;
2310 template <
class... FreeArgs>
2312 typedef std::function<void(FreeArgs...)> LType;
2328 template <
class... FreeArgs>
2330 typedef std::function<void(FreeArgs...)> LType;
2348 template <
class... FreeArgs>
2350 typedef std::function<void(FreeArgs...)> LType;
2394 template <
class... FreeArgs,
class Lambda>
2396 typedef typename std::remove_const<typename std::remove_reference<Lambda>::type>::type LType;
2397 return new Callback_lambda<LType, FreeArgs...>{std::forward<Lambda>(l)};
2400 #ifndef DOXYGEN_PARSING
2406 template <
class T,
class... FreeArgs>
2408 void (T::*func)(FreeArgs...)) {
2409 return new Callback0<T, FreeArgs...>{t, func};
2411 template <
class T,
class BoundArg,
class... FreeArgs>
2413 void (T::*func)(BoundArg, FreeArgs...),
2414 const BoundArg& arg) {
2415 return new Callback1<
false, T, BoundArg, FreeArgs...>{t, func, arg};
2417 template <
class T,
class BoundArg1,
class BoundArg2,
class... FreeArgs>
2419 void (T::*func)(BoundArg1, BoundArg2, FreeArgs...),
2420 const BoundArg1& arg1,
2421 const BoundArg2& arg2) {
2422 return new Callback2<
false, T, BoundArg1, BoundArg2, FreeArgs...>{t, func, arg1, arg2};
2424 template <
class T,
class BoundArg1,
class BoundArg2,
class BoundArg3,
class... FreeArgs>
2426 void (T::*func)(BoundArg1, BoundArg2, BoundArg3, FreeArgs...),
2427 const BoundArg1& arg1,
2428 const BoundArg2& arg2,
2429 const BoundArg3& arg3) {
2430 return new Callback3<
false, T, BoundArg1, BoundArg2, BoundArg3, FreeArgs...>{t, func, arg1, arg2, arg3};
2432 template <
class T,
class BoundArg1,
class BoundArg2,
class BoundArg3,
2433 class BoundArg4,
class... FreeArgs>
2435 void (T::*func)(BoundArg1, BoundArg2, BoundArg3,
2436 BoundArg4, FreeArgs...),
2437 const BoundArg1& arg1,
2438 const BoundArg2& arg2,
2439 const BoundArg3& arg3,
2440 const BoundArg4& arg4) {
2441 return new Callback4<
false, T, BoundArg1, BoundArg2, BoundArg3,
2442 BoundArg4, FreeArgs...>{t, func, arg1, arg2, arg3, arg4};
2444 template <
class T,
class BoundArg1,
class BoundArg2,
class BoundArg3,
2445 class BoundArg4,
class BoundArg5,
class... FreeArgs>
2447 void (T::*func)(BoundArg1, BoundArg2, BoundArg3,
2448 BoundArg4, BoundArg5, FreeArgs...),
2449 const BoundArg1& arg1,
2450 const BoundArg2& arg2,
2451 const BoundArg3& arg3,
2452 const BoundArg4& arg4,
2453 const BoundArg5& arg5) {
2454 return new Callback5<
false, T, BoundArg1, BoundArg2, BoundArg3,
2455 BoundArg4, BoundArg5, FreeArgs...>{t, func, arg1, arg2, arg3, arg4, arg5};
2457 template <
class T,
class... FreeArgs>
2459 void (T::*func)(FreeArgs...)
const) {
2462 template <
class T,
class BoundArg,
class... FreeArgs>
2464 void (T::*func)(BoundArg, FreeArgs...)
const,
2465 const BoundArg& arg) {
2466 return new Callback1_const<
false, T, BoundArg, FreeArgs...>{t, func, arg};
2468 template <
class T,
class BoundArg1,
class BoundArg2,
class... FreeArgs>
2470 void (T::*func)(BoundArg1, BoundArg2, FreeArgs...)
const,
2471 const BoundArg1& arg1,
2472 const BoundArg2& arg2) {
2473 return new Callback2_const<
false, T, BoundArg1, BoundArg2, FreeArgs...>{t, func, arg1, arg2};
2475 template <
class T,
class BoundArg1,
class BoundArg2,
class BoundArg3,
class... FreeArgs>
2477 void (T::*func)(BoundArg1, BoundArg2, BoundArg3, FreeArgs...)
const,
2478 const BoundArg1& arg1,
2479 const BoundArg2& arg2,
2480 const BoundArg3& arg3) {
2481 return new Callback3_const<
false, T, BoundArg1, BoundArg2, BoundArg3, FreeArgs...>{t, func, arg1, arg2, arg3};
2483 template <
class T,
class BoundArg1,
class BoundArg2,
class BoundArg3,
2484 class BoundArg4,
class... FreeArgs>
2486 void (T::*func)(BoundArg1, BoundArg2, BoundArg3,
2487 BoundArg4, FreeArgs...)
const,
2488 const BoundArg1& arg1,
2489 const BoundArg2& arg2,
2490 const BoundArg3& arg3,
2491 const BoundArg4& arg4) {
2493 BoundArg4, FreeArgs...>{t, func, arg1, arg2, arg3, arg4};
2495 template <
class T,
class BoundArg1,
class BoundArg2,
class BoundArg3,
2496 class BoundArg4,
class BoundArg5,
class... FreeArgs>
2498 void (T::*func)(BoundArg1, BoundArg2, BoundArg3,
2499 BoundArg4, BoundArg5, FreeArgs...)
const,
2500 const BoundArg1& arg1,
2501 const BoundArg2& arg2,
2502 const BoundArg3& arg3,
2503 const BoundArg4& arg4,
2504 const BoundArg5& arg5) {
2506 BoundArg4, BoundArg5, FreeArgs...>{t, func, arg1, arg2, arg3, arg4, arg5};
2508 template <
class... FreeArgs>
2509 CallbackArg<FreeArgs...>* make_val(
void (*func)(FreeArgs...)) {
2512 template <
class BoundArg,
class... FreeArgs>
2513 CallbackArg<FreeArgs...>* make_val(
void (*func)(BoundArg, FreeArgs...),
2514 const BoundArg& arg) {
2517 template <
class BoundArg1,
class BoundArg2,
class... FreeArgs>
2518 CallbackArg<FreeArgs...>* make_val(
void (*func)(BoundArg1, BoundArg2, FreeArgs...),
2519 const BoundArg1& arg1,
2520 const BoundArg2& arg2) {
2521 return new Callback2_static<
false, BoundArg1, BoundArg2, FreeArgs...>{func, arg1, arg2};
2523 template <
class BoundArg1,
class BoundArg2,
class BoundArg3,
class... FreeArgs>
2524 CallbackArg<FreeArgs...>* make_val(
void (*func)(BoundArg1, BoundArg2, BoundArg3, FreeArgs...),
2525 const BoundArg1& arg1,
2526 const BoundArg2& arg2,
2527 const BoundArg3& arg3) {
2528 return new Callback3_static<
false, BoundArg1, BoundArg2, BoundArg3, FreeArgs...>{func, arg1, arg2, arg3};
2530 template <
class BoundArg1,
class BoundArg2,
class BoundArg3,
2531 class BoundArg4,
class... FreeArgs>
2532 CallbackArg<FreeArgs...>* make_val(
void (*func)(BoundArg1, BoundArg2, BoundArg3,
2533 BoundArg4, FreeArgs...),
2534 const BoundArg1& arg1,
2535 const BoundArg2& arg2,
2536 const BoundArg3& arg3,
2537 const BoundArg4& arg4) {
2539 BoundArg4, FreeArgs...>{func, arg1, arg2, arg3, arg4};
2541 template <
class BoundArg1,
class BoundArg2,
class BoundArg3,
2542 class BoundArg4,
class BoundArg5,
class... FreeArgs>
2543 CallbackArg<FreeArgs...>* make_val(
void (*func)(BoundArg1, BoundArg2, BoundArg3,
2544 BoundArg4, BoundArg5, FreeArgs...),
2545 const BoundArg1& arg1,
2546 const BoundArg2& arg2,
2547 const BoundArg3& arg3,
2548 const BoundArg4& arg4,
2549 const BoundArg5& arg5) {
2551 BoundArg4, BoundArg5, FreeArgs...>{func, arg1, arg2, arg3, arg4, arg5};
2553 template <
class... FreeArgs>
2554 CallbackArg<FreeArgs...>* make_val(
const std::function<
void(FreeArgs...)>& f) {
2555 typedef std::function<void(FreeArgs...)> LType;
2558 template <
class... FreeArgs>
2559 CallbackArg<FreeArgs...>* make_val(std::function<
void(FreeArgs...)>&& f) {
2560 typedef std::function<void(FreeArgs...)> LType;
2563 #endif // DOXYGEN_PARSING
2592 void post(
const Callback* cb, gint priority = G_PRIORITY_DEFAULT_IDLE,
2593 GMainContext* context = 0);
2641 gint priority = G_PRIORITY_DEFAULT_IDLE, GMainContext* context = 0);
2676 class =
typename std::enable_if<!std::is_convertible<typename std::remove_reference<F>::type,
2678 void post(F&& func, gint priority = G_PRIORITY_DEFAULT_IDLE,
2679 GMainContext* context = 0) {
2680 post(lambda<>(std::forward<F>(func)), priority, context);
2738 class =
typename std::enable_if<!std::is_convertible<typename std::remove_reference<F>::type,
2741 gint priority = G_PRIORITY_DEFAULT_IDLE, GMainContext* context = 0) {
2742 post(lambda<>(std::forward<F>(func)), r, priority, context);