henrike@webrtc.org | f048872 | 2014-05-13 18:00:26 +0000 | [diff] [blame] | 1 | // This file was GENERATED by command: |
| 2 | // pump.py bind.h.pump |
| 3 | // DO NOT EDIT BY HAND!!! |
| 4 | |
| 5 | /* |
| 6 | * Copyright 2012 The WebRTC Project Authors. All rights reserved. |
| 7 | * |
| 8 | * Use of this source code is governed by a BSD-style license |
| 9 | * that can be found in the LICENSE file in the root of the source |
| 10 | * tree. An additional intellectual property rights grant can be found |
| 11 | * in the file PATENTS. All contributing project authors may |
| 12 | * be found in the AUTHORS file in the root of the source tree. |
| 13 | */ |
| 14 | |
| 15 | // To generate bind.h from bind.h.pump, execute: |
| 16 | // /home/build/google3/third_party/gtest/scripts/pump.py bind.h.pump |
| 17 | |
| 18 | // Bind() is an overloaded function that converts method calls into function |
Magnus Jedvert | d3de9c5 | 2015-08-20 16:03:52 +0200 | [diff] [blame] | 19 | // objects (aka functors). The method object is captured as a scoped_refptr<> if |
| 20 | // possible, and as a raw pointer otherwise. Any arguments to the method are |
| 21 | // captured by value. The return value of Bind is a stateful, nullary function |
| 22 | // object. Care should be taken about the lifetime of objects captured by |
| 23 | // Bind(); the returned functor knows nothing about the lifetime of a non |
| 24 | // ref-counted method object or any arguments passed by pointer, and calling the |
| 25 | // functor with a destroyed object will surely do bad things. |
henrike@webrtc.org | f048872 | 2014-05-13 18:00:26 +0000 | [diff] [blame] | 26 | // |
| 27 | // Example usage: |
| 28 | // struct Foo { |
| 29 | // int Test1() { return 42; } |
| 30 | // int Test2() const { return 52; } |
| 31 | // int Test3(int x) { return x*x; } |
| 32 | // float Test4(int x, float y) { return x + y; } |
| 33 | // }; |
| 34 | // |
| 35 | // int main() { |
| 36 | // Foo foo; |
| 37 | // cout << rtc::Bind(&Foo::Test1, &foo)() << endl; |
| 38 | // cout << rtc::Bind(&Foo::Test2, &foo)() << endl; |
| 39 | // cout << rtc::Bind(&Foo::Test3, &foo, 3)() << endl; |
| 40 | // cout << rtc::Bind(&Foo::Test4, &foo, 7, 8.5f)() << endl; |
| 41 | // } |
Magnus Jedvert | d3de9c5 | 2015-08-20 16:03:52 +0200 | [diff] [blame] | 42 | // |
| 43 | // Example usage of ref counted objects: |
| 44 | // struct Bar { |
| 45 | // int AddRef(); |
| 46 | // int Release(); |
| 47 | // |
| 48 | // void Test() {} |
| 49 | // void BindThis() { |
| 50 | // // The functor passed to AsyncInvoke() will keep this object alive. |
Taylor Brandstetter | 5d97a9a | 2016-06-10 14:17:27 -0700 | [diff] [blame^] | 51 | // invoker.AsyncInvoke(RTC_FROM_HERE,rtc::Bind(&Bar::Test, this)); |
Magnus Jedvert | d3de9c5 | 2015-08-20 16:03:52 +0200 | [diff] [blame] | 52 | // } |
| 53 | // }; |
| 54 | // |
| 55 | // int main() { |
| 56 | // rtc::scoped_refptr<Bar> bar = new rtc::RefCountedObject<Bar>(); |
| 57 | // auto functor = rtc::Bind(&Bar::Test, bar); |
| 58 | // bar = nullptr; |
| 59 | // // The functor stores an internal scoped_refptr<Bar>, so this is safe. |
| 60 | // functor(); |
| 61 | // } |
| 62 | // |
henrike@webrtc.org | f048872 | 2014-05-13 18:00:26 +0000 | [diff] [blame] | 63 | |
| 64 | #ifndef WEBRTC_BASE_BIND_H_ |
| 65 | #define WEBRTC_BASE_BIND_H_ |
| 66 | |
Magnus Jedvert | d3de9c5 | 2015-08-20 16:03:52 +0200 | [diff] [blame] | 67 | #include "webrtc/base/scoped_ref_ptr.h" |
noahric | 5d9b92b | 2015-10-24 11:14:46 -0700 | [diff] [blame] | 68 | #include "webrtc/base/template_util.h" |
Magnus Jedvert | d3de9c5 | 2015-08-20 16:03:52 +0200 | [diff] [blame] | 69 | |
henrike@webrtc.org | f048872 | 2014-05-13 18:00:26 +0000 | [diff] [blame] | 70 | #define NONAME |
| 71 | |
| 72 | namespace rtc { |
| 73 | namespace detail { |
| 74 | // This is needed because the template parameters in Bind can't be resolved |
| 75 | // if they're used both as parameters of the function pointer type and as |
| 76 | // parameters to Bind itself: the function pointer parameters are exact |
| 77 | // matches to the function prototype, but the parameters to bind have |
| 78 | // references stripped. This trick allows the compiler to dictate the Bind |
| 79 | // parameter types rather than deduce them. |
| 80 | template <class T> struct identity { typedef T type; }; |
Magnus Jedvert | d3de9c5 | 2015-08-20 16:03:52 +0200 | [diff] [blame] | 81 | |
| 82 | // IsRefCounted<T>::value will be true for types that can be used in |
| 83 | // rtc::scoped_refptr<T>, i.e. types that implements nullary functions AddRef() |
| 84 | // and Release(), regardless of their return types. AddRef() and Release() can |
| 85 | // be defined in T or any superclass of T. |
| 86 | template <typename T> |
| 87 | class IsRefCounted { |
| 88 | // This is a complex implementation detail done with SFINAE. |
| 89 | |
| 90 | // Define types such that sizeof(Yes) != sizeof(No). |
| 91 | struct Yes { char dummy[1]; }; |
| 92 | struct No { char dummy[2]; }; |
| 93 | // Define two overloaded template functions with return types of different |
| 94 | // size. This way, we can use sizeof() on the return type to determine which |
| 95 | // function the compiler would have chosen. One function will be preferred |
| 96 | // over the other if it is possible to create it without compiler errors, |
| 97 | // otherwise the compiler will simply remove it, and default to the less |
| 98 | // preferred function. |
| 99 | template <typename R> |
| 100 | static Yes test(R* r, decltype(r->AddRef(), r->Release(), 42)); |
| 101 | template <typename C> static No test(...); |
| 102 | |
| 103 | public: |
| 104 | // Trick the compiler to tell if it's possible to call AddRef() and Release(). |
| 105 | static const bool value = sizeof(test<T>((T*)nullptr, 42)) == sizeof(Yes); |
| 106 | }; |
| 107 | |
| 108 | // TernaryTypeOperator is a helper class to select a type based on a static bool |
| 109 | // value. |
| 110 | template <bool condition, typename IfTrueT, typename IfFalseT> |
| 111 | struct TernaryTypeOperator {}; |
| 112 | |
| 113 | template <typename IfTrueT, typename IfFalseT> |
| 114 | struct TernaryTypeOperator<true, IfTrueT, IfFalseT> { |
| 115 | typedef IfTrueT type; |
| 116 | }; |
| 117 | |
| 118 | template <typename IfTrueT, typename IfFalseT> |
| 119 | struct TernaryTypeOperator<false, IfTrueT, IfFalseT> { |
| 120 | typedef IfFalseT type; |
| 121 | }; |
| 122 | |
| 123 | // PointerType<T>::type will be scoped_refptr<T> for ref counted types, and T* |
| 124 | // otherwise. |
| 125 | template <class T> |
| 126 | struct PointerType { |
| 127 | typedef typename TernaryTypeOperator<IsRefCounted<T>::value, |
| 128 | scoped_refptr<T>, |
| 129 | T*>::type type; |
| 130 | }; |
| 131 | |
henrike@webrtc.org | f048872 | 2014-05-13 18:00:26 +0000 | [diff] [blame] | 132 | } // namespace detail |
| 133 | |
| 134 | template <class ObjectT, class MethodT, class R> |
| 135 | class MethodFunctor0 { |
| 136 | public: |
| 137 | MethodFunctor0(MethodT method, ObjectT* object) |
| 138 | : method_(method), object_(object) {} |
| 139 | R operator()() const { |
| 140 | return (object_->*method_)(); } |
| 141 | private: |
| 142 | MethodT method_; |
Magnus Jedvert | d3de9c5 | 2015-08-20 16:03:52 +0200 | [diff] [blame] | 143 | typename detail::PointerType<ObjectT>::type object_; |
henrike@webrtc.org | f048872 | 2014-05-13 18:00:26 +0000 | [diff] [blame] | 144 | }; |
| 145 | |
| 146 | template <class FunctorT, class R> |
| 147 | class Functor0 { |
| 148 | public: |
| 149 | explicit Functor0(const FunctorT& functor) |
| 150 | : functor_(functor) {} |
| 151 | R operator()() const { |
| 152 | return functor_(); } |
| 153 | private: |
| 154 | FunctorT functor_; |
| 155 | }; |
| 156 | |
| 157 | |
| 158 | #define FP_T(x) R (ObjectT::*x)() |
| 159 | |
| 160 | template <class ObjectT, class R> |
| 161 | MethodFunctor0<ObjectT, FP_T(NONAME), R> |
| 162 | Bind(FP_T(method), ObjectT* object) { |
| 163 | return MethodFunctor0<ObjectT, FP_T(NONAME), R>( |
| 164 | method, object); |
| 165 | } |
| 166 | |
| 167 | #undef FP_T |
| 168 | #define FP_T(x) R (ObjectT::*x)() const |
| 169 | |
| 170 | template <class ObjectT, class R> |
| 171 | MethodFunctor0<const ObjectT, FP_T(NONAME), R> |
| 172 | Bind(FP_T(method), const ObjectT* object) { |
| 173 | return MethodFunctor0<const ObjectT, FP_T(NONAME), R>( |
| 174 | method, object); |
| 175 | } |
| 176 | |
| 177 | #undef FP_T |
Magnus Jedvert | d3de9c5 | 2015-08-20 16:03:52 +0200 | [diff] [blame] | 178 | #define FP_T(x) R (ObjectT::*x)() |
| 179 | |
| 180 | template <class ObjectT, class R> |
| 181 | MethodFunctor0<ObjectT, FP_T(NONAME), R> |
| 182 | Bind(FP_T(method), const scoped_refptr<ObjectT>& object) { |
| 183 | return MethodFunctor0<ObjectT, FP_T(NONAME), R>( |
| 184 | method, object.get()); |
| 185 | } |
| 186 | |
| 187 | #undef FP_T |
henrike@webrtc.org | f048872 | 2014-05-13 18:00:26 +0000 | [diff] [blame] | 188 | #define FP_T(x) R (*x)() |
| 189 | |
| 190 | template <class R> |
| 191 | Functor0<FP_T(NONAME), R> |
| 192 | Bind(FP_T(function)) { |
| 193 | return Functor0<FP_T(NONAME), R>( |
| 194 | function); |
| 195 | } |
| 196 | |
| 197 | #undef FP_T |
| 198 | |
| 199 | template <class ObjectT, class MethodT, class R, |
| 200 | class P1> |
| 201 | class MethodFunctor1 { |
| 202 | public: |
| 203 | MethodFunctor1(MethodT method, ObjectT* object, |
| 204 | P1 p1) |
| 205 | : method_(method), object_(object), |
| 206 | p1_(p1) {} |
| 207 | R operator()() const { |
| 208 | return (object_->*method_)(p1_); } |
| 209 | private: |
| 210 | MethodT method_; |
Magnus Jedvert | d3de9c5 | 2015-08-20 16:03:52 +0200 | [diff] [blame] | 211 | typename detail::PointerType<ObjectT>::type object_; |
noahric | 5d9b92b | 2015-10-24 11:14:46 -0700 | [diff] [blame] | 212 | typename rtc::remove_reference<P1>::type p1_; |
henrike@webrtc.org | f048872 | 2014-05-13 18:00:26 +0000 | [diff] [blame] | 213 | }; |
| 214 | |
| 215 | template <class FunctorT, class R, |
| 216 | class P1> |
| 217 | class Functor1 { |
| 218 | public: |
| 219 | Functor1(const FunctorT& functor, P1 p1) |
| 220 | : functor_(functor), |
| 221 | p1_(p1) {} |
| 222 | R operator()() const { |
| 223 | return functor_(p1_); } |
| 224 | private: |
| 225 | FunctorT functor_; |
noahric | 5d9b92b | 2015-10-24 11:14:46 -0700 | [diff] [blame] | 226 | typename rtc::remove_reference<P1>::type p1_; |
henrike@webrtc.org | f048872 | 2014-05-13 18:00:26 +0000 | [diff] [blame] | 227 | }; |
| 228 | |
| 229 | |
| 230 | #define FP_T(x) R (ObjectT::*x)(P1) |
| 231 | |
| 232 | template <class ObjectT, class R, |
| 233 | class P1> |
| 234 | MethodFunctor1<ObjectT, FP_T(NONAME), R, P1> |
| 235 | Bind(FP_T(method), ObjectT* object, |
| 236 | typename detail::identity<P1>::type p1) { |
| 237 | return MethodFunctor1<ObjectT, FP_T(NONAME), R, P1>( |
| 238 | method, object, p1); |
| 239 | } |
| 240 | |
| 241 | #undef FP_T |
| 242 | #define FP_T(x) R (ObjectT::*x)(P1) const |
| 243 | |
| 244 | template <class ObjectT, class R, |
| 245 | class P1> |
| 246 | MethodFunctor1<const ObjectT, FP_T(NONAME), R, P1> |
| 247 | Bind(FP_T(method), const ObjectT* object, |
| 248 | typename detail::identity<P1>::type p1) { |
| 249 | return MethodFunctor1<const ObjectT, FP_T(NONAME), R, P1>( |
| 250 | method, object, p1); |
| 251 | } |
| 252 | |
| 253 | #undef FP_T |
Magnus Jedvert | d3de9c5 | 2015-08-20 16:03:52 +0200 | [diff] [blame] | 254 | #define FP_T(x) R (ObjectT::*x)(P1) |
| 255 | |
| 256 | template <class ObjectT, class R, |
| 257 | class P1> |
| 258 | MethodFunctor1<ObjectT, FP_T(NONAME), R, P1> |
| 259 | Bind(FP_T(method), const scoped_refptr<ObjectT>& object, |
| 260 | typename detail::identity<P1>::type p1) { |
| 261 | return MethodFunctor1<ObjectT, FP_T(NONAME), R, P1>( |
| 262 | method, object.get(), p1); |
| 263 | } |
| 264 | |
| 265 | #undef FP_T |
henrike@webrtc.org | f048872 | 2014-05-13 18:00:26 +0000 | [diff] [blame] | 266 | #define FP_T(x) R (*x)(P1) |
| 267 | |
| 268 | template <class R, |
| 269 | class P1> |
| 270 | Functor1<FP_T(NONAME), R, P1> |
| 271 | Bind(FP_T(function), |
| 272 | typename detail::identity<P1>::type p1) { |
| 273 | return Functor1<FP_T(NONAME), R, P1>( |
| 274 | function, p1); |
| 275 | } |
| 276 | |
| 277 | #undef FP_T |
| 278 | |
| 279 | template <class ObjectT, class MethodT, class R, |
| 280 | class P1, |
| 281 | class P2> |
| 282 | class MethodFunctor2 { |
| 283 | public: |
| 284 | MethodFunctor2(MethodT method, ObjectT* object, |
| 285 | P1 p1, |
| 286 | P2 p2) |
| 287 | : method_(method), object_(object), |
| 288 | p1_(p1), |
| 289 | p2_(p2) {} |
| 290 | R operator()() const { |
| 291 | return (object_->*method_)(p1_, p2_); } |
| 292 | private: |
| 293 | MethodT method_; |
Magnus Jedvert | d3de9c5 | 2015-08-20 16:03:52 +0200 | [diff] [blame] | 294 | typename detail::PointerType<ObjectT>::type object_; |
noahric | 5d9b92b | 2015-10-24 11:14:46 -0700 | [diff] [blame] | 295 | typename rtc::remove_reference<P1>::type p1_; |
| 296 | typename rtc::remove_reference<P2>::type p2_; |
henrike@webrtc.org | f048872 | 2014-05-13 18:00:26 +0000 | [diff] [blame] | 297 | }; |
| 298 | |
| 299 | template <class FunctorT, class R, |
| 300 | class P1, |
| 301 | class P2> |
| 302 | class Functor2 { |
| 303 | public: |
| 304 | Functor2(const FunctorT& functor, P1 p1, P2 p2) |
| 305 | : functor_(functor), |
| 306 | p1_(p1), |
| 307 | p2_(p2) {} |
| 308 | R operator()() const { |
| 309 | return functor_(p1_, p2_); } |
| 310 | private: |
| 311 | FunctorT functor_; |
noahric | 5d9b92b | 2015-10-24 11:14:46 -0700 | [diff] [blame] | 312 | typename rtc::remove_reference<P1>::type p1_; |
| 313 | typename rtc::remove_reference<P2>::type p2_; |
henrike@webrtc.org | f048872 | 2014-05-13 18:00:26 +0000 | [diff] [blame] | 314 | }; |
| 315 | |
| 316 | |
| 317 | #define FP_T(x) R (ObjectT::*x)(P1, P2) |
| 318 | |
| 319 | template <class ObjectT, class R, |
| 320 | class P1, |
| 321 | class P2> |
| 322 | MethodFunctor2<ObjectT, FP_T(NONAME), R, P1, P2> |
| 323 | Bind(FP_T(method), ObjectT* object, |
| 324 | typename detail::identity<P1>::type p1, |
| 325 | typename detail::identity<P2>::type p2) { |
| 326 | return MethodFunctor2<ObjectT, FP_T(NONAME), R, P1, P2>( |
| 327 | method, object, p1, p2); |
| 328 | } |
| 329 | |
| 330 | #undef FP_T |
| 331 | #define FP_T(x) R (ObjectT::*x)(P1, P2) const |
| 332 | |
| 333 | template <class ObjectT, class R, |
| 334 | class P1, |
| 335 | class P2> |
| 336 | MethodFunctor2<const ObjectT, FP_T(NONAME), R, P1, P2> |
| 337 | Bind(FP_T(method), const ObjectT* object, |
| 338 | typename detail::identity<P1>::type p1, |
| 339 | typename detail::identity<P2>::type p2) { |
| 340 | return MethodFunctor2<const ObjectT, FP_T(NONAME), R, P1, P2>( |
| 341 | method, object, p1, p2); |
| 342 | } |
| 343 | |
| 344 | #undef FP_T |
Magnus Jedvert | d3de9c5 | 2015-08-20 16:03:52 +0200 | [diff] [blame] | 345 | #define FP_T(x) R (ObjectT::*x)(P1, P2) |
| 346 | |
| 347 | template <class ObjectT, class R, |
| 348 | class P1, |
| 349 | class P2> |
| 350 | MethodFunctor2<ObjectT, FP_T(NONAME), R, P1, P2> |
| 351 | Bind(FP_T(method), const scoped_refptr<ObjectT>& object, |
| 352 | typename detail::identity<P1>::type p1, |
| 353 | typename detail::identity<P2>::type p2) { |
| 354 | return MethodFunctor2<ObjectT, FP_T(NONAME), R, P1, P2>( |
| 355 | method, object.get(), p1, p2); |
| 356 | } |
| 357 | |
| 358 | #undef FP_T |
henrike@webrtc.org | f048872 | 2014-05-13 18:00:26 +0000 | [diff] [blame] | 359 | #define FP_T(x) R (*x)(P1, P2) |
| 360 | |
| 361 | template <class R, |
| 362 | class P1, |
| 363 | class P2> |
| 364 | Functor2<FP_T(NONAME), R, P1, P2> |
| 365 | Bind(FP_T(function), |
| 366 | typename detail::identity<P1>::type p1, |
| 367 | typename detail::identity<P2>::type p2) { |
| 368 | return Functor2<FP_T(NONAME), R, P1, P2>( |
| 369 | function, p1, p2); |
| 370 | } |
| 371 | |
| 372 | #undef FP_T |
| 373 | |
| 374 | template <class ObjectT, class MethodT, class R, |
| 375 | class P1, |
| 376 | class P2, |
| 377 | class P3> |
| 378 | class MethodFunctor3 { |
| 379 | public: |
| 380 | MethodFunctor3(MethodT method, ObjectT* object, |
| 381 | P1 p1, |
| 382 | P2 p2, |
| 383 | P3 p3) |
| 384 | : method_(method), object_(object), |
| 385 | p1_(p1), |
| 386 | p2_(p2), |
| 387 | p3_(p3) {} |
| 388 | R operator()() const { |
| 389 | return (object_->*method_)(p1_, p2_, p3_); } |
| 390 | private: |
| 391 | MethodT method_; |
Magnus Jedvert | d3de9c5 | 2015-08-20 16:03:52 +0200 | [diff] [blame] | 392 | typename detail::PointerType<ObjectT>::type object_; |
noahric | 5d9b92b | 2015-10-24 11:14:46 -0700 | [diff] [blame] | 393 | typename rtc::remove_reference<P1>::type p1_; |
| 394 | typename rtc::remove_reference<P2>::type p2_; |
| 395 | typename rtc::remove_reference<P3>::type p3_; |
henrike@webrtc.org | f048872 | 2014-05-13 18:00:26 +0000 | [diff] [blame] | 396 | }; |
| 397 | |
| 398 | template <class FunctorT, class R, |
| 399 | class P1, |
| 400 | class P2, |
| 401 | class P3> |
| 402 | class Functor3 { |
| 403 | public: |
| 404 | Functor3(const FunctorT& functor, P1 p1, P2 p2, P3 p3) |
| 405 | : functor_(functor), |
| 406 | p1_(p1), |
| 407 | p2_(p2), |
| 408 | p3_(p3) {} |
| 409 | R operator()() const { |
| 410 | return functor_(p1_, p2_, p3_); } |
| 411 | private: |
| 412 | FunctorT functor_; |
noahric | 5d9b92b | 2015-10-24 11:14:46 -0700 | [diff] [blame] | 413 | typename rtc::remove_reference<P1>::type p1_; |
| 414 | typename rtc::remove_reference<P2>::type p2_; |
| 415 | typename rtc::remove_reference<P3>::type p3_; |
henrike@webrtc.org | f048872 | 2014-05-13 18:00:26 +0000 | [diff] [blame] | 416 | }; |
| 417 | |
| 418 | |
| 419 | #define FP_T(x) R (ObjectT::*x)(P1, P2, P3) |
| 420 | |
| 421 | template <class ObjectT, class R, |
| 422 | class P1, |
| 423 | class P2, |
| 424 | class P3> |
| 425 | MethodFunctor3<ObjectT, FP_T(NONAME), R, P1, P2, P3> |
| 426 | Bind(FP_T(method), ObjectT* object, |
| 427 | typename detail::identity<P1>::type p1, |
| 428 | typename detail::identity<P2>::type p2, |
| 429 | typename detail::identity<P3>::type p3) { |
| 430 | return MethodFunctor3<ObjectT, FP_T(NONAME), R, P1, P2, P3>( |
| 431 | method, object, p1, p2, p3); |
| 432 | } |
| 433 | |
| 434 | #undef FP_T |
| 435 | #define FP_T(x) R (ObjectT::*x)(P1, P2, P3) const |
| 436 | |
| 437 | template <class ObjectT, class R, |
| 438 | class P1, |
| 439 | class P2, |
| 440 | class P3> |
| 441 | MethodFunctor3<const ObjectT, FP_T(NONAME), R, P1, P2, P3> |
| 442 | Bind(FP_T(method), const ObjectT* object, |
| 443 | typename detail::identity<P1>::type p1, |
| 444 | typename detail::identity<P2>::type p2, |
| 445 | typename detail::identity<P3>::type p3) { |
| 446 | return MethodFunctor3<const ObjectT, FP_T(NONAME), R, P1, P2, P3>( |
| 447 | method, object, p1, p2, p3); |
| 448 | } |
| 449 | |
| 450 | #undef FP_T |
Magnus Jedvert | d3de9c5 | 2015-08-20 16:03:52 +0200 | [diff] [blame] | 451 | #define FP_T(x) R (ObjectT::*x)(P1, P2, P3) |
| 452 | |
| 453 | template <class ObjectT, class R, |
| 454 | class P1, |
| 455 | class P2, |
| 456 | class P3> |
| 457 | MethodFunctor3<ObjectT, FP_T(NONAME), R, P1, P2, P3> |
| 458 | Bind(FP_T(method), const scoped_refptr<ObjectT>& object, |
| 459 | typename detail::identity<P1>::type p1, |
| 460 | typename detail::identity<P2>::type p2, |
| 461 | typename detail::identity<P3>::type p3) { |
| 462 | return MethodFunctor3<ObjectT, FP_T(NONAME), R, P1, P2, P3>( |
| 463 | method, object.get(), p1, p2, p3); |
| 464 | } |
| 465 | |
| 466 | #undef FP_T |
henrike@webrtc.org | f048872 | 2014-05-13 18:00:26 +0000 | [diff] [blame] | 467 | #define FP_T(x) R (*x)(P1, P2, P3) |
| 468 | |
| 469 | template <class R, |
| 470 | class P1, |
| 471 | class P2, |
| 472 | class P3> |
| 473 | Functor3<FP_T(NONAME), R, P1, P2, P3> |
| 474 | Bind(FP_T(function), |
| 475 | typename detail::identity<P1>::type p1, |
| 476 | typename detail::identity<P2>::type p2, |
| 477 | typename detail::identity<P3>::type p3) { |
| 478 | return Functor3<FP_T(NONAME), R, P1, P2, P3>( |
| 479 | function, p1, p2, p3); |
| 480 | } |
| 481 | |
| 482 | #undef FP_T |
| 483 | |
| 484 | template <class ObjectT, class MethodT, class R, |
| 485 | class P1, |
| 486 | class P2, |
| 487 | class P3, |
| 488 | class P4> |
| 489 | class MethodFunctor4 { |
| 490 | public: |
| 491 | MethodFunctor4(MethodT method, ObjectT* object, |
| 492 | P1 p1, |
| 493 | P2 p2, |
| 494 | P3 p3, |
| 495 | P4 p4) |
| 496 | : method_(method), object_(object), |
| 497 | p1_(p1), |
| 498 | p2_(p2), |
| 499 | p3_(p3), |
| 500 | p4_(p4) {} |
| 501 | R operator()() const { |
| 502 | return (object_->*method_)(p1_, p2_, p3_, p4_); } |
| 503 | private: |
| 504 | MethodT method_; |
Magnus Jedvert | d3de9c5 | 2015-08-20 16:03:52 +0200 | [diff] [blame] | 505 | typename detail::PointerType<ObjectT>::type object_; |
noahric | 5d9b92b | 2015-10-24 11:14:46 -0700 | [diff] [blame] | 506 | typename rtc::remove_reference<P1>::type p1_; |
| 507 | typename rtc::remove_reference<P2>::type p2_; |
| 508 | typename rtc::remove_reference<P3>::type p3_; |
| 509 | typename rtc::remove_reference<P4>::type p4_; |
henrike@webrtc.org | f048872 | 2014-05-13 18:00:26 +0000 | [diff] [blame] | 510 | }; |
| 511 | |
| 512 | template <class FunctorT, class R, |
| 513 | class P1, |
| 514 | class P2, |
| 515 | class P3, |
| 516 | class P4> |
| 517 | class Functor4 { |
| 518 | public: |
| 519 | Functor4(const FunctorT& functor, P1 p1, P2 p2, P3 p3, P4 p4) |
| 520 | : functor_(functor), |
| 521 | p1_(p1), |
| 522 | p2_(p2), |
| 523 | p3_(p3), |
| 524 | p4_(p4) {} |
| 525 | R operator()() const { |
| 526 | return functor_(p1_, p2_, p3_, p4_); } |
| 527 | private: |
| 528 | FunctorT functor_; |
noahric | 5d9b92b | 2015-10-24 11:14:46 -0700 | [diff] [blame] | 529 | typename rtc::remove_reference<P1>::type p1_; |
| 530 | typename rtc::remove_reference<P2>::type p2_; |
| 531 | typename rtc::remove_reference<P3>::type p3_; |
| 532 | typename rtc::remove_reference<P4>::type p4_; |
henrike@webrtc.org | f048872 | 2014-05-13 18:00:26 +0000 | [diff] [blame] | 533 | }; |
| 534 | |
| 535 | |
| 536 | #define FP_T(x) R (ObjectT::*x)(P1, P2, P3, P4) |
| 537 | |
| 538 | template <class ObjectT, class R, |
| 539 | class P1, |
| 540 | class P2, |
| 541 | class P3, |
| 542 | class P4> |
| 543 | MethodFunctor4<ObjectT, FP_T(NONAME), R, P1, P2, P3, P4> |
| 544 | Bind(FP_T(method), ObjectT* object, |
| 545 | typename detail::identity<P1>::type p1, |
| 546 | typename detail::identity<P2>::type p2, |
| 547 | typename detail::identity<P3>::type p3, |
| 548 | typename detail::identity<P4>::type p4) { |
| 549 | return MethodFunctor4<ObjectT, FP_T(NONAME), R, P1, P2, P3, P4>( |
| 550 | method, object, p1, p2, p3, p4); |
| 551 | } |
| 552 | |
| 553 | #undef FP_T |
| 554 | #define FP_T(x) R (ObjectT::*x)(P1, P2, P3, P4) const |
| 555 | |
| 556 | template <class ObjectT, class R, |
| 557 | class P1, |
| 558 | class P2, |
| 559 | class P3, |
| 560 | class P4> |
| 561 | MethodFunctor4<const ObjectT, FP_T(NONAME), R, P1, P2, P3, P4> |
| 562 | Bind(FP_T(method), const ObjectT* object, |
| 563 | typename detail::identity<P1>::type p1, |
| 564 | typename detail::identity<P2>::type p2, |
| 565 | typename detail::identity<P3>::type p3, |
| 566 | typename detail::identity<P4>::type p4) { |
| 567 | return MethodFunctor4<const ObjectT, FP_T(NONAME), R, P1, P2, P3, P4>( |
| 568 | method, object, p1, p2, p3, p4); |
| 569 | } |
| 570 | |
| 571 | #undef FP_T |
Magnus Jedvert | d3de9c5 | 2015-08-20 16:03:52 +0200 | [diff] [blame] | 572 | #define FP_T(x) R (ObjectT::*x)(P1, P2, P3, P4) |
| 573 | |
| 574 | template <class ObjectT, class R, |
| 575 | class P1, |
| 576 | class P2, |
| 577 | class P3, |
| 578 | class P4> |
| 579 | MethodFunctor4<ObjectT, FP_T(NONAME), R, P1, P2, P3, P4> |
| 580 | Bind(FP_T(method), const scoped_refptr<ObjectT>& object, |
| 581 | typename detail::identity<P1>::type p1, |
| 582 | typename detail::identity<P2>::type p2, |
| 583 | typename detail::identity<P3>::type p3, |
| 584 | typename detail::identity<P4>::type p4) { |
| 585 | return MethodFunctor4<ObjectT, FP_T(NONAME), R, P1, P2, P3, P4>( |
| 586 | method, object.get(), p1, p2, p3, p4); |
| 587 | } |
| 588 | |
| 589 | #undef FP_T |
henrike@webrtc.org | f048872 | 2014-05-13 18:00:26 +0000 | [diff] [blame] | 590 | #define FP_T(x) R (*x)(P1, P2, P3, P4) |
| 591 | |
| 592 | template <class R, |
| 593 | class P1, |
| 594 | class P2, |
| 595 | class P3, |
| 596 | class P4> |
| 597 | Functor4<FP_T(NONAME), R, P1, P2, P3, P4> |
| 598 | Bind(FP_T(function), |
| 599 | typename detail::identity<P1>::type p1, |
| 600 | typename detail::identity<P2>::type p2, |
| 601 | typename detail::identity<P3>::type p3, |
| 602 | typename detail::identity<P4>::type p4) { |
| 603 | return Functor4<FP_T(NONAME), R, P1, P2, P3, P4>( |
| 604 | function, p1, p2, p3, p4); |
| 605 | } |
| 606 | |
| 607 | #undef FP_T |
| 608 | |
| 609 | template <class ObjectT, class MethodT, class R, |
| 610 | class P1, |
| 611 | class P2, |
| 612 | class P3, |
| 613 | class P4, |
| 614 | class P5> |
| 615 | class MethodFunctor5 { |
| 616 | public: |
| 617 | MethodFunctor5(MethodT method, ObjectT* object, |
| 618 | P1 p1, |
| 619 | P2 p2, |
| 620 | P3 p3, |
| 621 | P4 p4, |
| 622 | P5 p5) |
| 623 | : method_(method), object_(object), |
| 624 | p1_(p1), |
| 625 | p2_(p2), |
| 626 | p3_(p3), |
| 627 | p4_(p4), |
| 628 | p5_(p5) {} |
| 629 | R operator()() const { |
| 630 | return (object_->*method_)(p1_, p2_, p3_, p4_, p5_); } |
| 631 | private: |
| 632 | MethodT method_; |
Magnus Jedvert | d3de9c5 | 2015-08-20 16:03:52 +0200 | [diff] [blame] | 633 | typename detail::PointerType<ObjectT>::type object_; |
noahric | 5d9b92b | 2015-10-24 11:14:46 -0700 | [diff] [blame] | 634 | typename rtc::remove_reference<P1>::type p1_; |
| 635 | typename rtc::remove_reference<P2>::type p2_; |
| 636 | typename rtc::remove_reference<P3>::type p3_; |
| 637 | typename rtc::remove_reference<P4>::type p4_; |
| 638 | typename rtc::remove_reference<P5>::type p5_; |
henrike@webrtc.org | f048872 | 2014-05-13 18:00:26 +0000 | [diff] [blame] | 639 | }; |
| 640 | |
| 641 | template <class FunctorT, class R, |
| 642 | class P1, |
| 643 | class P2, |
| 644 | class P3, |
| 645 | class P4, |
| 646 | class P5> |
| 647 | class Functor5 { |
| 648 | public: |
| 649 | Functor5(const FunctorT& functor, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) |
| 650 | : functor_(functor), |
| 651 | p1_(p1), |
| 652 | p2_(p2), |
| 653 | p3_(p3), |
| 654 | p4_(p4), |
| 655 | p5_(p5) {} |
| 656 | R operator()() const { |
| 657 | return functor_(p1_, p2_, p3_, p4_, p5_); } |
| 658 | private: |
| 659 | FunctorT functor_; |
noahric | 5d9b92b | 2015-10-24 11:14:46 -0700 | [diff] [blame] | 660 | typename rtc::remove_reference<P1>::type p1_; |
| 661 | typename rtc::remove_reference<P2>::type p2_; |
| 662 | typename rtc::remove_reference<P3>::type p3_; |
| 663 | typename rtc::remove_reference<P4>::type p4_; |
| 664 | typename rtc::remove_reference<P5>::type p5_; |
henrike@webrtc.org | f048872 | 2014-05-13 18:00:26 +0000 | [diff] [blame] | 665 | }; |
| 666 | |
| 667 | |
| 668 | #define FP_T(x) R (ObjectT::*x)(P1, P2, P3, P4, P5) |
| 669 | |
| 670 | template <class ObjectT, class R, |
| 671 | class P1, |
| 672 | class P2, |
| 673 | class P3, |
| 674 | class P4, |
| 675 | class P5> |
| 676 | MethodFunctor5<ObjectT, FP_T(NONAME), R, P1, P2, P3, P4, P5> |
| 677 | Bind(FP_T(method), ObjectT* object, |
| 678 | typename detail::identity<P1>::type p1, |
| 679 | typename detail::identity<P2>::type p2, |
| 680 | typename detail::identity<P3>::type p3, |
| 681 | typename detail::identity<P4>::type p4, |
| 682 | typename detail::identity<P5>::type p5) { |
| 683 | return MethodFunctor5<ObjectT, FP_T(NONAME), R, P1, P2, P3, P4, P5>( |
| 684 | method, object, p1, p2, p3, p4, p5); |
| 685 | } |
| 686 | |
| 687 | #undef FP_T |
| 688 | #define FP_T(x) R (ObjectT::*x)(P1, P2, P3, P4, P5) const |
| 689 | |
| 690 | template <class ObjectT, class R, |
| 691 | class P1, |
| 692 | class P2, |
| 693 | class P3, |
| 694 | class P4, |
| 695 | class P5> |
| 696 | MethodFunctor5<const ObjectT, FP_T(NONAME), R, P1, P2, P3, P4, P5> |
| 697 | Bind(FP_T(method), const ObjectT* object, |
| 698 | typename detail::identity<P1>::type p1, |
| 699 | typename detail::identity<P2>::type p2, |
| 700 | typename detail::identity<P3>::type p3, |
| 701 | typename detail::identity<P4>::type p4, |
| 702 | typename detail::identity<P5>::type p5) { |
| 703 | return MethodFunctor5<const ObjectT, FP_T(NONAME), R, P1, P2, P3, P4, P5>( |
| 704 | method, object, p1, p2, p3, p4, p5); |
| 705 | } |
| 706 | |
| 707 | #undef FP_T |
Magnus Jedvert | d3de9c5 | 2015-08-20 16:03:52 +0200 | [diff] [blame] | 708 | #define FP_T(x) R (ObjectT::*x)(P1, P2, P3, P4, P5) |
| 709 | |
| 710 | template <class ObjectT, class R, |
| 711 | class P1, |
| 712 | class P2, |
| 713 | class P3, |
| 714 | class P4, |
| 715 | class P5> |
| 716 | MethodFunctor5<ObjectT, FP_T(NONAME), R, P1, P2, P3, P4, P5> |
| 717 | Bind(FP_T(method), const scoped_refptr<ObjectT>& object, |
| 718 | typename detail::identity<P1>::type p1, |
| 719 | typename detail::identity<P2>::type p2, |
| 720 | typename detail::identity<P3>::type p3, |
| 721 | typename detail::identity<P4>::type p4, |
| 722 | typename detail::identity<P5>::type p5) { |
| 723 | return MethodFunctor5<ObjectT, FP_T(NONAME), R, P1, P2, P3, P4, P5>( |
| 724 | method, object.get(), p1, p2, p3, p4, p5); |
| 725 | } |
| 726 | |
| 727 | #undef FP_T |
henrike@webrtc.org | f048872 | 2014-05-13 18:00:26 +0000 | [diff] [blame] | 728 | #define FP_T(x) R (*x)(P1, P2, P3, P4, P5) |
| 729 | |
| 730 | template <class R, |
| 731 | class P1, |
| 732 | class P2, |
| 733 | class P3, |
| 734 | class P4, |
| 735 | class P5> |
| 736 | Functor5<FP_T(NONAME), R, P1, P2, P3, P4, P5> |
| 737 | Bind(FP_T(function), |
| 738 | typename detail::identity<P1>::type p1, |
| 739 | typename detail::identity<P2>::type p2, |
| 740 | typename detail::identity<P3>::type p3, |
| 741 | typename detail::identity<P4>::type p4, |
| 742 | typename detail::identity<P5>::type p5) { |
| 743 | return Functor5<FP_T(NONAME), R, P1, P2, P3, P4, P5>( |
| 744 | function, p1, p2, p3, p4, p5); |
| 745 | } |
| 746 | |
| 747 | #undef FP_T |
Fredrik Solenberg | c937139 | 2015-08-06 12:40:53 +0200 | [diff] [blame] | 748 | |
| 749 | template <class ObjectT, class MethodT, class R, |
Jelena Marusic | 5d6e58e | 2015-07-13 11:16:39 +0200 | [diff] [blame] | 750 | class P1, |
| 751 | class P2, |
| 752 | class P3, |
| 753 | class P4, |
| 754 | class P5, |
| 755 | class P6> |
| 756 | class MethodFunctor6 { |
| 757 | public: |
Fredrik Solenberg | c937139 | 2015-08-06 12:40:53 +0200 | [diff] [blame] | 758 | MethodFunctor6(MethodT method, ObjectT* object, |
Jelena Marusic | 5d6e58e | 2015-07-13 11:16:39 +0200 | [diff] [blame] | 759 | P1 p1, |
| 760 | P2 p2, |
| 761 | P3 p3, |
| 762 | P4 p4, |
| 763 | P5 p5, |
| 764 | P6 p6) |
Fredrik Solenberg | c937139 | 2015-08-06 12:40:53 +0200 | [diff] [blame] | 765 | : method_(method), object_(object), |
| 766 | p1_(p1), |
| 767 | p2_(p2), |
| 768 | p3_(p3), |
| 769 | p4_(p4), |
| 770 | p5_(p5), |
| 771 | p6_(p6) {} |
Jelena Marusic | 5d6e58e | 2015-07-13 11:16:39 +0200 | [diff] [blame] | 772 | R operator()() const { |
Fredrik Solenberg | c937139 | 2015-08-06 12:40:53 +0200 | [diff] [blame] | 773 | return (object_->*method_)(p1_, p2_, p3_, p4_, p5_, p6_); } |
Jelena Marusic | 5d6e58e | 2015-07-13 11:16:39 +0200 | [diff] [blame] | 774 | private: |
| 775 | MethodT method_; |
Magnus Jedvert | d3de9c5 | 2015-08-20 16:03:52 +0200 | [diff] [blame] | 776 | typename detail::PointerType<ObjectT>::type object_; |
noahric | 5d9b92b | 2015-10-24 11:14:46 -0700 | [diff] [blame] | 777 | typename rtc::remove_reference<P1>::type p1_; |
| 778 | typename rtc::remove_reference<P2>::type p2_; |
| 779 | typename rtc::remove_reference<P3>::type p3_; |
| 780 | typename rtc::remove_reference<P4>::type p4_; |
| 781 | typename rtc::remove_reference<P5>::type p5_; |
| 782 | typename rtc::remove_reference<P6>::type p6_; |
Jelena Marusic | 5d6e58e | 2015-07-13 11:16:39 +0200 | [diff] [blame] | 783 | }; |
| 784 | |
Fredrik Solenberg | c937139 | 2015-08-06 12:40:53 +0200 | [diff] [blame] | 785 | template <class FunctorT, class R, |
Jelena Marusic | 5d6e58e | 2015-07-13 11:16:39 +0200 | [diff] [blame] | 786 | class P1, |
| 787 | class P2, |
| 788 | class P3, |
| 789 | class P4, |
| 790 | class P5, |
| 791 | class P6> |
| 792 | class Functor6 { |
| 793 | public: |
| 794 | Functor6(const FunctorT& functor, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6) |
| 795 | : functor_(functor), |
Fredrik Solenberg | c937139 | 2015-08-06 12:40:53 +0200 | [diff] [blame] | 796 | p1_(p1), |
| 797 | p2_(p2), |
| 798 | p3_(p3), |
| 799 | p4_(p4), |
| 800 | p5_(p5), |
| 801 | p6_(p6) {} |
| 802 | R operator()() const { |
| 803 | return functor_(p1_, p2_, p3_, p4_, p5_, p6_); } |
Jelena Marusic | 5d6e58e | 2015-07-13 11:16:39 +0200 | [diff] [blame] | 804 | private: |
| 805 | FunctorT functor_; |
noahric | 5d9b92b | 2015-10-24 11:14:46 -0700 | [diff] [blame] | 806 | typename rtc::remove_reference<P1>::type p1_; |
| 807 | typename rtc::remove_reference<P2>::type p2_; |
| 808 | typename rtc::remove_reference<P3>::type p3_; |
| 809 | typename rtc::remove_reference<P4>::type p4_; |
| 810 | typename rtc::remove_reference<P5>::type p5_; |
| 811 | typename rtc::remove_reference<P6>::type p6_; |
Jelena Marusic | 5d6e58e | 2015-07-13 11:16:39 +0200 | [diff] [blame] | 812 | }; |
| 813 | |
Fredrik Solenberg | c937139 | 2015-08-06 12:40:53 +0200 | [diff] [blame] | 814 | |
Jelena Marusic | 5d6e58e | 2015-07-13 11:16:39 +0200 | [diff] [blame] | 815 | #define FP_T(x) R (ObjectT::*x)(P1, P2, P3, P4, P5, P6) |
| 816 | |
Fredrik Solenberg | c937139 | 2015-08-06 12:40:53 +0200 | [diff] [blame] | 817 | template <class ObjectT, class R, |
Jelena Marusic | 5d6e58e | 2015-07-13 11:16:39 +0200 | [diff] [blame] | 818 | class P1, |
| 819 | class P2, |
| 820 | class P3, |
| 821 | class P4, |
| 822 | class P5, |
| 823 | class P6> |
Fredrik Solenberg | c937139 | 2015-08-06 12:40:53 +0200 | [diff] [blame] | 824 | MethodFunctor6<ObjectT, FP_T(NONAME), R, P1, P2, P3, P4, P5, P6> |
| 825 | Bind(FP_T(method), ObjectT* object, |
| 826 | typename detail::identity<P1>::type p1, |
| 827 | typename detail::identity<P2>::type p2, |
| 828 | typename detail::identity<P3>::type p3, |
| 829 | typename detail::identity<P4>::type p4, |
| 830 | typename detail::identity<P5>::type p5, |
| 831 | typename detail::identity<P6>::type p6) { |
Jelena Marusic | 5d6e58e | 2015-07-13 11:16:39 +0200 | [diff] [blame] | 832 | return MethodFunctor6<ObjectT, FP_T(NONAME), R, P1, P2, P3, P4, P5, P6>( |
| 833 | method, object, p1, p2, p3, p4, p5, p6); |
| 834 | } |
| 835 | |
| 836 | #undef FP_T |
| 837 | #define FP_T(x) R (ObjectT::*x)(P1, P2, P3, P4, P5, P6) const |
| 838 | |
Fredrik Solenberg | c937139 | 2015-08-06 12:40:53 +0200 | [diff] [blame] | 839 | template <class ObjectT, class R, |
Jelena Marusic | 5d6e58e | 2015-07-13 11:16:39 +0200 | [diff] [blame] | 840 | class P1, |
| 841 | class P2, |
| 842 | class P3, |
| 843 | class P4, |
| 844 | class P5, |
| 845 | class P6> |
Fredrik Solenberg | c937139 | 2015-08-06 12:40:53 +0200 | [diff] [blame] | 846 | MethodFunctor6<const ObjectT, FP_T(NONAME), R, P1, P2, P3, P4, P5, P6> |
| 847 | Bind(FP_T(method), const ObjectT* object, |
| 848 | typename detail::identity<P1>::type p1, |
| 849 | typename detail::identity<P2>::type p2, |
| 850 | typename detail::identity<P3>::type p3, |
| 851 | typename detail::identity<P4>::type p4, |
| 852 | typename detail::identity<P5>::type p5, |
| 853 | typename detail::identity<P6>::type p6) { |
Jelena Marusic | 5d6e58e | 2015-07-13 11:16:39 +0200 | [diff] [blame] | 854 | return MethodFunctor6<const ObjectT, FP_T(NONAME), R, P1, P2, P3, P4, P5, P6>( |
| 855 | method, object, p1, p2, p3, p4, p5, p6); |
| 856 | } |
| 857 | |
| 858 | #undef FP_T |
Magnus Jedvert | d3de9c5 | 2015-08-20 16:03:52 +0200 | [diff] [blame] | 859 | #define FP_T(x) R (ObjectT::*x)(P1, P2, P3, P4, P5, P6) |
| 860 | |
| 861 | template <class ObjectT, class R, |
| 862 | class P1, |
| 863 | class P2, |
| 864 | class P3, |
| 865 | class P4, |
| 866 | class P5, |
| 867 | class P6> |
| 868 | MethodFunctor6<ObjectT, FP_T(NONAME), R, P1, P2, P3, P4, P5, P6> |
| 869 | Bind(FP_T(method), const scoped_refptr<ObjectT>& object, |
| 870 | typename detail::identity<P1>::type p1, |
| 871 | typename detail::identity<P2>::type p2, |
| 872 | typename detail::identity<P3>::type p3, |
| 873 | typename detail::identity<P4>::type p4, |
| 874 | typename detail::identity<P5>::type p5, |
| 875 | typename detail::identity<P6>::type p6) { |
| 876 | return MethodFunctor6<ObjectT, FP_T(NONAME), R, P1, P2, P3, P4, P5, P6>( |
| 877 | method, object.get(), p1, p2, p3, p4, p5, p6); |
| 878 | } |
| 879 | |
| 880 | #undef FP_T |
Jelena Marusic | 5d6e58e | 2015-07-13 11:16:39 +0200 | [diff] [blame] | 881 | #define FP_T(x) R (*x)(P1, P2, P3, P4, P5, P6) |
| 882 | |
Fredrik Solenberg | c937139 | 2015-08-06 12:40:53 +0200 | [diff] [blame] | 883 | template <class R, |
| 884 | class P1, |
| 885 | class P2, |
| 886 | class P3, |
| 887 | class P4, |
| 888 | class P5, |
| 889 | class P6> |
| 890 | Functor6<FP_T(NONAME), R, P1, P2, P3, P4, P5, P6> |
| 891 | Bind(FP_T(function), |
| 892 | typename detail::identity<P1>::type p1, |
| 893 | typename detail::identity<P2>::type p2, |
| 894 | typename detail::identity<P3>::type p3, |
| 895 | typename detail::identity<P4>::type p4, |
| 896 | typename detail::identity<P5>::type p5, |
| 897 | typename detail::identity<P6>::type p6) { |
| 898 | return Functor6<FP_T(NONAME), R, P1, P2, P3, P4, P5, P6>( |
| 899 | function, p1, p2, p3, p4, p5, p6); |
Jelena Marusic | 5d6e58e | 2015-07-13 11:16:39 +0200 | [diff] [blame] | 900 | } |
| 901 | |
| 902 | #undef FP_T |
henrike@webrtc.org | f048872 | 2014-05-13 18:00:26 +0000 | [diff] [blame] | 903 | |
noahric | 5d9b92b | 2015-10-24 11:14:46 -0700 | [diff] [blame] | 904 | template <class ObjectT, |
| 905 | class MethodT, |
| 906 | class R, |
| 907 | class P1, |
| 908 | class P2, |
| 909 | class P3, |
| 910 | class P4, |
| 911 | class P5, |
| 912 | class P6, |
| 913 | class P7> |
| 914 | class MethodFunctor7 { |
| 915 | public: |
| 916 | MethodFunctor7(MethodT method, |
| 917 | ObjectT* object, |
| 918 | P1 p1, |
| 919 | P2 p2, |
| 920 | P3 p3, |
| 921 | P4 p4, |
| 922 | P5 p5, |
| 923 | P6 p6, |
| 924 | P7 p7) |
| 925 | : method_(method), |
| 926 | object_(object), |
| 927 | p1_(p1), |
| 928 | p2_(p2), |
| 929 | p3_(p3), |
| 930 | p4_(p4), |
| 931 | p5_(p5), |
| 932 | p6_(p6), |
| 933 | p7_(p7) {} |
| 934 | R operator()() const { |
| 935 | return (object_->*method_)(p1_, p2_, p3_, p4_, p5_, p6_, p7_); |
| 936 | } |
| 937 | |
| 938 | private: |
| 939 | MethodT method_; |
| 940 | typename detail::PointerType<ObjectT>::type object_; |
| 941 | typename rtc::remove_reference<P1>::type p1_; |
| 942 | typename rtc::remove_reference<P2>::type p2_; |
| 943 | typename rtc::remove_reference<P3>::type p3_; |
| 944 | typename rtc::remove_reference<P4>::type p4_; |
| 945 | typename rtc::remove_reference<P5>::type p5_; |
| 946 | typename rtc::remove_reference<P6>::type p6_; |
| 947 | typename rtc::remove_reference<P7>::type p7_; |
| 948 | }; |
| 949 | |
| 950 | template <class FunctorT, |
| 951 | class R, |
| 952 | class P1, |
| 953 | class P2, |
| 954 | class P3, |
| 955 | class P4, |
| 956 | class P5, |
| 957 | class P6, |
| 958 | class P7> |
| 959 | class Functor7 { |
| 960 | public: |
| 961 | Functor7(const FunctorT& functor, |
| 962 | P1 p1, |
| 963 | P2 p2, |
| 964 | P3 p3, |
| 965 | P4 p4, |
| 966 | P5 p5, |
| 967 | P6 p6, |
| 968 | P7 p7) |
| 969 | : functor_(functor), |
| 970 | p1_(p1), |
| 971 | p2_(p2), |
| 972 | p3_(p3), |
| 973 | p4_(p4), |
| 974 | p5_(p5), |
| 975 | p6_(p6), |
| 976 | p7_(p7) {} |
| 977 | R operator()() const { return functor_(p1_, p2_, p3_, p4_, p5_, p6_, p7_); } |
| 978 | |
| 979 | private: |
| 980 | FunctorT functor_; |
| 981 | typename rtc::remove_reference<P1>::type p1_; |
| 982 | typename rtc::remove_reference<P2>::type p2_; |
| 983 | typename rtc::remove_reference<P3>::type p3_; |
| 984 | typename rtc::remove_reference<P4>::type p4_; |
| 985 | typename rtc::remove_reference<P5>::type p5_; |
| 986 | typename rtc::remove_reference<P6>::type p6_; |
| 987 | typename rtc::remove_reference<P7>::type p7_; |
| 988 | }; |
| 989 | |
| 990 | #define FP_T(x) R (ObjectT::*x)(P1, P2, P3, P4, P5, P6, P7) |
| 991 | |
| 992 | template <class ObjectT, |
| 993 | class R, |
| 994 | class P1, |
| 995 | class P2, |
| 996 | class P3, |
| 997 | class P4, |
| 998 | class P5, |
| 999 | class P6, |
| 1000 | class P7> |
| 1001 | MethodFunctor7<ObjectT, FP_T(NONAME), R, P1, P2, P3, P4, P5, P6, P7> Bind( |
| 1002 | FP_T(method), |
| 1003 | ObjectT* object, |
| 1004 | typename detail::identity<P1>::type p1, |
| 1005 | typename detail::identity<P2>::type p2, |
| 1006 | typename detail::identity<P3>::type p3, |
| 1007 | typename detail::identity<P4>::type p4, |
| 1008 | typename detail::identity<P5>::type p5, |
| 1009 | typename detail::identity<P6>::type p6, |
| 1010 | typename detail::identity<P7>::type p7) { |
| 1011 | return MethodFunctor7<ObjectT, FP_T(NONAME), R, P1, P2, P3, P4, P5, P6, P7>( |
| 1012 | method, object, p1, p2, p3, p4, p5, p6, p7); |
| 1013 | } |
| 1014 | |
| 1015 | #undef FP_T |
| 1016 | #define FP_T(x) R (ObjectT::*x)(P1, P2, P3, P4, P5, P6, P7) const |
| 1017 | |
| 1018 | template <class ObjectT, |
| 1019 | class R, |
| 1020 | class P1, |
| 1021 | class P2, |
| 1022 | class P3, |
| 1023 | class P4, |
| 1024 | class P5, |
| 1025 | class P6, |
| 1026 | class P7> |
| 1027 | MethodFunctor7<const ObjectT, FP_T(NONAME), R, P1, P2, P3, P4, P5, P6, P7> Bind( |
| 1028 | FP_T(method), |
| 1029 | const ObjectT* object, |
| 1030 | typename detail::identity<P1>::type p1, |
| 1031 | typename detail::identity<P2>::type p2, |
| 1032 | typename detail::identity<P3>::type p3, |
| 1033 | typename detail::identity<P4>::type p4, |
| 1034 | typename detail::identity<P5>::type p5, |
| 1035 | typename detail::identity<P6>::type p6, |
| 1036 | typename detail::identity<P7>::type p7) { |
| 1037 | return MethodFunctor7<const ObjectT, FP_T(NONAME), R, P1, P2, P3, P4, P5, P6, |
| 1038 | P7>(method, object, p1, p2, p3, p4, p5, p6, p7); |
| 1039 | } |
| 1040 | |
| 1041 | #undef FP_T |
| 1042 | #define FP_T(x) R (ObjectT::*x)(P1, P2, P3, P4, P5, P6, P7) |
| 1043 | |
| 1044 | template <class ObjectT, |
| 1045 | class R, |
| 1046 | class P1, |
| 1047 | class P2, |
| 1048 | class P3, |
| 1049 | class P4, |
| 1050 | class P5, |
| 1051 | class P6, |
| 1052 | class P7> |
| 1053 | MethodFunctor7<ObjectT, FP_T(NONAME), R, P1, P2, P3, P4, P5, P6, P7> Bind( |
| 1054 | FP_T(method), |
| 1055 | const scoped_refptr<ObjectT>& object, |
| 1056 | typename detail::identity<P1>::type p1, |
| 1057 | typename detail::identity<P2>::type p2, |
| 1058 | typename detail::identity<P3>::type p3, |
| 1059 | typename detail::identity<P4>::type p4, |
| 1060 | typename detail::identity<P5>::type p5, |
| 1061 | typename detail::identity<P6>::type p6, |
| 1062 | typename detail::identity<P7>::type p7) { |
| 1063 | return MethodFunctor7<ObjectT, FP_T(NONAME), R, P1, P2, P3, P4, P5, P6, P7>( |
| 1064 | method, object.get(), p1, p2, p3, p4, p5, p6, p7); |
| 1065 | } |
| 1066 | |
| 1067 | #undef FP_T |
| 1068 | #define FP_T(x) R (*x)(P1, P2, P3, P4, P5, P6, P7) |
| 1069 | |
| 1070 | template <class R, |
| 1071 | class P1, |
| 1072 | class P2, |
| 1073 | class P3, |
| 1074 | class P4, |
| 1075 | class P5, |
| 1076 | class P6, |
| 1077 | class P7> |
| 1078 | Functor7<FP_T(NONAME), R, P1, P2, P3, P4, P5, P6, P7> Bind( |
| 1079 | FP_T(function), |
| 1080 | typename detail::identity<P1>::type p1, |
| 1081 | typename detail::identity<P2>::type p2, |
| 1082 | typename detail::identity<P3>::type p3, |
| 1083 | typename detail::identity<P4>::type p4, |
| 1084 | typename detail::identity<P5>::type p5, |
| 1085 | typename detail::identity<P6>::type p6, |
| 1086 | typename detail::identity<P7>::type p7) { |
| 1087 | return Functor7<FP_T(NONAME), R, P1, P2, P3, P4, P5, P6, P7>( |
| 1088 | function, p1, p2, p3, p4, p5, p6, p7); |
| 1089 | } |
| 1090 | |
| 1091 | #undef FP_T |
| 1092 | |
| 1093 | template <class ObjectT, |
| 1094 | class MethodT, |
| 1095 | class R, |
| 1096 | class P1, |
| 1097 | class P2, |
| 1098 | class P3, |
| 1099 | class P4, |
| 1100 | class P5, |
| 1101 | class P6, |
| 1102 | class P7, |
| 1103 | class P8> |
| 1104 | class MethodFunctor8 { |
| 1105 | public: |
| 1106 | MethodFunctor8(MethodT method, |
| 1107 | ObjectT* object, |
| 1108 | P1 p1, |
| 1109 | P2 p2, |
| 1110 | P3 p3, |
| 1111 | P4 p4, |
| 1112 | P5 p5, |
| 1113 | P6 p6, |
| 1114 | P7 p7, |
| 1115 | P8 p8) |
| 1116 | : method_(method), |
| 1117 | object_(object), |
| 1118 | p1_(p1), |
| 1119 | p2_(p2), |
| 1120 | p3_(p3), |
| 1121 | p4_(p4), |
| 1122 | p5_(p5), |
| 1123 | p6_(p6), |
| 1124 | p7_(p7), |
| 1125 | p8_(p8) {} |
| 1126 | R operator()() const { |
| 1127 | return (object_->*method_)(p1_, p2_, p3_, p4_, p5_, p6_, p7_, p8_); |
| 1128 | } |
| 1129 | |
| 1130 | private: |
| 1131 | MethodT method_; |
| 1132 | typename detail::PointerType<ObjectT>::type object_; |
| 1133 | typename rtc::remove_reference<P1>::type p1_; |
| 1134 | typename rtc::remove_reference<P2>::type p2_; |
| 1135 | typename rtc::remove_reference<P3>::type p3_; |
| 1136 | typename rtc::remove_reference<P4>::type p4_; |
| 1137 | typename rtc::remove_reference<P5>::type p5_; |
| 1138 | typename rtc::remove_reference<P6>::type p6_; |
| 1139 | typename rtc::remove_reference<P7>::type p7_; |
| 1140 | typename rtc::remove_reference<P8>::type p8_; |
| 1141 | }; |
| 1142 | |
| 1143 | template <class FunctorT, |
| 1144 | class R, |
| 1145 | class P1, |
| 1146 | class P2, |
| 1147 | class P3, |
| 1148 | class P4, |
| 1149 | class P5, |
| 1150 | class P6, |
| 1151 | class P7, |
| 1152 | class P8> |
| 1153 | class Functor8 { |
| 1154 | public: |
| 1155 | Functor8(const FunctorT& functor, |
| 1156 | P1 p1, |
| 1157 | P2 p2, |
| 1158 | P3 p3, |
| 1159 | P4 p4, |
| 1160 | P5 p5, |
| 1161 | P6 p6, |
| 1162 | P7 p7, |
| 1163 | P8 p8) |
| 1164 | : functor_(functor), |
| 1165 | p1_(p1), |
| 1166 | p2_(p2), |
| 1167 | p3_(p3), |
| 1168 | p4_(p4), |
| 1169 | p5_(p5), |
| 1170 | p6_(p6), |
| 1171 | p7_(p7), |
| 1172 | p8_(p8) {} |
| 1173 | R operator()() const { |
| 1174 | return functor_(p1_, p2_, p3_, p4_, p5_, p6_, p7_, p8_); |
| 1175 | } |
| 1176 | |
| 1177 | private: |
| 1178 | FunctorT functor_; |
| 1179 | typename rtc::remove_reference<P1>::type p1_; |
| 1180 | typename rtc::remove_reference<P2>::type p2_; |
| 1181 | typename rtc::remove_reference<P3>::type p3_; |
| 1182 | typename rtc::remove_reference<P4>::type p4_; |
| 1183 | typename rtc::remove_reference<P5>::type p5_; |
| 1184 | typename rtc::remove_reference<P6>::type p6_; |
| 1185 | typename rtc::remove_reference<P7>::type p7_; |
| 1186 | typename rtc::remove_reference<P8>::type p8_; |
| 1187 | }; |
| 1188 | |
| 1189 | #define FP_T(x) R (ObjectT::*x)(P1, P2, P3, P4, P5, P6, P7, P8) |
| 1190 | |
| 1191 | template <class ObjectT, |
| 1192 | class R, |
| 1193 | class P1, |
| 1194 | class P2, |
| 1195 | class P3, |
| 1196 | class P4, |
| 1197 | class P5, |
| 1198 | class P6, |
| 1199 | class P7, |
| 1200 | class P8> |
| 1201 | MethodFunctor8<ObjectT, FP_T(NONAME), R, P1, P2, P3, P4, P5, P6, P7, P8> Bind( |
| 1202 | FP_T(method), |
| 1203 | ObjectT* object, |
| 1204 | typename detail::identity<P1>::type p1, |
| 1205 | typename detail::identity<P2>::type p2, |
| 1206 | typename detail::identity<P3>::type p3, |
| 1207 | typename detail::identity<P4>::type p4, |
| 1208 | typename detail::identity<P5>::type p5, |
| 1209 | typename detail::identity<P6>::type p6, |
| 1210 | typename detail::identity<P7>::type p7, |
| 1211 | typename detail::identity<P8>::type p8) { |
| 1212 | return MethodFunctor8<ObjectT, FP_T(NONAME), R, P1, P2, P3, P4, P5, P6, P7, |
| 1213 | P8>(method, object, p1, p2, p3, p4, p5, p6, p7, p8); |
| 1214 | } |
| 1215 | |
| 1216 | #undef FP_T |
| 1217 | #define FP_T(x) R (ObjectT::*x)(P1, P2, P3, P4, P5, P6, P7, P8) const |
| 1218 | |
| 1219 | template <class ObjectT, |
| 1220 | class R, |
| 1221 | class P1, |
| 1222 | class P2, |
| 1223 | class P3, |
| 1224 | class P4, |
| 1225 | class P5, |
| 1226 | class P6, |
| 1227 | class P7, |
| 1228 | class P8> |
| 1229 | MethodFunctor8<const ObjectT, FP_T(NONAME), R, P1, P2, P3, P4, P5, P6, P7, P8> |
| 1230 | Bind(FP_T(method), |
| 1231 | const ObjectT* object, |
| 1232 | typename detail::identity<P1>::type p1, |
| 1233 | typename detail::identity<P2>::type p2, |
| 1234 | typename detail::identity<P3>::type p3, |
| 1235 | typename detail::identity<P4>::type p4, |
| 1236 | typename detail::identity<P5>::type p5, |
| 1237 | typename detail::identity<P6>::type p6, |
| 1238 | typename detail::identity<P7>::type p7, |
| 1239 | typename detail::identity<P8>::type p8) { |
| 1240 | return MethodFunctor8<const ObjectT, FP_T(NONAME), R, P1, P2, P3, P4, P5, P6, |
| 1241 | P7, P8>(method, object, p1, p2, p3, p4, p5, p6, p7, p8); |
| 1242 | } |
| 1243 | |
| 1244 | #undef FP_T |
| 1245 | #define FP_T(x) R (ObjectT::*x)(P1, P2, P3, P4, P5, P6, P7, P8) |
| 1246 | |
| 1247 | template <class ObjectT, |
| 1248 | class R, |
| 1249 | class P1, |
| 1250 | class P2, |
| 1251 | class P3, |
| 1252 | class P4, |
| 1253 | class P5, |
| 1254 | class P6, |
| 1255 | class P7, |
| 1256 | class P8> |
| 1257 | MethodFunctor8<ObjectT, FP_T(NONAME), R, P1, P2, P3, P4, P5, P6, P7, P8> Bind( |
| 1258 | FP_T(method), |
| 1259 | const scoped_refptr<ObjectT>& object, |
| 1260 | typename detail::identity<P1>::type p1, |
| 1261 | typename detail::identity<P2>::type p2, |
| 1262 | typename detail::identity<P3>::type p3, |
| 1263 | typename detail::identity<P4>::type p4, |
| 1264 | typename detail::identity<P5>::type p5, |
| 1265 | typename detail::identity<P6>::type p6, |
| 1266 | typename detail::identity<P7>::type p7, |
| 1267 | typename detail::identity<P8>::type p8) { |
| 1268 | return MethodFunctor8<ObjectT, FP_T(NONAME), R, P1, P2, P3, P4, P5, P6, P7, |
| 1269 | P8>(method, object.get(), p1, p2, p3, p4, p5, p6, p7, |
| 1270 | p8); |
| 1271 | } |
| 1272 | |
| 1273 | #undef FP_T |
| 1274 | #define FP_T(x) R (*x)(P1, P2, P3, P4, P5, P6, P7, P8) |
| 1275 | |
| 1276 | template <class R, |
| 1277 | class P1, |
| 1278 | class P2, |
| 1279 | class P3, |
| 1280 | class P4, |
| 1281 | class P5, |
| 1282 | class P6, |
| 1283 | class P7, |
| 1284 | class P8> |
| 1285 | Functor8<FP_T(NONAME), R, P1, P2, P3, P4, P5, P6, P7, P8> Bind( |
| 1286 | FP_T(function), |
| 1287 | typename detail::identity<P1>::type p1, |
| 1288 | typename detail::identity<P2>::type p2, |
| 1289 | typename detail::identity<P3>::type p3, |
| 1290 | typename detail::identity<P4>::type p4, |
| 1291 | typename detail::identity<P5>::type p5, |
| 1292 | typename detail::identity<P6>::type p6, |
| 1293 | typename detail::identity<P7>::type p7, |
| 1294 | typename detail::identity<P8>::type p8) { |
| 1295 | return Functor8<FP_T(NONAME), R, P1, P2, P3, P4, P5, P6, P7, P8>( |
| 1296 | function, p1, p2, p3, p4, p5, p6, p7, p8); |
| 1297 | } |
| 1298 | |
| 1299 | #undef FP_T |
| 1300 | |
| 1301 | template <class ObjectT, |
| 1302 | class MethodT, |
| 1303 | class R, |
| 1304 | class P1, |
| 1305 | class P2, |
| 1306 | class P3, |
| 1307 | class P4, |
| 1308 | class P5, |
| 1309 | class P6, |
| 1310 | class P7, |
| 1311 | class P8, |
| 1312 | class P9> |
| 1313 | class MethodFunctor9 { |
| 1314 | public: |
| 1315 | MethodFunctor9(MethodT method, |
| 1316 | ObjectT* object, |
| 1317 | P1 p1, |
| 1318 | P2 p2, |
| 1319 | P3 p3, |
| 1320 | P4 p4, |
| 1321 | P5 p5, |
| 1322 | P6 p6, |
| 1323 | P7 p7, |
| 1324 | P8 p8, |
| 1325 | P9 p9) |
| 1326 | : method_(method), |
| 1327 | object_(object), |
| 1328 | p1_(p1), |
| 1329 | p2_(p2), |
| 1330 | p3_(p3), |
| 1331 | p4_(p4), |
| 1332 | p5_(p5), |
| 1333 | p6_(p6), |
| 1334 | p7_(p7), |
| 1335 | p8_(p8), |
| 1336 | p9_(p9) {} |
| 1337 | R operator()() const { |
| 1338 | return (object_->*method_)(p1_, p2_, p3_, p4_, p5_, p6_, p7_, p8_, p9_); |
| 1339 | } |
| 1340 | |
| 1341 | private: |
| 1342 | MethodT method_; |
| 1343 | typename detail::PointerType<ObjectT>::type object_; |
| 1344 | typename rtc::remove_reference<P1>::type p1_; |
| 1345 | typename rtc::remove_reference<P2>::type p2_; |
| 1346 | typename rtc::remove_reference<P3>::type p3_; |
| 1347 | typename rtc::remove_reference<P4>::type p4_; |
| 1348 | typename rtc::remove_reference<P5>::type p5_; |
| 1349 | typename rtc::remove_reference<P6>::type p6_; |
| 1350 | typename rtc::remove_reference<P7>::type p7_; |
| 1351 | typename rtc::remove_reference<P8>::type p8_; |
| 1352 | typename rtc::remove_reference<P9>::type p9_; |
| 1353 | }; |
| 1354 | |
| 1355 | template <class FunctorT, |
| 1356 | class R, |
| 1357 | class P1, |
| 1358 | class P2, |
| 1359 | class P3, |
| 1360 | class P4, |
| 1361 | class P5, |
| 1362 | class P6, |
| 1363 | class P7, |
| 1364 | class P8, |
| 1365 | class P9> |
| 1366 | class Functor9 { |
| 1367 | public: |
| 1368 | Functor9(const FunctorT& functor, |
| 1369 | P1 p1, |
| 1370 | P2 p2, |
| 1371 | P3 p3, |
| 1372 | P4 p4, |
| 1373 | P5 p5, |
| 1374 | P6 p6, |
| 1375 | P7 p7, |
| 1376 | P8 p8, |
| 1377 | P9 p9) |
| 1378 | : functor_(functor), |
| 1379 | p1_(p1), |
| 1380 | p2_(p2), |
| 1381 | p3_(p3), |
| 1382 | p4_(p4), |
| 1383 | p5_(p5), |
| 1384 | p6_(p6), |
| 1385 | p7_(p7), |
| 1386 | p8_(p8), |
| 1387 | p9_(p9) {} |
| 1388 | R operator()() const { |
| 1389 | return functor_(p1_, p2_, p3_, p4_, p5_, p6_, p7_, p8_, p9_); |
| 1390 | } |
| 1391 | |
| 1392 | private: |
| 1393 | FunctorT functor_; |
| 1394 | typename rtc::remove_reference<P1>::type p1_; |
| 1395 | typename rtc::remove_reference<P2>::type p2_; |
| 1396 | typename rtc::remove_reference<P3>::type p3_; |
| 1397 | typename rtc::remove_reference<P4>::type p4_; |
| 1398 | typename rtc::remove_reference<P5>::type p5_; |
| 1399 | typename rtc::remove_reference<P6>::type p6_; |
| 1400 | typename rtc::remove_reference<P7>::type p7_; |
| 1401 | typename rtc::remove_reference<P8>::type p8_; |
| 1402 | typename rtc::remove_reference<P9>::type p9_; |
| 1403 | }; |
| 1404 | |
| 1405 | #define FP_T(x) R (ObjectT::*x)(P1, P2, P3, P4, P5, P6, P7, P8, P9) |
| 1406 | |
| 1407 | template <class ObjectT, |
| 1408 | class R, |
| 1409 | class P1, |
| 1410 | class P2, |
| 1411 | class P3, |
| 1412 | class P4, |
| 1413 | class P5, |
| 1414 | class P6, |
| 1415 | class P7, |
| 1416 | class P8, |
| 1417 | class P9> |
| 1418 | MethodFunctor9<ObjectT, FP_T(NONAME), R, P1, P2, P3, P4, P5, P6, P7, P8, P9> |
| 1419 | Bind(FP_T(method), |
| 1420 | ObjectT* object, |
| 1421 | typename detail::identity<P1>::type p1, |
| 1422 | typename detail::identity<P2>::type p2, |
| 1423 | typename detail::identity<P3>::type p3, |
| 1424 | typename detail::identity<P4>::type p4, |
| 1425 | typename detail::identity<P5>::type p5, |
| 1426 | typename detail::identity<P6>::type p6, |
| 1427 | typename detail::identity<P7>::type p7, |
| 1428 | typename detail::identity<P8>::type p8, |
| 1429 | typename detail::identity<P9>::type p9) { |
| 1430 | return MethodFunctor9<ObjectT, FP_T(NONAME), R, P1, P2, P3, P4, P5, P6, P7, |
| 1431 | P8, P9>(method, object, p1, p2, p3, p4, p5, p6, p7, p8, |
| 1432 | p9); |
| 1433 | } |
| 1434 | |
| 1435 | #undef FP_T |
| 1436 | #define FP_T(x) R (ObjectT::*x)(P1, P2, P3, P4, P5, P6, P7, P8, P9) const |
| 1437 | |
| 1438 | template <class ObjectT, |
| 1439 | class R, |
| 1440 | class P1, |
| 1441 | class P2, |
| 1442 | class P3, |
| 1443 | class P4, |
| 1444 | class P5, |
| 1445 | class P6, |
| 1446 | class P7, |
| 1447 | class P8, |
| 1448 | class P9> |
| 1449 | MethodFunctor9<const ObjectT, |
| 1450 | FP_T(NONAME), |
| 1451 | R, |
| 1452 | P1, |
| 1453 | P2, |
| 1454 | P3, |
| 1455 | P4, |
| 1456 | P5, |
| 1457 | P6, |
| 1458 | P7, |
| 1459 | P8, |
| 1460 | P9> |
| 1461 | Bind(FP_T(method), |
| 1462 | const ObjectT* object, |
| 1463 | typename detail::identity<P1>::type p1, |
| 1464 | typename detail::identity<P2>::type p2, |
| 1465 | typename detail::identity<P3>::type p3, |
| 1466 | typename detail::identity<P4>::type p4, |
| 1467 | typename detail::identity<P5>::type p5, |
| 1468 | typename detail::identity<P6>::type p6, |
| 1469 | typename detail::identity<P7>::type p7, |
| 1470 | typename detail::identity<P8>::type p8, |
| 1471 | typename detail::identity<P9>::type p9) { |
| 1472 | return MethodFunctor9<const ObjectT, FP_T(NONAME), R, P1, P2, P3, P4, P5, P6, |
| 1473 | P7, P8, P9>(method, object, p1, p2, p3, p4, p5, p6, p7, |
| 1474 | p8, p9); |
| 1475 | } |
| 1476 | |
| 1477 | #undef FP_T |
| 1478 | #define FP_T(x) R (ObjectT::*x)(P1, P2, P3, P4, P5, P6, P7, P8, P9) |
| 1479 | |
| 1480 | template <class ObjectT, |
| 1481 | class R, |
| 1482 | class P1, |
| 1483 | class P2, |
| 1484 | class P3, |
| 1485 | class P4, |
| 1486 | class P5, |
| 1487 | class P6, |
| 1488 | class P7, |
| 1489 | class P8, |
| 1490 | class P9> |
| 1491 | MethodFunctor9<ObjectT, FP_T(NONAME), R, P1, P2, P3, P4, P5, P6, P7, P8, P9> |
| 1492 | Bind(FP_T(method), |
| 1493 | const scoped_refptr<ObjectT>& object, |
| 1494 | typename detail::identity<P1>::type p1, |
| 1495 | typename detail::identity<P2>::type p2, |
| 1496 | typename detail::identity<P3>::type p3, |
| 1497 | typename detail::identity<P4>::type p4, |
| 1498 | typename detail::identity<P5>::type p5, |
| 1499 | typename detail::identity<P6>::type p6, |
| 1500 | typename detail::identity<P7>::type p7, |
| 1501 | typename detail::identity<P8>::type p8, |
| 1502 | typename detail::identity<P9>::type p9) { |
| 1503 | return MethodFunctor9<ObjectT, FP_T(NONAME), R, P1, P2, P3, P4, P5, P6, P7, |
| 1504 | P8, P9>(method, object.get(), p1, p2, p3, p4, p5, p6, |
| 1505 | p7, p8, p9); |
| 1506 | } |
| 1507 | |
| 1508 | #undef FP_T |
| 1509 | #define FP_T(x) R (*x)(P1, P2, P3, P4, P5, P6, P7, P8, P9) |
| 1510 | |
| 1511 | template <class R, |
| 1512 | class P1, |
| 1513 | class P2, |
| 1514 | class P3, |
| 1515 | class P4, |
| 1516 | class P5, |
| 1517 | class P6, |
| 1518 | class P7, |
| 1519 | class P8, |
| 1520 | class P9> |
| 1521 | Functor9<FP_T(NONAME), R, P1, P2, P3, P4, P5, P6, P7, P8, P9> Bind( |
| 1522 | FP_T(function), |
| 1523 | typename detail::identity<P1>::type p1, |
| 1524 | typename detail::identity<P2>::type p2, |
| 1525 | typename detail::identity<P3>::type p3, |
| 1526 | typename detail::identity<P4>::type p4, |
| 1527 | typename detail::identity<P5>::type p5, |
| 1528 | typename detail::identity<P6>::type p6, |
| 1529 | typename detail::identity<P7>::type p7, |
| 1530 | typename detail::identity<P8>::type p8, |
| 1531 | typename detail::identity<P9>::type p9) { |
| 1532 | return Functor9<FP_T(NONAME), R, P1, P2, P3, P4, P5, P6, P7, P8, P9>( |
| 1533 | function, p1, p2, p3, p4, p5, p6, p7, p8, p9); |
| 1534 | } |
| 1535 | |
| 1536 | #undef FP_T |
| 1537 | |
henrike@webrtc.org | f048872 | 2014-05-13 18:00:26 +0000 | [diff] [blame] | 1538 | } // namespace rtc |
| 1539 | |
| 1540 | #undef NONAME |
| 1541 | |
| 1542 | #endif // WEBRTC_BASE_BIND_H_ |