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. |
| 51 | // invoker.AsyncInvoke(rtc::Bind(&Bar::Test, this)); |
| 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" |
| 68 | |
henrike@webrtc.org | f048872 | 2014-05-13 18:00:26 +0000 | [diff] [blame] | 69 | #define NONAME |
| 70 | |
| 71 | namespace rtc { |
| 72 | namespace detail { |
| 73 | // This is needed because the template parameters in Bind can't be resolved |
| 74 | // if they're used both as parameters of the function pointer type and as |
| 75 | // parameters to Bind itself: the function pointer parameters are exact |
| 76 | // matches to the function prototype, but the parameters to bind have |
| 77 | // references stripped. This trick allows the compiler to dictate the Bind |
| 78 | // parameter types rather than deduce them. |
| 79 | template <class T> struct identity { typedef T type; }; |
Magnus Jedvert | d3de9c5 | 2015-08-20 16:03:52 +0200 | [diff] [blame] | 80 | |
| 81 | // IsRefCounted<T>::value will be true for types that can be used in |
| 82 | // rtc::scoped_refptr<T>, i.e. types that implements nullary functions AddRef() |
| 83 | // and Release(), regardless of their return types. AddRef() and Release() can |
| 84 | // be defined in T or any superclass of T. |
| 85 | template <typename T> |
| 86 | class IsRefCounted { |
| 87 | // This is a complex implementation detail done with SFINAE. |
| 88 | |
| 89 | // Define types such that sizeof(Yes) != sizeof(No). |
| 90 | struct Yes { char dummy[1]; }; |
| 91 | struct No { char dummy[2]; }; |
| 92 | // Define two overloaded template functions with return types of different |
| 93 | // size. This way, we can use sizeof() on the return type to determine which |
| 94 | // function the compiler would have chosen. One function will be preferred |
| 95 | // over the other if it is possible to create it without compiler errors, |
| 96 | // otherwise the compiler will simply remove it, and default to the less |
| 97 | // preferred function. |
| 98 | template <typename R> |
| 99 | static Yes test(R* r, decltype(r->AddRef(), r->Release(), 42)); |
| 100 | template <typename C> static No test(...); |
| 101 | |
| 102 | public: |
| 103 | // Trick the compiler to tell if it's possible to call AddRef() and Release(). |
| 104 | static const bool value = sizeof(test<T>((T*)nullptr, 42)) == sizeof(Yes); |
| 105 | }; |
| 106 | |
| 107 | // TernaryTypeOperator is a helper class to select a type based on a static bool |
| 108 | // value. |
| 109 | template <bool condition, typename IfTrueT, typename IfFalseT> |
| 110 | struct TernaryTypeOperator {}; |
| 111 | |
| 112 | template <typename IfTrueT, typename IfFalseT> |
| 113 | struct TernaryTypeOperator<true, IfTrueT, IfFalseT> { |
| 114 | typedef IfTrueT type; |
| 115 | }; |
| 116 | |
| 117 | template <typename IfTrueT, typename IfFalseT> |
| 118 | struct TernaryTypeOperator<false, IfTrueT, IfFalseT> { |
| 119 | typedef IfFalseT type; |
| 120 | }; |
| 121 | |
| 122 | // PointerType<T>::type will be scoped_refptr<T> for ref counted types, and T* |
| 123 | // otherwise. |
| 124 | template <class T> |
| 125 | struct PointerType { |
| 126 | typedef typename TernaryTypeOperator<IsRefCounted<T>::value, |
| 127 | scoped_refptr<T>, |
| 128 | T*>::type type; |
| 129 | }; |
| 130 | |
Magnus Jedvert | b274547 | 2015-08-25 17:56:22 +0200 | [diff] [blame] | 131 | // RemoveScopedPtrRef will capture scoped_refptr by-value instead of |
| 132 | // by-reference. |
| 133 | template <class T> struct RemoveScopedPtrRef { typedef T type; }; |
| 134 | template <class T> |
| 135 | struct RemoveScopedPtrRef<const scoped_refptr<T>&> { |
| 136 | typedef scoped_refptr<T> type; |
| 137 | }; |
| 138 | template <class T> |
| 139 | struct RemoveScopedPtrRef<scoped_refptr<T>&> { |
| 140 | typedef scoped_refptr<T> type; |
| 141 | }; |
| 142 | |
henrike@webrtc.org | f048872 | 2014-05-13 18:00:26 +0000 | [diff] [blame] | 143 | } // namespace detail |
| 144 | |
| 145 | template <class ObjectT, class MethodT, class R> |
| 146 | class MethodFunctor0 { |
| 147 | public: |
| 148 | MethodFunctor0(MethodT method, ObjectT* object) |
| 149 | : method_(method), object_(object) {} |
| 150 | R operator()() const { |
| 151 | return (object_->*method_)(); } |
| 152 | private: |
| 153 | MethodT method_; |
Magnus Jedvert | d3de9c5 | 2015-08-20 16:03:52 +0200 | [diff] [blame] | 154 | typename detail::PointerType<ObjectT>::type object_; |
henrike@webrtc.org | f048872 | 2014-05-13 18:00:26 +0000 | [diff] [blame] | 155 | }; |
| 156 | |
| 157 | template <class FunctorT, class R> |
| 158 | class Functor0 { |
| 159 | public: |
| 160 | explicit Functor0(const FunctorT& functor) |
| 161 | : functor_(functor) {} |
| 162 | R operator()() const { |
| 163 | return functor_(); } |
| 164 | private: |
| 165 | FunctorT functor_; |
| 166 | }; |
| 167 | |
| 168 | |
| 169 | #define FP_T(x) R (ObjectT::*x)() |
| 170 | |
| 171 | template <class ObjectT, class R> |
| 172 | MethodFunctor0<ObjectT, FP_T(NONAME), R> |
| 173 | Bind(FP_T(method), ObjectT* object) { |
| 174 | return MethodFunctor0<ObjectT, FP_T(NONAME), R>( |
| 175 | method, object); |
| 176 | } |
| 177 | |
| 178 | #undef FP_T |
| 179 | #define FP_T(x) R (ObjectT::*x)() const |
| 180 | |
| 181 | template <class ObjectT, class R> |
| 182 | MethodFunctor0<const ObjectT, FP_T(NONAME), R> |
| 183 | Bind(FP_T(method), const ObjectT* object) { |
| 184 | return MethodFunctor0<const ObjectT, FP_T(NONAME), R>( |
| 185 | method, object); |
| 186 | } |
| 187 | |
| 188 | #undef FP_T |
Magnus Jedvert | d3de9c5 | 2015-08-20 16:03:52 +0200 | [diff] [blame] | 189 | #define FP_T(x) R (ObjectT::*x)() |
| 190 | |
| 191 | template <class ObjectT, class R> |
| 192 | MethodFunctor0<ObjectT, FP_T(NONAME), R> |
| 193 | Bind(FP_T(method), const scoped_refptr<ObjectT>& object) { |
| 194 | return MethodFunctor0<ObjectT, FP_T(NONAME), R>( |
| 195 | method, object.get()); |
| 196 | } |
| 197 | |
| 198 | #undef FP_T |
henrike@webrtc.org | f048872 | 2014-05-13 18:00:26 +0000 | [diff] [blame] | 199 | #define FP_T(x) R (*x)() |
| 200 | |
| 201 | template <class R> |
| 202 | Functor0<FP_T(NONAME), R> |
| 203 | Bind(FP_T(function)) { |
| 204 | return Functor0<FP_T(NONAME), R>( |
| 205 | function); |
| 206 | } |
| 207 | |
| 208 | #undef FP_T |
| 209 | |
| 210 | template <class ObjectT, class MethodT, class R, |
| 211 | class P1> |
| 212 | class MethodFunctor1 { |
| 213 | public: |
| 214 | MethodFunctor1(MethodT method, ObjectT* object, |
| 215 | P1 p1) |
| 216 | : method_(method), object_(object), |
| 217 | p1_(p1) {} |
| 218 | R operator()() const { |
| 219 | return (object_->*method_)(p1_); } |
| 220 | private: |
| 221 | MethodT method_; |
Magnus Jedvert | d3de9c5 | 2015-08-20 16:03:52 +0200 | [diff] [blame] | 222 | typename detail::PointerType<ObjectT>::type object_; |
Magnus Jedvert | b274547 | 2015-08-25 17:56:22 +0200 | [diff] [blame] | 223 | typename detail::RemoveScopedPtrRef<P1>::type p1_; |
henrike@webrtc.org | f048872 | 2014-05-13 18:00:26 +0000 | [diff] [blame] | 224 | }; |
| 225 | |
| 226 | template <class FunctorT, class R, |
| 227 | class P1> |
| 228 | class Functor1 { |
| 229 | public: |
| 230 | Functor1(const FunctorT& functor, P1 p1) |
| 231 | : functor_(functor), |
| 232 | p1_(p1) {} |
| 233 | R operator()() const { |
| 234 | return functor_(p1_); } |
| 235 | private: |
| 236 | FunctorT functor_; |
Magnus Jedvert | b274547 | 2015-08-25 17:56:22 +0200 | [diff] [blame] | 237 | typename detail::RemoveScopedPtrRef<P1>::type p1_; |
henrike@webrtc.org | f048872 | 2014-05-13 18:00:26 +0000 | [diff] [blame] | 238 | }; |
| 239 | |
| 240 | |
| 241 | #define FP_T(x) R (ObjectT::*x)(P1) |
| 242 | |
| 243 | template <class ObjectT, class R, |
| 244 | class P1> |
| 245 | MethodFunctor1<ObjectT, FP_T(NONAME), R, P1> |
| 246 | Bind(FP_T(method), ObjectT* object, |
| 247 | typename detail::identity<P1>::type p1) { |
| 248 | return MethodFunctor1<ObjectT, FP_T(NONAME), R, P1>( |
| 249 | method, object, p1); |
| 250 | } |
| 251 | |
| 252 | #undef FP_T |
| 253 | #define FP_T(x) R (ObjectT::*x)(P1) const |
| 254 | |
| 255 | template <class ObjectT, class R, |
| 256 | class P1> |
| 257 | MethodFunctor1<const ObjectT, FP_T(NONAME), R, P1> |
| 258 | Bind(FP_T(method), const ObjectT* object, |
| 259 | typename detail::identity<P1>::type p1) { |
| 260 | return MethodFunctor1<const ObjectT, FP_T(NONAME), R, P1>( |
| 261 | method, object, p1); |
| 262 | } |
| 263 | |
| 264 | #undef FP_T |
Magnus Jedvert | d3de9c5 | 2015-08-20 16:03:52 +0200 | [diff] [blame] | 265 | #define FP_T(x) R (ObjectT::*x)(P1) |
| 266 | |
| 267 | template <class ObjectT, class R, |
| 268 | class P1> |
| 269 | MethodFunctor1<ObjectT, FP_T(NONAME), R, P1> |
| 270 | Bind(FP_T(method), const scoped_refptr<ObjectT>& object, |
| 271 | typename detail::identity<P1>::type p1) { |
| 272 | return MethodFunctor1<ObjectT, FP_T(NONAME), R, P1>( |
| 273 | method, object.get(), p1); |
| 274 | } |
| 275 | |
| 276 | #undef FP_T |
henrike@webrtc.org | f048872 | 2014-05-13 18:00:26 +0000 | [diff] [blame] | 277 | #define FP_T(x) R (*x)(P1) |
| 278 | |
| 279 | template <class R, |
| 280 | class P1> |
| 281 | Functor1<FP_T(NONAME), R, P1> |
| 282 | Bind(FP_T(function), |
| 283 | typename detail::identity<P1>::type p1) { |
| 284 | return Functor1<FP_T(NONAME), R, P1>( |
| 285 | function, p1); |
| 286 | } |
| 287 | |
| 288 | #undef FP_T |
| 289 | |
| 290 | template <class ObjectT, class MethodT, class R, |
| 291 | class P1, |
| 292 | class P2> |
| 293 | class MethodFunctor2 { |
| 294 | public: |
| 295 | MethodFunctor2(MethodT method, ObjectT* object, |
| 296 | P1 p1, |
| 297 | P2 p2) |
| 298 | : method_(method), object_(object), |
| 299 | p1_(p1), |
| 300 | p2_(p2) {} |
| 301 | R operator()() const { |
| 302 | return (object_->*method_)(p1_, p2_); } |
| 303 | private: |
| 304 | MethodT method_; |
Magnus Jedvert | d3de9c5 | 2015-08-20 16:03:52 +0200 | [diff] [blame] | 305 | typename detail::PointerType<ObjectT>::type object_; |
Magnus Jedvert | b274547 | 2015-08-25 17:56:22 +0200 | [diff] [blame] | 306 | typename detail::RemoveScopedPtrRef<P1>::type p1_; |
| 307 | typename detail::RemoveScopedPtrRef<P2>::type p2_; |
henrike@webrtc.org | f048872 | 2014-05-13 18:00:26 +0000 | [diff] [blame] | 308 | }; |
| 309 | |
| 310 | template <class FunctorT, class R, |
| 311 | class P1, |
| 312 | class P2> |
| 313 | class Functor2 { |
| 314 | public: |
| 315 | Functor2(const FunctorT& functor, P1 p1, P2 p2) |
| 316 | : functor_(functor), |
| 317 | p1_(p1), |
| 318 | p2_(p2) {} |
| 319 | R operator()() const { |
| 320 | return functor_(p1_, p2_); } |
| 321 | private: |
| 322 | FunctorT functor_; |
Magnus Jedvert | b274547 | 2015-08-25 17:56:22 +0200 | [diff] [blame] | 323 | typename detail::RemoveScopedPtrRef<P1>::type p1_; |
| 324 | typename detail::RemoveScopedPtrRef<P2>::type p2_; |
henrike@webrtc.org | f048872 | 2014-05-13 18:00:26 +0000 | [diff] [blame] | 325 | }; |
| 326 | |
| 327 | |
| 328 | #define FP_T(x) R (ObjectT::*x)(P1, P2) |
| 329 | |
| 330 | template <class ObjectT, class R, |
| 331 | class P1, |
| 332 | class P2> |
| 333 | MethodFunctor2<ObjectT, FP_T(NONAME), R, P1, P2> |
| 334 | Bind(FP_T(method), ObjectT* object, |
| 335 | typename detail::identity<P1>::type p1, |
| 336 | typename detail::identity<P2>::type p2) { |
| 337 | return MethodFunctor2<ObjectT, FP_T(NONAME), R, P1, P2>( |
| 338 | method, object, p1, p2); |
| 339 | } |
| 340 | |
| 341 | #undef FP_T |
| 342 | #define FP_T(x) R (ObjectT::*x)(P1, P2) const |
| 343 | |
| 344 | template <class ObjectT, class R, |
| 345 | class P1, |
| 346 | class P2> |
| 347 | MethodFunctor2<const ObjectT, FP_T(NONAME), R, P1, P2> |
| 348 | Bind(FP_T(method), const ObjectT* object, |
| 349 | typename detail::identity<P1>::type p1, |
| 350 | typename detail::identity<P2>::type p2) { |
| 351 | return MethodFunctor2<const ObjectT, FP_T(NONAME), R, P1, P2>( |
| 352 | method, object, p1, p2); |
| 353 | } |
| 354 | |
| 355 | #undef FP_T |
Magnus Jedvert | d3de9c5 | 2015-08-20 16:03:52 +0200 | [diff] [blame] | 356 | #define FP_T(x) R (ObjectT::*x)(P1, P2) |
| 357 | |
| 358 | template <class ObjectT, class R, |
| 359 | class P1, |
| 360 | class P2> |
| 361 | MethodFunctor2<ObjectT, FP_T(NONAME), R, P1, P2> |
| 362 | Bind(FP_T(method), const scoped_refptr<ObjectT>& object, |
| 363 | typename detail::identity<P1>::type p1, |
| 364 | typename detail::identity<P2>::type p2) { |
| 365 | return MethodFunctor2<ObjectT, FP_T(NONAME), R, P1, P2>( |
| 366 | method, object.get(), p1, p2); |
| 367 | } |
| 368 | |
| 369 | #undef FP_T |
henrike@webrtc.org | f048872 | 2014-05-13 18:00:26 +0000 | [diff] [blame] | 370 | #define FP_T(x) R (*x)(P1, P2) |
| 371 | |
| 372 | template <class R, |
| 373 | class P1, |
| 374 | class P2> |
| 375 | Functor2<FP_T(NONAME), R, P1, P2> |
| 376 | Bind(FP_T(function), |
| 377 | typename detail::identity<P1>::type p1, |
| 378 | typename detail::identity<P2>::type p2) { |
| 379 | return Functor2<FP_T(NONAME), R, P1, P2>( |
| 380 | function, p1, p2); |
| 381 | } |
| 382 | |
| 383 | #undef FP_T |
| 384 | |
| 385 | template <class ObjectT, class MethodT, class R, |
| 386 | class P1, |
| 387 | class P2, |
| 388 | class P3> |
| 389 | class MethodFunctor3 { |
| 390 | public: |
| 391 | MethodFunctor3(MethodT method, ObjectT* object, |
| 392 | P1 p1, |
| 393 | P2 p2, |
| 394 | P3 p3) |
| 395 | : method_(method), object_(object), |
| 396 | p1_(p1), |
| 397 | p2_(p2), |
| 398 | p3_(p3) {} |
| 399 | R operator()() const { |
| 400 | return (object_->*method_)(p1_, p2_, p3_); } |
| 401 | private: |
| 402 | MethodT method_; |
Magnus Jedvert | d3de9c5 | 2015-08-20 16:03:52 +0200 | [diff] [blame] | 403 | typename detail::PointerType<ObjectT>::type object_; |
Magnus Jedvert | b274547 | 2015-08-25 17:56:22 +0200 | [diff] [blame] | 404 | typename detail::RemoveScopedPtrRef<P1>::type p1_; |
| 405 | typename detail::RemoveScopedPtrRef<P2>::type p2_; |
| 406 | typename detail::RemoveScopedPtrRef<P3>::type p3_; |
henrike@webrtc.org | f048872 | 2014-05-13 18:00:26 +0000 | [diff] [blame] | 407 | }; |
| 408 | |
| 409 | template <class FunctorT, class R, |
| 410 | class P1, |
| 411 | class P2, |
| 412 | class P3> |
| 413 | class Functor3 { |
| 414 | public: |
| 415 | Functor3(const FunctorT& functor, P1 p1, P2 p2, P3 p3) |
| 416 | : functor_(functor), |
| 417 | p1_(p1), |
| 418 | p2_(p2), |
| 419 | p3_(p3) {} |
| 420 | R operator()() const { |
| 421 | return functor_(p1_, p2_, p3_); } |
| 422 | private: |
| 423 | FunctorT functor_; |
Magnus Jedvert | b274547 | 2015-08-25 17:56:22 +0200 | [diff] [blame] | 424 | typename detail::RemoveScopedPtrRef<P1>::type p1_; |
| 425 | typename detail::RemoveScopedPtrRef<P2>::type p2_; |
| 426 | typename detail::RemoveScopedPtrRef<P3>::type p3_; |
henrike@webrtc.org | f048872 | 2014-05-13 18:00:26 +0000 | [diff] [blame] | 427 | }; |
| 428 | |
| 429 | |
| 430 | #define FP_T(x) R (ObjectT::*x)(P1, P2, P3) |
| 431 | |
| 432 | template <class ObjectT, class R, |
| 433 | class P1, |
| 434 | class P2, |
| 435 | class P3> |
| 436 | MethodFunctor3<ObjectT, FP_T(NONAME), R, P1, P2, P3> |
| 437 | Bind(FP_T(method), ObjectT* object, |
| 438 | typename detail::identity<P1>::type p1, |
| 439 | typename detail::identity<P2>::type p2, |
| 440 | typename detail::identity<P3>::type p3) { |
| 441 | return MethodFunctor3<ObjectT, FP_T(NONAME), R, P1, P2, P3>( |
| 442 | method, object, p1, p2, p3); |
| 443 | } |
| 444 | |
| 445 | #undef FP_T |
| 446 | #define FP_T(x) R (ObjectT::*x)(P1, P2, P3) const |
| 447 | |
| 448 | template <class ObjectT, class R, |
| 449 | class P1, |
| 450 | class P2, |
| 451 | class P3> |
| 452 | MethodFunctor3<const ObjectT, FP_T(NONAME), R, P1, P2, P3> |
| 453 | Bind(FP_T(method), const ObjectT* object, |
| 454 | typename detail::identity<P1>::type p1, |
| 455 | typename detail::identity<P2>::type p2, |
| 456 | typename detail::identity<P3>::type p3) { |
| 457 | return MethodFunctor3<const ObjectT, FP_T(NONAME), R, P1, P2, P3>( |
| 458 | method, object, p1, p2, p3); |
| 459 | } |
| 460 | |
| 461 | #undef FP_T |
Magnus Jedvert | d3de9c5 | 2015-08-20 16:03:52 +0200 | [diff] [blame] | 462 | #define FP_T(x) R (ObjectT::*x)(P1, P2, P3) |
| 463 | |
| 464 | template <class ObjectT, class R, |
| 465 | class P1, |
| 466 | class P2, |
| 467 | class P3> |
| 468 | MethodFunctor3<ObjectT, FP_T(NONAME), R, P1, P2, P3> |
| 469 | Bind(FP_T(method), const scoped_refptr<ObjectT>& object, |
| 470 | typename detail::identity<P1>::type p1, |
| 471 | typename detail::identity<P2>::type p2, |
| 472 | typename detail::identity<P3>::type p3) { |
| 473 | return MethodFunctor3<ObjectT, FP_T(NONAME), R, P1, P2, P3>( |
| 474 | method, object.get(), p1, p2, p3); |
| 475 | } |
| 476 | |
| 477 | #undef FP_T |
henrike@webrtc.org | f048872 | 2014-05-13 18:00:26 +0000 | [diff] [blame] | 478 | #define FP_T(x) R (*x)(P1, P2, P3) |
| 479 | |
| 480 | template <class R, |
| 481 | class P1, |
| 482 | class P2, |
| 483 | class P3> |
| 484 | Functor3<FP_T(NONAME), R, P1, P2, P3> |
| 485 | Bind(FP_T(function), |
| 486 | typename detail::identity<P1>::type p1, |
| 487 | typename detail::identity<P2>::type p2, |
| 488 | typename detail::identity<P3>::type p3) { |
| 489 | return Functor3<FP_T(NONAME), R, P1, P2, P3>( |
| 490 | function, p1, p2, p3); |
| 491 | } |
| 492 | |
| 493 | #undef FP_T |
| 494 | |
| 495 | template <class ObjectT, class MethodT, class R, |
| 496 | class P1, |
| 497 | class P2, |
| 498 | class P3, |
| 499 | class P4> |
| 500 | class MethodFunctor4 { |
| 501 | public: |
| 502 | MethodFunctor4(MethodT method, ObjectT* object, |
| 503 | P1 p1, |
| 504 | P2 p2, |
| 505 | P3 p3, |
| 506 | P4 p4) |
| 507 | : method_(method), object_(object), |
| 508 | p1_(p1), |
| 509 | p2_(p2), |
| 510 | p3_(p3), |
| 511 | p4_(p4) {} |
| 512 | R operator()() const { |
| 513 | return (object_->*method_)(p1_, p2_, p3_, p4_); } |
| 514 | private: |
| 515 | MethodT method_; |
Magnus Jedvert | d3de9c5 | 2015-08-20 16:03:52 +0200 | [diff] [blame] | 516 | typename detail::PointerType<ObjectT>::type object_; |
Magnus Jedvert | b274547 | 2015-08-25 17:56:22 +0200 | [diff] [blame] | 517 | typename detail::RemoveScopedPtrRef<P1>::type p1_; |
| 518 | typename detail::RemoveScopedPtrRef<P2>::type p2_; |
| 519 | typename detail::RemoveScopedPtrRef<P3>::type p3_; |
| 520 | typename detail::RemoveScopedPtrRef<P4>::type p4_; |
henrike@webrtc.org | f048872 | 2014-05-13 18:00:26 +0000 | [diff] [blame] | 521 | }; |
| 522 | |
| 523 | template <class FunctorT, class R, |
| 524 | class P1, |
| 525 | class P2, |
| 526 | class P3, |
| 527 | class P4> |
| 528 | class Functor4 { |
| 529 | public: |
| 530 | Functor4(const FunctorT& functor, P1 p1, P2 p2, P3 p3, P4 p4) |
| 531 | : functor_(functor), |
| 532 | p1_(p1), |
| 533 | p2_(p2), |
| 534 | p3_(p3), |
| 535 | p4_(p4) {} |
| 536 | R operator()() const { |
| 537 | return functor_(p1_, p2_, p3_, p4_); } |
| 538 | private: |
| 539 | FunctorT functor_; |
Magnus Jedvert | b274547 | 2015-08-25 17:56:22 +0200 | [diff] [blame] | 540 | typename detail::RemoveScopedPtrRef<P1>::type p1_; |
| 541 | typename detail::RemoveScopedPtrRef<P2>::type p2_; |
| 542 | typename detail::RemoveScopedPtrRef<P3>::type p3_; |
| 543 | typename detail::RemoveScopedPtrRef<P4>::type p4_; |
henrike@webrtc.org | f048872 | 2014-05-13 18:00:26 +0000 | [diff] [blame] | 544 | }; |
| 545 | |
| 546 | |
| 547 | #define FP_T(x) R (ObjectT::*x)(P1, P2, P3, P4) |
| 548 | |
| 549 | template <class ObjectT, class R, |
| 550 | class P1, |
| 551 | class P2, |
| 552 | class P3, |
| 553 | class P4> |
| 554 | MethodFunctor4<ObjectT, FP_T(NONAME), R, P1, P2, P3, P4> |
| 555 | Bind(FP_T(method), ObjectT* object, |
| 556 | typename detail::identity<P1>::type p1, |
| 557 | typename detail::identity<P2>::type p2, |
| 558 | typename detail::identity<P3>::type p3, |
| 559 | typename detail::identity<P4>::type p4) { |
| 560 | return MethodFunctor4<ObjectT, FP_T(NONAME), R, P1, P2, P3, P4>( |
| 561 | method, object, p1, p2, p3, p4); |
| 562 | } |
| 563 | |
| 564 | #undef FP_T |
| 565 | #define FP_T(x) R (ObjectT::*x)(P1, P2, P3, P4) const |
| 566 | |
| 567 | template <class ObjectT, class R, |
| 568 | class P1, |
| 569 | class P2, |
| 570 | class P3, |
| 571 | class P4> |
| 572 | MethodFunctor4<const ObjectT, FP_T(NONAME), R, P1, P2, P3, P4> |
| 573 | Bind(FP_T(method), const ObjectT* object, |
| 574 | typename detail::identity<P1>::type p1, |
| 575 | typename detail::identity<P2>::type p2, |
| 576 | typename detail::identity<P3>::type p3, |
| 577 | typename detail::identity<P4>::type p4) { |
| 578 | return MethodFunctor4<const ObjectT, FP_T(NONAME), R, P1, P2, P3, P4>( |
| 579 | method, object, p1, p2, p3, p4); |
| 580 | } |
| 581 | |
| 582 | #undef FP_T |
Magnus Jedvert | d3de9c5 | 2015-08-20 16:03:52 +0200 | [diff] [blame] | 583 | #define FP_T(x) R (ObjectT::*x)(P1, P2, P3, P4) |
| 584 | |
| 585 | template <class ObjectT, class R, |
| 586 | class P1, |
| 587 | class P2, |
| 588 | class P3, |
| 589 | class P4> |
| 590 | MethodFunctor4<ObjectT, FP_T(NONAME), R, P1, P2, P3, P4> |
| 591 | Bind(FP_T(method), const scoped_refptr<ObjectT>& object, |
| 592 | typename detail::identity<P1>::type p1, |
| 593 | typename detail::identity<P2>::type p2, |
| 594 | typename detail::identity<P3>::type p3, |
| 595 | typename detail::identity<P4>::type p4) { |
| 596 | return MethodFunctor4<ObjectT, FP_T(NONAME), R, P1, P2, P3, P4>( |
| 597 | method, object.get(), p1, p2, p3, p4); |
| 598 | } |
| 599 | |
| 600 | #undef FP_T |
henrike@webrtc.org | f048872 | 2014-05-13 18:00:26 +0000 | [diff] [blame] | 601 | #define FP_T(x) R (*x)(P1, P2, P3, P4) |
| 602 | |
| 603 | template <class R, |
| 604 | class P1, |
| 605 | class P2, |
| 606 | class P3, |
| 607 | class P4> |
| 608 | Functor4<FP_T(NONAME), R, P1, P2, P3, P4> |
| 609 | Bind(FP_T(function), |
| 610 | typename detail::identity<P1>::type p1, |
| 611 | typename detail::identity<P2>::type p2, |
| 612 | typename detail::identity<P3>::type p3, |
| 613 | typename detail::identity<P4>::type p4) { |
| 614 | return Functor4<FP_T(NONAME), R, P1, P2, P3, P4>( |
| 615 | function, p1, p2, p3, p4); |
| 616 | } |
| 617 | |
| 618 | #undef FP_T |
| 619 | |
| 620 | template <class ObjectT, class MethodT, class R, |
| 621 | class P1, |
| 622 | class P2, |
| 623 | class P3, |
| 624 | class P4, |
| 625 | class P5> |
| 626 | class MethodFunctor5 { |
| 627 | public: |
| 628 | MethodFunctor5(MethodT method, ObjectT* object, |
| 629 | P1 p1, |
| 630 | P2 p2, |
| 631 | P3 p3, |
| 632 | P4 p4, |
| 633 | P5 p5) |
| 634 | : method_(method), object_(object), |
| 635 | p1_(p1), |
| 636 | p2_(p2), |
| 637 | p3_(p3), |
| 638 | p4_(p4), |
| 639 | p5_(p5) {} |
| 640 | R operator()() const { |
| 641 | return (object_->*method_)(p1_, p2_, p3_, p4_, p5_); } |
| 642 | private: |
| 643 | MethodT method_; |
Magnus Jedvert | d3de9c5 | 2015-08-20 16:03:52 +0200 | [diff] [blame] | 644 | typename detail::PointerType<ObjectT>::type object_; |
Magnus Jedvert | b274547 | 2015-08-25 17:56:22 +0200 | [diff] [blame] | 645 | typename detail::RemoveScopedPtrRef<P1>::type p1_; |
| 646 | typename detail::RemoveScopedPtrRef<P2>::type p2_; |
| 647 | typename detail::RemoveScopedPtrRef<P3>::type p3_; |
| 648 | typename detail::RemoveScopedPtrRef<P4>::type p4_; |
| 649 | typename detail::RemoveScopedPtrRef<P5>::type p5_; |
henrike@webrtc.org | f048872 | 2014-05-13 18:00:26 +0000 | [diff] [blame] | 650 | }; |
| 651 | |
| 652 | template <class FunctorT, class R, |
| 653 | class P1, |
| 654 | class P2, |
| 655 | class P3, |
| 656 | class P4, |
| 657 | class P5> |
| 658 | class Functor5 { |
| 659 | public: |
| 660 | Functor5(const FunctorT& functor, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) |
| 661 | : functor_(functor), |
| 662 | p1_(p1), |
| 663 | p2_(p2), |
| 664 | p3_(p3), |
| 665 | p4_(p4), |
| 666 | p5_(p5) {} |
| 667 | R operator()() const { |
| 668 | return functor_(p1_, p2_, p3_, p4_, p5_); } |
| 669 | private: |
| 670 | FunctorT functor_; |
Magnus Jedvert | b274547 | 2015-08-25 17:56:22 +0200 | [diff] [blame] | 671 | typename detail::RemoveScopedPtrRef<P1>::type p1_; |
| 672 | typename detail::RemoveScopedPtrRef<P2>::type p2_; |
| 673 | typename detail::RemoveScopedPtrRef<P3>::type p3_; |
| 674 | typename detail::RemoveScopedPtrRef<P4>::type p4_; |
| 675 | typename detail::RemoveScopedPtrRef<P5>::type p5_; |
henrike@webrtc.org | f048872 | 2014-05-13 18:00:26 +0000 | [diff] [blame] | 676 | }; |
| 677 | |
| 678 | |
| 679 | #define FP_T(x) R (ObjectT::*x)(P1, P2, P3, P4, P5) |
| 680 | |
| 681 | template <class ObjectT, class R, |
| 682 | class P1, |
| 683 | class P2, |
| 684 | class P3, |
| 685 | class P4, |
| 686 | class P5> |
| 687 | MethodFunctor5<ObjectT, FP_T(NONAME), R, P1, P2, P3, P4, P5> |
| 688 | Bind(FP_T(method), ObjectT* object, |
| 689 | typename detail::identity<P1>::type p1, |
| 690 | typename detail::identity<P2>::type p2, |
| 691 | typename detail::identity<P3>::type p3, |
| 692 | typename detail::identity<P4>::type p4, |
| 693 | typename detail::identity<P5>::type p5) { |
| 694 | return MethodFunctor5<ObjectT, FP_T(NONAME), R, P1, P2, P3, P4, P5>( |
| 695 | method, object, p1, p2, p3, p4, p5); |
| 696 | } |
| 697 | |
| 698 | #undef FP_T |
| 699 | #define FP_T(x) R (ObjectT::*x)(P1, P2, P3, P4, P5) const |
| 700 | |
| 701 | template <class ObjectT, class R, |
| 702 | class P1, |
| 703 | class P2, |
| 704 | class P3, |
| 705 | class P4, |
| 706 | class P5> |
| 707 | MethodFunctor5<const ObjectT, FP_T(NONAME), R, P1, P2, P3, P4, P5> |
| 708 | Bind(FP_T(method), const ObjectT* object, |
| 709 | typename detail::identity<P1>::type p1, |
| 710 | typename detail::identity<P2>::type p2, |
| 711 | typename detail::identity<P3>::type p3, |
| 712 | typename detail::identity<P4>::type p4, |
| 713 | typename detail::identity<P5>::type p5) { |
| 714 | return MethodFunctor5<const ObjectT, FP_T(NONAME), R, P1, P2, P3, P4, P5>( |
| 715 | method, object, p1, p2, p3, p4, p5); |
| 716 | } |
| 717 | |
| 718 | #undef FP_T |
Magnus Jedvert | d3de9c5 | 2015-08-20 16:03:52 +0200 | [diff] [blame] | 719 | #define FP_T(x) R (ObjectT::*x)(P1, P2, P3, P4, P5) |
| 720 | |
| 721 | template <class ObjectT, class R, |
| 722 | class P1, |
| 723 | class P2, |
| 724 | class P3, |
| 725 | class P4, |
| 726 | class P5> |
| 727 | MethodFunctor5<ObjectT, FP_T(NONAME), R, P1, P2, P3, P4, P5> |
| 728 | Bind(FP_T(method), const scoped_refptr<ObjectT>& object, |
| 729 | typename detail::identity<P1>::type p1, |
| 730 | typename detail::identity<P2>::type p2, |
| 731 | typename detail::identity<P3>::type p3, |
| 732 | typename detail::identity<P4>::type p4, |
| 733 | typename detail::identity<P5>::type p5) { |
| 734 | return MethodFunctor5<ObjectT, FP_T(NONAME), R, P1, P2, P3, P4, P5>( |
| 735 | method, object.get(), p1, p2, p3, p4, p5); |
| 736 | } |
| 737 | |
| 738 | #undef FP_T |
henrike@webrtc.org | f048872 | 2014-05-13 18:00:26 +0000 | [diff] [blame] | 739 | #define FP_T(x) R (*x)(P1, P2, P3, P4, P5) |
| 740 | |
| 741 | template <class R, |
| 742 | class P1, |
| 743 | class P2, |
| 744 | class P3, |
| 745 | class P4, |
| 746 | class P5> |
| 747 | Functor5<FP_T(NONAME), R, P1, P2, P3, P4, P5> |
| 748 | Bind(FP_T(function), |
| 749 | typename detail::identity<P1>::type p1, |
| 750 | typename detail::identity<P2>::type p2, |
| 751 | typename detail::identity<P3>::type p3, |
| 752 | typename detail::identity<P4>::type p4, |
| 753 | typename detail::identity<P5>::type p5) { |
| 754 | return Functor5<FP_T(NONAME), R, P1, P2, P3, P4, P5>( |
| 755 | function, p1, p2, p3, p4, p5); |
| 756 | } |
| 757 | |
| 758 | #undef FP_T |
Fredrik Solenberg | c937139 | 2015-08-06 12:40:53 +0200 | [diff] [blame] | 759 | |
| 760 | template <class ObjectT, class MethodT, class R, |
Jelena Marusic | 5d6e58e | 2015-07-13 11:16:39 +0200 | [diff] [blame] | 761 | class P1, |
| 762 | class P2, |
| 763 | class P3, |
| 764 | class P4, |
| 765 | class P5, |
| 766 | class P6> |
| 767 | class MethodFunctor6 { |
| 768 | public: |
Fredrik Solenberg | c937139 | 2015-08-06 12:40:53 +0200 | [diff] [blame] | 769 | MethodFunctor6(MethodT method, ObjectT* object, |
Jelena Marusic | 5d6e58e | 2015-07-13 11:16:39 +0200 | [diff] [blame] | 770 | P1 p1, |
| 771 | P2 p2, |
| 772 | P3 p3, |
| 773 | P4 p4, |
| 774 | P5 p5, |
| 775 | P6 p6) |
Fredrik Solenberg | c937139 | 2015-08-06 12:40:53 +0200 | [diff] [blame] | 776 | : method_(method), object_(object), |
| 777 | p1_(p1), |
| 778 | p2_(p2), |
| 779 | p3_(p3), |
| 780 | p4_(p4), |
| 781 | p5_(p5), |
| 782 | p6_(p6) {} |
Jelena Marusic | 5d6e58e | 2015-07-13 11:16:39 +0200 | [diff] [blame] | 783 | R operator()() const { |
Fredrik Solenberg | c937139 | 2015-08-06 12:40:53 +0200 | [diff] [blame] | 784 | return (object_->*method_)(p1_, p2_, p3_, p4_, p5_, p6_); } |
Jelena Marusic | 5d6e58e | 2015-07-13 11:16:39 +0200 | [diff] [blame] | 785 | private: |
| 786 | MethodT method_; |
Magnus Jedvert | d3de9c5 | 2015-08-20 16:03:52 +0200 | [diff] [blame] | 787 | typename detail::PointerType<ObjectT>::type object_; |
Magnus Jedvert | b274547 | 2015-08-25 17:56:22 +0200 | [diff] [blame] | 788 | typename detail::RemoveScopedPtrRef<P1>::type p1_; |
| 789 | typename detail::RemoveScopedPtrRef<P2>::type p2_; |
| 790 | typename detail::RemoveScopedPtrRef<P3>::type p3_; |
| 791 | typename detail::RemoveScopedPtrRef<P4>::type p4_; |
| 792 | typename detail::RemoveScopedPtrRef<P5>::type p5_; |
| 793 | typename detail::RemoveScopedPtrRef<P6>::type p6_; |
Jelena Marusic | 5d6e58e | 2015-07-13 11:16:39 +0200 | [diff] [blame] | 794 | }; |
| 795 | |
Fredrik Solenberg | c937139 | 2015-08-06 12:40:53 +0200 | [diff] [blame] | 796 | template <class FunctorT, class R, |
Jelena Marusic | 5d6e58e | 2015-07-13 11:16:39 +0200 | [diff] [blame] | 797 | class P1, |
| 798 | class P2, |
| 799 | class P3, |
| 800 | class P4, |
| 801 | class P5, |
| 802 | class P6> |
| 803 | class Functor6 { |
| 804 | public: |
| 805 | Functor6(const FunctorT& functor, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6) |
| 806 | : functor_(functor), |
Fredrik Solenberg | c937139 | 2015-08-06 12:40:53 +0200 | [diff] [blame] | 807 | p1_(p1), |
| 808 | p2_(p2), |
| 809 | p3_(p3), |
| 810 | p4_(p4), |
| 811 | p5_(p5), |
| 812 | p6_(p6) {} |
| 813 | R operator()() const { |
| 814 | return functor_(p1_, p2_, p3_, p4_, p5_, p6_); } |
Jelena Marusic | 5d6e58e | 2015-07-13 11:16:39 +0200 | [diff] [blame] | 815 | private: |
| 816 | FunctorT functor_; |
Magnus Jedvert | b274547 | 2015-08-25 17:56:22 +0200 | [diff] [blame] | 817 | typename detail::RemoveScopedPtrRef<P1>::type p1_; |
| 818 | typename detail::RemoveScopedPtrRef<P2>::type p2_; |
| 819 | typename detail::RemoveScopedPtrRef<P3>::type p3_; |
| 820 | typename detail::RemoveScopedPtrRef<P4>::type p4_; |
| 821 | typename detail::RemoveScopedPtrRef<P5>::type p5_; |
| 822 | typename detail::RemoveScopedPtrRef<P6>::type p6_; |
Jelena Marusic | 5d6e58e | 2015-07-13 11:16:39 +0200 | [diff] [blame] | 823 | }; |
| 824 | |
Fredrik Solenberg | c937139 | 2015-08-06 12:40:53 +0200 | [diff] [blame] | 825 | |
Jelena Marusic | 5d6e58e | 2015-07-13 11:16:39 +0200 | [diff] [blame] | 826 | #define FP_T(x) R (ObjectT::*x)(P1, P2, P3, P4, P5, P6) |
| 827 | |
Fredrik Solenberg | c937139 | 2015-08-06 12:40:53 +0200 | [diff] [blame] | 828 | template <class ObjectT, class R, |
Jelena Marusic | 5d6e58e | 2015-07-13 11:16:39 +0200 | [diff] [blame] | 829 | class P1, |
| 830 | class P2, |
| 831 | class P3, |
| 832 | class P4, |
| 833 | class P5, |
| 834 | class P6> |
Fredrik Solenberg | c937139 | 2015-08-06 12:40:53 +0200 | [diff] [blame] | 835 | MethodFunctor6<ObjectT, FP_T(NONAME), R, P1, P2, P3, P4, P5, P6> |
| 836 | Bind(FP_T(method), ObjectT* object, |
| 837 | typename detail::identity<P1>::type p1, |
| 838 | typename detail::identity<P2>::type p2, |
| 839 | typename detail::identity<P3>::type p3, |
| 840 | typename detail::identity<P4>::type p4, |
| 841 | typename detail::identity<P5>::type p5, |
| 842 | typename detail::identity<P6>::type p6) { |
Jelena Marusic | 5d6e58e | 2015-07-13 11:16:39 +0200 | [diff] [blame] | 843 | return MethodFunctor6<ObjectT, FP_T(NONAME), R, P1, P2, P3, P4, P5, P6>( |
| 844 | method, object, p1, p2, p3, p4, p5, p6); |
| 845 | } |
| 846 | |
| 847 | #undef FP_T |
| 848 | #define FP_T(x) R (ObjectT::*x)(P1, P2, P3, P4, P5, P6) const |
| 849 | |
Fredrik Solenberg | c937139 | 2015-08-06 12:40:53 +0200 | [diff] [blame] | 850 | template <class ObjectT, class R, |
Jelena Marusic | 5d6e58e | 2015-07-13 11:16:39 +0200 | [diff] [blame] | 851 | class P1, |
| 852 | class P2, |
| 853 | class P3, |
| 854 | class P4, |
| 855 | class P5, |
| 856 | class P6> |
Fredrik Solenberg | c937139 | 2015-08-06 12:40:53 +0200 | [diff] [blame] | 857 | MethodFunctor6<const ObjectT, FP_T(NONAME), R, P1, P2, P3, P4, P5, P6> |
| 858 | Bind(FP_T(method), const ObjectT* object, |
| 859 | typename detail::identity<P1>::type p1, |
| 860 | typename detail::identity<P2>::type p2, |
| 861 | typename detail::identity<P3>::type p3, |
| 862 | typename detail::identity<P4>::type p4, |
| 863 | typename detail::identity<P5>::type p5, |
| 864 | typename detail::identity<P6>::type p6) { |
Jelena Marusic | 5d6e58e | 2015-07-13 11:16:39 +0200 | [diff] [blame] | 865 | return MethodFunctor6<const ObjectT, FP_T(NONAME), R, P1, P2, P3, P4, P5, P6>( |
| 866 | method, object, p1, p2, p3, p4, p5, p6); |
| 867 | } |
| 868 | |
| 869 | #undef FP_T |
Magnus Jedvert | d3de9c5 | 2015-08-20 16:03:52 +0200 | [diff] [blame] | 870 | #define FP_T(x) R (ObjectT::*x)(P1, P2, P3, P4, P5, P6) |
| 871 | |
| 872 | template <class ObjectT, class R, |
| 873 | class P1, |
| 874 | class P2, |
| 875 | class P3, |
| 876 | class P4, |
| 877 | class P5, |
| 878 | class P6> |
| 879 | MethodFunctor6<ObjectT, FP_T(NONAME), R, P1, P2, P3, P4, P5, P6> |
| 880 | Bind(FP_T(method), const scoped_refptr<ObjectT>& object, |
| 881 | typename detail::identity<P1>::type p1, |
| 882 | typename detail::identity<P2>::type p2, |
| 883 | typename detail::identity<P3>::type p3, |
| 884 | typename detail::identity<P4>::type p4, |
| 885 | typename detail::identity<P5>::type p5, |
| 886 | typename detail::identity<P6>::type p6) { |
| 887 | return MethodFunctor6<ObjectT, FP_T(NONAME), R, P1, P2, P3, P4, P5, P6>( |
| 888 | method, object.get(), p1, p2, p3, p4, p5, p6); |
| 889 | } |
| 890 | |
| 891 | #undef FP_T |
Jelena Marusic | 5d6e58e | 2015-07-13 11:16:39 +0200 | [diff] [blame] | 892 | #define FP_T(x) R (*x)(P1, P2, P3, P4, P5, P6) |
| 893 | |
Fredrik Solenberg | c937139 | 2015-08-06 12:40:53 +0200 | [diff] [blame] | 894 | template <class R, |
| 895 | class P1, |
| 896 | class P2, |
| 897 | class P3, |
| 898 | class P4, |
| 899 | class P5, |
| 900 | class P6> |
| 901 | Functor6<FP_T(NONAME), R, P1, P2, P3, P4, P5, P6> |
| 902 | Bind(FP_T(function), |
| 903 | typename detail::identity<P1>::type p1, |
| 904 | typename detail::identity<P2>::type p2, |
| 905 | typename detail::identity<P3>::type p3, |
| 906 | typename detail::identity<P4>::type p4, |
| 907 | typename detail::identity<P5>::type p5, |
| 908 | typename detail::identity<P6>::type p6) { |
| 909 | return Functor6<FP_T(NONAME), R, P1, P2, P3, P4, P5, P6>( |
| 910 | function, p1, p2, p3, p4, p5, p6); |
Jelena Marusic | 5d6e58e | 2015-07-13 11:16:39 +0200 | [diff] [blame] | 911 | } |
| 912 | |
| 913 | #undef FP_T |
henrike@webrtc.org | f048872 | 2014-05-13 18:00:26 +0000 | [diff] [blame] | 914 | |
| 915 | } // namespace rtc |
| 916 | |
| 917 | #undef NONAME |
| 918 | |
| 919 | #endif // WEBRTC_BASE_BIND_H_ |