Wed, 31 Dec 2014 07:16:47 +0100
Revert simplistic fix pending revisit of Mozilla integration attempt.
michael@0 | 1 | // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
michael@0 | 2 | // Use of this source code is governed by a BSD-style license that can be |
michael@0 | 3 | // found in the LICENSE file. |
michael@0 | 4 | |
michael@0 | 5 | // A Tuple is a generic templatized container, similar in concept to std::pair. |
michael@0 | 6 | // There are classes Tuple0 to Tuple6, cooresponding to the number of elements |
michael@0 | 7 | // it contains. The convenient MakeTuple() function takes 0 to 6 arguments, |
michael@0 | 8 | // and will construct and return the appropriate Tuple object. The functions |
michael@0 | 9 | // DispatchToMethod and DispatchToFunction take a function pointer or instance |
michael@0 | 10 | // and method pointer, and unpack a tuple into arguments to the call. |
michael@0 | 11 | // |
michael@0 | 12 | // Tuple elements are copied by value, and stored in the tuple. See the unit |
michael@0 | 13 | // tests for more details of how/when the values are copied. |
michael@0 | 14 | // |
michael@0 | 15 | // Example usage: |
michael@0 | 16 | // // These two methods of creating a Tuple are identical. |
michael@0 | 17 | // Tuple2<int, const char*> tuple_a(1, "wee"); |
michael@0 | 18 | // Tuple2<int, const char*> tuple_b = MakeTuple(1, "wee"); |
michael@0 | 19 | // |
michael@0 | 20 | // void SomeFunc(int a, const char* b) { } |
michael@0 | 21 | // DispatchToFunction(&SomeFunc, tuple_a); // SomeFunc(1, "wee") |
michael@0 | 22 | // DispatchToFunction( |
michael@0 | 23 | // &SomeFunc, MakeTuple(10, "foo")); // SomeFunc(10, "foo") |
michael@0 | 24 | // |
michael@0 | 25 | // struct { void SomeMeth(int a, int b, int c) { } } foo; |
michael@0 | 26 | // DispatchToMethod(&foo, &Foo::SomeMeth, MakeTuple(1, 2, 3)); |
michael@0 | 27 | // // foo->SomeMeth(1, 2, 3); |
michael@0 | 28 | |
michael@0 | 29 | #ifndef BASE_TUPLE_H__ |
michael@0 | 30 | #define BASE_TUPLE_H__ |
michael@0 | 31 | |
michael@0 | 32 | #include "base/bind_helpers.h" |
michael@0 | 33 | |
michael@0 | 34 | // Traits ---------------------------------------------------------------------- |
michael@0 | 35 | // |
michael@0 | 36 | // A simple traits class for tuple arguments. |
michael@0 | 37 | // |
michael@0 | 38 | // ValueType: the bare, nonref version of a type (same as the type for nonrefs). |
michael@0 | 39 | // RefType: the ref version of a type (same as the type for refs). |
michael@0 | 40 | // ParamType: what type to pass to functions (refs should not be constified). |
michael@0 | 41 | |
michael@0 | 42 | template <class P> |
michael@0 | 43 | struct TupleTraits { |
michael@0 | 44 | typedef P ValueType; |
michael@0 | 45 | typedef P& RefType; |
michael@0 | 46 | typedef const P& ParamType; |
michael@0 | 47 | }; |
michael@0 | 48 | |
michael@0 | 49 | template <class P> |
michael@0 | 50 | struct TupleTraits<P&> { |
michael@0 | 51 | typedef P ValueType; |
michael@0 | 52 | typedef P& RefType; |
michael@0 | 53 | typedef P& ParamType; |
michael@0 | 54 | }; |
michael@0 | 55 | |
michael@0 | 56 | template <class P> |
michael@0 | 57 | struct TupleTypes { }; |
michael@0 | 58 | |
michael@0 | 59 | // Tuple ----------------------------------------------------------------------- |
michael@0 | 60 | // |
michael@0 | 61 | // This set of classes is useful for bundling 0 or more heterogeneous data types |
michael@0 | 62 | // into a single variable. The advantage of this is that it greatly simplifies |
michael@0 | 63 | // function objects that need to take an arbitrary number of parameters; see |
michael@0 | 64 | // RunnableMethod and IPC::MessageWithTuple. |
michael@0 | 65 | // |
michael@0 | 66 | // Tuple0 is supplied to act as a 'void' type. It can be used, for example, |
michael@0 | 67 | // when dispatching to a function that accepts no arguments (see the |
michael@0 | 68 | // Dispatchers below). |
michael@0 | 69 | // Tuple1<A> is rarely useful. One such use is when A is non-const ref that you |
michael@0 | 70 | // want filled by the dispatchee, and the tuple is merely a container for that |
michael@0 | 71 | // output (a "tier"). See MakeRefTuple and its usages. |
michael@0 | 72 | |
michael@0 | 73 | struct Tuple0 { |
michael@0 | 74 | typedef Tuple0 ValueTuple; |
michael@0 | 75 | typedef Tuple0 RefTuple; |
michael@0 | 76 | typedef Tuple0 ParamTuple; |
michael@0 | 77 | }; |
michael@0 | 78 | |
michael@0 | 79 | template <class A> |
michael@0 | 80 | struct Tuple1 { |
michael@0 | 81 | public: |
michael@0 | 82 | typedef A TypeA; |
michael@0 | 83 | |
michael@0 | 84 | Tuple1() {} |
michael@0 | 85 | explicit Tuple1(typename TupleTraits<A>::ParamType a) : a(a) {} |
michael@0 | 86 | |
michael@0 | 87 | A a; |
michael@0 | 88 | }; |
michael@0 | 89 | |
michael@0 | 90 | template <class A, class B> |
michael@0 | 91 | struct Tuple2 { |
michael@0 | 92 | public: |
michael@0 | 93 | typedef A TypeA; |
michael@0 | 94 | typedef B TypeB; |
michael@0 | 95 | |
michael@0 | 96 | Tuple2() {} |
michael@0 | 97 | Tuple2(typename TupleTraits<A>::ParamType a, |
michael@0 | 98 | typename TupleTraits<B>::ParamType b) |
michael@0 | 99 | : a(a), b(b) { |
michael@0 | 100 | } |
michael@0 | 101 | |
michael@0 | 102 | A a; |
michael@0 | 103 | B b; |
michael@0 | 104 | }; |
michael@0 | 105 | |
michael@0 | 106 | template <class A, class B, class C> |
michael@0 | 107 | struct Tuple3 { |
michael@0 | 108 | public: |
michael@0 | 109 | typedef A TypeA; |
michael@0 | 110 | typedef B TypeB; |
michael@0 | 111 | typedef C TypeC; |
michael@0 | 112 | |
michael@0 | 113 | Tuple3() {} |
michael@0 | 114 | Tuple3(typename TupleTraits<A>::ParamType a, |
michael@0 | 115 | typename TupleTraits<B>::ParamType b, |
michael@0 | 116 | typename TupleTraits<C>::ParamType c) |
michael@0 | 117 | : a(a), b(b), c(c){ |
michael@0 | 118 | } |
michael@0 | 119 | |
michael@0 | 120 | A a; |
michael@0 | 121 | B b; |
michael@0 | 122 | C c; |
michael@0 | 123 | }; |
michael@0 | 124 | |
michael@0 | 125 | template <class A, class B, class C, class D> |
michael@0 | 126 | struct Tuple4 { |
michael@0 | 127 | public: |
michael@0 | 128 | typedef A TypeA; |
michael@0 | 129 | typedef B TypeB; |
michael@0 | 130 | typedef C TypeC; |
michael@0 | 131 | typedef D TypeD; |
michael@0 | 132 | |
michael@0 | 133 | Tuple4() {} |
michael@0 | 134 | Tuple4(typename TupleTraits<A>::ParamType a, |
michael@0 | 135 | typename TupleTraits<B>::ParamType b, |
michael@0 | 136 | typename TupleTraits<C>::ParamType c, |
michael@0 | 137 | typename TupleTraits<D>::ParamType d) |
michael@0 | 138 | : a(a), b(b), c(c), d(d) { |
michael@0 | 139 | } |
michael@0 | 140 | |
michael@0 | 141 | A a; |
michael@0 | 142 | B b; |
michael@0 | 143 | C c; |
michael@0 | 144 | D d; |
michael@0 | 145 | }; |
michael@0 | 146 | |
michael@0 | 147 | template <class A, class B, class C, class D, class E> |
michael@0 | 148 | struct Tuple5 { |
michael@0 | 149 | public: |
michael@0 | 150 | typedef A TypeA; |
michael@0 | 151 | typedef B TypeB; |
michael@0 | 152 | typedef C TypeC; |
michael@0 | 153 | typedef D TypeD; |
michael@0 | 154 | typedef E TypeE; |
michael@0 | 155 | |
michael@0 | 156 | Tuple5() {} |
michael@0 | 157 | Tuple5(typename TupleTraits<A>::ParamType a, |
michael@0 | 158 | typename TupleTraits<B>::ParamType b, |
michael@0 | 159 | typename TupleTraits<C>::ParamType c, |
michael@0 | 160 | typename TupleTraits<D>::ParamType d, |
michael@0 | 161 | typename TupleTraits<E>::ParamType e) |
michael@0 | 162 | : a(a), b(b), c(c), d(d), e(e) { |
michael@0 | 163 | } |
michael@0 | 164 | |
michael@0 | 165 | A a; |
michael@0 | 166 | B b; |
michael@0 | 167 | C c; |
michael@0 | 168 | D d; |
michael@0 | 169 | E e; |
michael@0 | 170 | }; |
michael@0 | 171 | |
michael@0 | 172 | template <class A, class B, class C, class D, class E, class F> |
michael@0 | 173 | struct Tuple6 { |
michael@0 | 174 | public: |
michael@0 | 175 | typedef A TypeA; |
michael@0 | 176 | typedef B TypeB; |
michael@0 | 177 | typedef C TypeC; |
michael@0 | 178 | typedef D TypeD; |
michael@0 | 179 | typedef E TypeE; |
michael@0 | 180 | typedef F TypeF; |
michael@0 | 181 | |
michael@0 | 182 | Tuple6() {} |
michael@0 | 183 | Tuple6(typename TupleTraits<A>::ParamType a, |
michael@0 | 184 | typename TupleTraits<B>::ParamType b, |
michael@0 | 185 | typename TupleTraits<C>::ParamType c, |
michael@0 | 186 | typename TupleTraits<D>::ParamType d, |
michael@0 | 187 | typename TupleTraits<E>::ParamType e, |
michael@0 | 188 | typename TupleTraits<F>::ParamType f) |
michael@0 | 189 | : a(a), b(b), c(c), d(d), e(e), f(f) { |
michael@0 | 190 | } |
michael@0 | 191 | |
michael@0 | 192 | A a; |
michael@0 | 193 | B b; |
michael@0 | 194 | C c; |
michael@0 | 195 | D d; |
michael@0 | 196 | E e; |
michael@0 | 197 | F f; |
michael@0 | 198 | }; |
michael@0 | 199 | |
michael@0 | 200 | template <class A, class B, class C, class D, class E, class F, class G> |
michael@0 | 201 | struct Tuple7 { |
michael@0 | 202 | public: |
michael@0 | 203 | typedef A TypeA; |
michael@0 | 204 | typedef B TypeB; |
michael@0 | 205 | typedef C TypeC; |
michael@0 | 206 | typedef D TypeD; |
michael@0 | 207 | typedef E TypeE; |
michael@0 | 208 | typedef F TypeF; |
michael@0 | 209 | typedef G TypeG; |
michael@0 | 210 | |
michael@0 | 211 | Tuple7() {} |
michael@0 | 212 | Tuple7(typename TupleTraits<A>::ParamType a, |
michael@0 | 213 | typename TupleTraits<B>::ParamType b, |
michael@0 | 214 | typename TupleTraits<C>::ParamType c, |
michael@0 | 215 | typename TupleTraits<D>::ParamType d, |
michael@0 | 216 | typename TupleTraits<E>::ParamType e, |
michael@0 | 217 | typename TupleTraits<F>::ParamType f, |
michael@0 | 218 | typename TupleTraits<G>::ParamType g) |
michael@0 | 219 | : a(a), b(b), c(c), d(d), e(e), f(f), g(g) { |
michael@0 | 220 | } |
michael@0 | 221 | |
michael@0 | 222 | A a; |
michael@0 | 223 | B b; |
michael@0 | 224 | C c; |
michael@0 | 225 | D d; |
michael@0 | 226 | E e; |
michael@0 | 227 | F f; |
michael@0 | 228 | G g; |
michael@0 | 229 | }; |
michael@0 | 230 | |
michael@0 | 231 | template <class A, class B, class C, class D, class E, class F, class G, |
michael@0 | 232 | class H> |
michael@0 | 233 | struct Tuple8 { |
michael@0 | 234 | public: |
michael@0 | 235 | typedef A TypeA; |
michael@0 | 236 | typedef B TypeB; |
michael@0 | 237 | typedef C TypeC; |
michael@0 | 238 | typedef D TypeD; |
michael@0 | 239 | typedef E TypeE; |
michael@0 | 240 | typedef F TypeF; |
michael@0 | 241 | typedef G TypeG; |
michael@0 | 242 | typedef H TypeH; |
michael@0 | 243 | |
michael@0 | 244 | Tuple8() {} |
michael@0 | 245 | Tuple8(typename TupleTraits<A>::ParamType a, |
michael@0 | 246 | typename TupleTraits<B>::ParamType b, |
michael@0 | 247 | typename TupleTraits<C>::ParamType c, |
michael@0 | 248 | typename TupleTraits<D>::ParamType d, |
michael@0 | 249 | typename TupleTraits<E>::ParamType e, |
michael@0 | 250 | typename TupleTraits<F>::ParamType f, |
michael@0 | 251 | typename TupleTraits<G>::ParamType g, |
michael@0 | 252 | typename TupleTraits<H>::ParamType h) |
michael@0 | 253 | : a(a), b(b), c(c), d(d), e(e), f(f), g(g), h(h) { |
michael@0 | 254 | } |
michael@0 | 255 | |
michael@0 | 256 | A a; |
michael@0 | 257 | B b; |
michael@0 | 258 | C c; |
michael@0 | 259 | D d; |
michael@0 | 260 | E e; |
michael@0 | 261 | F f; |
michael@0 | 262 | G g; |
michael@0 | 263 | H h; |
michael@0 | 264 | }; |
michael@0 | 265 | |
michael@0 | 266 | // Tuple types ---------------------------------------------------------------- |
michael@0 | 267 | // |
michael@0 | 268 | // Allows for selection of ValueTuple/RefTuple/ParamTuple without needing the |
michael@0 | 269 | // definitions of class types the tuple takes as parameters. |
michael@0 | 270 | |
michael@0 | 271 | template <> |
michael@0 | 272 | struct TupleTypes< Tuple0 > { |
michael@0 | 273 | typedef Tuple0 ValueTuple; |
michael@0 | 274 | typedef Tuple0 RefTuple; |
michael@0 | 275 | typedef Tuple0 ParamTuple; |
michael@0 | 276 | }; |
michael@0 | 277 | |
michael@0 | 278 | template <class A> |
michael@0 | 279 | struct TupleTypes< Tuple1<A> > { |
michael@0 | 280 | typedef Tuple1<typename TupleTraits<A>::ValueType> ValueTuple; |
michael@0 | 281 | typedef Tuple1<typename TupleTraits<A>::RefType> RefTuple; |
michael@0 | 282 | typedef Tuple1<typename TupleTraits<A>::ParamType> ParamTuple; |
michael@0 | 283 | }; |
michael@0 | 284 | |
michael@0 | 285 | template <class A, class B> |
michael@0 | 286 | struct TupleTypes< Tuple2<A, B> > { |
michael@0 | 287 | typedef Tuple2<typename TupleTraits<A>::ValueType, |
michael@0 | 288 | typename TupleTraits<B>::ValueType> ValueTuple; |
michael@0 | 289 | typedef Tuple2<typename TupleTraits<A>::RefType, |
michael@0 | 290 | typename TupleTraits<B>::RefType> RefTuple; |
michael@0 | 291 | typedef Tuple2<typename TupleTraits<A>::ParamType, |
michael@0 | 292 | typename TupleTraits<B>::ParamType> ParamTuple; |
michael@0 | 293 | }; |
michael@0 | 294 | |
michael@0 | 295 | template <class A, class B, class C> |
michael@0 | 296 | struct TupleTypes< Tuple3<A, B, C> > { |
michael@0 | 297 | typedef Tuple3<typename TupleTraits<A>::ValueType, |
michael@0 | 298 | typename TupleTraits<B>::ValueType, |
michael@0 | 299 | typename TupleTraits<C>::ValueType> ValueTuple; |
michael@0 | 300 | typedef Tuple3<typename TupleTraits<A>::RefType, |
michael@0 | 301 | typename TupleTraits<B>::RefType, |
michael@0 | 302 | typename TupleTraits<C>::RefType> RefTuple; |
michael@0 | 303 | typedef Tuple3<typename TupleTraits<A>::ParamType, |
michael@0 | 304 | typename TupleTraits<B>::ParamType, |
michael@0 | 305 | typename TupleTraits<C>::ParamType> ParamTuple; |
michael@0 | 306 | }; |
michael@0 | 307 | |
michael@0 | 308 | template <class A, class B, class C, class D> |
michael@0 | 309 | struct TupleTypes< Tuple4<A, B, C, D> > { |
michael@0 | 310 | typedef Tuple4<typename TupleTraits<A>::ValueType, |
michael@0 | 311 | typename TupleTraits<B>::ValueType, |
michael@0 | 312 | typename TupleTraits<C>::ValueType, |
michael@0 | 313 | typename TupleTraits<D>::ValueType> ValueTuple; |
michael@0 | 314 | typedef Tuple4<typename TupleTraits<A>::RefType, |
michael@0 | 315 | typename TupleTraits<B>::RefType, |
michael@0 | 316 | typename TupleTraits<C>::RefType, |
michael@0 | 317 | typename TupleTraits<D>::RefType> RefTuple; |
michael@0 | 318 | typedef Tuple4<typename TupleTraits<A>::ParamType, |
michael@0 | 319 | typename TupleTraits<B>::ParamType, |
michael@0 | 320 | typename TupleTraits<C>::ParamType, |
michael@0 | 321 | typename TupleTraits<D>::ParamType> ParamTuple; |
michael@0 | 322 | }; |
michael@0 | 323 | |
michael@0 | 324 | template <class A, class B, class C, class D, class E> |
michael@0 | 325 | struct TupleTypes< Tuple5<A, B, C, D, E> > { |
michael@0 | 326 | typedef Tuple5<typename TupleTraits<A>::ValueType, |
michael@0 | 327 | typename TupleTraits<B>::ValueType, |
michael@0 | 328 | typename TupleTraits<C>::ValueType, |
michael@0 | 329 | typename TupleTraits<D>::ValueType, |
michael@0 | 330 | typename TupleTraits<E>::ValueType> ValueTuple; |
michael@0 | 331 | typedef Tuple5<typename TupleTraits<A>::RefType, |
michael@0 | 332 | typename TupleTraits<B>::RefType, |
michael@0 | 333 | typename TupleTraits<C>::RefType, |
michael@0 | 334 | typename TupleTraits<D>::RefType, |
michael@0 | 335 | typename TupleTraits<E>::RefType> RefTuple; |
michael@0 | 336 | typedef Tuple5<typename TupleTraits<A>::ParamType, |
michael@0 | 337 | typename TupleTraits<B>::ParamType, |
michael@0 | 338 | typename TupleTraits<C>::ParamType, |
michael@0 | 339 | typename TupleTraits<D>::ParamType, |
michael@0 | 340 | typename TupleTraits<E>::ParamType> ParamTuple; |
michael@0 | 341 | }; |
michael@0 | 342 | |
michael@0 | 343 | template <class A, class B, class C, class D, class E, class F> |
michael@0 | 344 | struct TupleTypes< Tuple6<A, B, C, D, E, F> > { |
michael@0 | 345 | typedef Tuple6<typename TupleTraits<A>::ValueType, |
michael@0 | 346 | typename TupleTraits<B>::ValueType, |
michael@0 | 347 | typename TupleTraits<C>::ValueType, |
michael@0 | 348 | typename TupleTraits<D>::ValueType, |
michael@0 | 349 | typename TupleTraits<E>::ValueType, |
michael@0 | 350 | typename TupleTraits<F>::ValueType> ValueTuple; |
michael@0 | 351 | typedef Tuple6<typename TupleTraits<A>::RefType, |
michael@0 | 352 | typename TupleTraits<B>::RefType, |
michael@0 | 353 | typename TupleTraits<C>::RefType, |
michael@0 | 354 | typename TupleTraits<D>::RefType, |
michael@0 | 355 | typename TupleTraits<E>::RefType, |
michael@0 | 356 | typename TupleTraits<F>::RefType> RefTuple; |
michael@0 | 357 | typedef Tuple6<typename TupleTraits<A>::ParamType, |
michael@0 | 358 | typename TupleTraits<B>::ParamType, |
michael@0 | 359 | typename TupleTraits<C>::ParamType, |
michael@0 | 360 | typename TupleTraits<D>::ParamType, |
michael@0 | 361 | typename TupleTraits<E>::ParamType, |
michael@0 | 362 | typename TupleTraits<F>::ParamType> ParamTuple; |
michael@0 | 363 | }; |
michael@0 | 364 | |
michael@0 | 365 | template <class A, class B, class C, class D, class E, class F, class G> |
michael@0 | 366 | struct TupleTypes< Tuple7<A, B, C, D, E, F, G> > { |
michael@0 | 367 | typedef Tuple7<typename TupleTraits<A>::ValueType, |
michael@0 | 368 | typename TupleTraits<B>::ValueType, |
michael@0 | 369 | typename TupleTraits<C>::ValueType, |
michael@0 | 370 | typename TupleTraits<D>::ValueType, |
michael@0 | 371 | typename TupleTraits<E>::ValueType, |
michael@0 | 372 | typename TupleTraits<F>::ValueType, |
michael@0 | 373 | typename TupleTraits<G>::ValueType> ValueTuple; |
michael@0 | 374 | typedef Tuple7<typename TupleTraits<A>::RefType, |
michael@0 | 375 | typename TupleTraits<B>::RefType, |
michael@0 | 376 | typename TupleTraits<C>::RefType, |
michael@0 | 377 | typename TupleTraits<D>::RefType, |
michael@0 | 378 | typename TupleTraits<E>::RefType, |
michael@0 | 379 | typename TupleTraits<F>::RefType, |
michael@0 | 380 | typename TupleTraits<G>::RefType> RefTuple; |
michael@0 | 381 | typedef Tuple7<typename TupleTraits<A>::ParamType, |
michael@0 | 382 | typename TupleTraits<B>::ParamType, |
michael@0 | 383 | typename TupleTraits<C>::ParamType, |
michael@0 | 384 | typename TupleTraits<D>::ParamType, |
michael@0 | 385 | typename TupleTraits<E>::ParamType, |
michael@0 | 386 | typename TupleTraits<F>::ParamType, |
michael@0 | 387 | typename TupleTraits<G>::ParamType> ParamTuple; |
michael@0 | 388 | }; |
michael@0 | 389 | |
michael@0 | 390 | template <class A, class B, class C, class D, class E, class F, class G, |
michael@0 | 391 | class H> |
michael@0 | 392 | struct TupleTypes< Tuple8<A, B, C, D, E, F, G, H> > { |
michael@0 | 393 | typedef Tuple8<typename TupleTraits<A>::ValueType, |
michael@0 | 394 | typename TupleTraits<B>::ValueType, |
michael@0 | 395 | typename TupleTraits<C>::ValueType, |
michael@0 | 396 | typename TupleTraits<D>::ValueType, |
michael@0 | 397 | typename TupleTraits<E>::ValueType, |
michael@0 | 398 | typename TupleTraits<F>::ValueType, |
michael@0 | 399 | typename TupleTraits<G>::ValueType, |
michael@0 | 400 | typename TupleTraits<H>::ValueType> ValueTuple; |
michael@0 | 401 | typedef Tuple8<typename TupleTraits<A>::RefType, |
michael@0 | 402 | typename TupleTraits<B>::RefType, |
michael@0 | 403 | typename TupleTraits<C>::RefType, |
michael@0 | 404 | typename TupleTraits<D>::RefType, |
michael@0 | 405 | typename TupleTraits<E>::RefType, |
michael@0 | 406 | typename TupleTraits<F>::RefType, |
michael@0 | 407 | typename TupleTraits<G>::RefType, |
michael@0 | 408 | typename TupleTraits<H>::RefType> RefTuple; |
michael@0 | 409 | typedef Tuple8<typename TupleTraits<A>::ParamType, |
michael@0 | 410 | typename TupleTraits<B>::ParamType, |
michael@0 | 411 | typename TupleTraits<C>::ParamType, |
michael@0 | 412 | typename TupleTraits<D>::ParamType, |
michael@0 | 413 | typename TupleTraits<E>::ParamType, |
michael@0 | 414 | typename TupleTraits<F>::ParamType, |
michael@0 | 415 | typename TupleTraits<G>::ParamType, |
michael@0 | 416 | typename TupleTraits<H>::ParamType> ParamTuple; |
michael@0 | 417 | }; |
michael@0 | 418 | |
michael@0 | 419 | // Tuple creators ------------------------------------------------------------- |
michael@0 | 420 | // |
michael@0 | 421 | // Helper functions for constructing tuples while inferring the template |
michael@0 | 422 | // argument types. |
michael@0 | 423 | |
michael@0 | 424 | inline Tuple0 MakeTuple() { |
michael@0 | 425 | return Tuple0(); |
michael@0 | 426 | } |
michael@0 | 427 | |
michael@0 | 428 | template <class A> |
michael@0 | 429 | inline Tuple1<A> MakeTuple(const A& a) { |
michael@0 | 430 | return Tuple1<A>(a); |
michael@0 | 431 | } |
michael@0 | 432 | |
michael@0 | 433 | template <class A, class B> |
michael@0 | 434 | inline Tuple2<A, B> MakeTuple(const A& a, const B& b) { |
michael@0 | 435 | return Tuple2<A, B>(a, b); |
michael@0 | 436 | } |
michael@0 | 437 | |
michael@0 | 438 | template <class A, class B, class C> |
michael@0 | 439 | inline Tuple3<A, B, C> MakeTuple(const A& a, const B& b, const C& c) { |
michael@0 | 440 | return Tuple3<A, B, C>(a, b, c); |
michael@0 | 441 | } |
michael@0 | 442 | |
michael@0 | 443 | template <class A, class B, class C, class D> |
michael@0 | 444 | inline Tuple4<A, B, C, D> MakeTuple(const A& a, const B& b, const C& c, |
michael@0 | 445 | const D& d) { |
michael@0 | 446 | return Tuple4<A, B, C, D>(a, b, c, d); |
michael@0 | 447 | } |
michael@0 | 448 | |
michael@0 | 449 | template <class A, class B, class C, class D, class E> |
michael@0 | 450 | inline Tuple5<A, B, C, D, E> MakeTuple(const A& a, const B& b, const C& c, |
michael@0 | 451 | const D& d, const E& e) { |
michael@0 | 452 | return Tuple5<A, B, C, D, E>(a, b, c, d, e); |
michael@0 | 453 | } |
michael@0 | 454 | |
michael@0 | 455 | template <class A, class B, class C, class D, class E, class F> |
michael@0 | 456 | inline Tuple6<A, B, C, D, E, F> MakeTuple(const A& a, const B& b, const C& c, |
michael@0 | 457 | const D& d, const E& e, const F& f) { |
michael@0 | 458 | return Tuple6<A, B, C, D, E, F>(a, b, c, d, e, f); |
michael@0 | 459 | } |
michael@0 | 460 | |
michael@0 | 461 | template <class A, class B, class C, class D, class E, class F, class G> |
michael@0 | 462 | inline Tuple7<A, B, C, D, E, F, G> MakeTuple(const A& a, const B& b, const C& c, |
michael@0 | 463 | const D& d, const E& e, const F& f, |
michael@0 | 464 | const G& g) { |
michael@0 | 465 | return Tuple7<A, B, C, D, E, F, G>(a, b, c, d, e, f, g); |
michael@0 | 466 | } |
michael@0 | 467 | |
michael@0 | 468 | template <class A, class B, class C, class D, class E, class F, class G, |
michael@0 | 469 | class H> |
michael@0 | 470 | inline Tuple8<A, B, C, D, E, F, G, H> MakeTuple(const A& a, const B& b, |
michael@0 | 471 | const C& c, const D& d, |
michael@0 | 472 | const E& e, const F& f, |
michael@0 | 473 | const G& g, const H& h) { |
michael@0 | 474 | return Tuple8<A, B, C, D, E, F, G, H>(a, b, c, d, e, f, g, h); |
michael@0 | 475 | } |
michael@0 | 476 | |
michael@0 | 477 | // The following set of helpers make what Boost refers to as "Tiers" - a tuple |
michael@0 | 478 | // of references. |
michael@0 | 479 | |
michael@0 | 480 | template <class A> |
michael@0 | 481 | inline Tuple1<A&> MakeRefTuple(A& a) { |
michael@0 | 482 | return Tuple1<A&>(a); |
michael@0 | 483 | } |
michael@0 | 484 | |
michael@0 | 485 | template <class A, class B> |
michael@0 | 486 | inline Tuple2<A&, B&> MakeRefTuple(A& a, B& b) { |
michael@0 | 487 | return Tuple2<A&, B&>(a, b); |
michael@0 | 488 | } |
michael@0 | 489 | |
michael@0 | 490 | template <class A, class B, class C> |
michael@0 | 491 | inline Tuple3<A&, B&, C&> MakeRefTuple(A& a, B& b, C& c) { |
michael@0 | 492 | return Tuple3<A&, B&, C&>(a, b, c); |
michael@0 | 493 | } |
michael@0 | 494 | |
michael@0 | 495 | template <class A, class B, class C, class D> |
michael@0 | 496 | inline Tuple4<A&, B&, C&, D&> MakeRefTuple(A& a, B& b, C& c, D& d) { |
michael@0 | 497 | return Tuple4<A&, B&, C&, D&>(a, b, c, d); |
michael@0 | 498 | } |
michael@0 | 499 | |
michael@0 | 500 | template <class A, class B, class C, class D, class E> |
michael@0 | 501 | inline Tuple5<A&, B&, C&, D&, E&> MakeRefTuple(A& a, B& b, C& c, D& d, E& e) { |
michael@0 | 502 | return Tuple5<A&, B&, C&, D&, E&>(a, b, c, d, e); |
michael@0 | 503 | } |
michael@0 | 504 | |
michael@0 | 505 | template <class A, class B, class C, class D, class E, class F> |
michael@0 | 506 | inline Tuple6<A&, B&, C&, D&, E&, F&> MakeRefTuple(A& a, B& b, C& c, D& d, E& e, |
michael@0 | 507 | F& f) { |
michael@0 | 508 | return Tuple6<A&, B&, C&, D&, E&, F&>(a, b, c, d, e, f); |
michael@0 | 509 | } |
michael@0 | 510 | |
michael@0 | 511 | template <class A, class B, class C, class D, class E, class F, class G> |
michael@0 | 512 | inline Tuple7<A&, B&, C&, D&, E&, F&, G&> MakeRefTuple(A& a, B& b, C& c, D& d, |
michael@0 | 513 | E& e, F& f, G& g) { |
michael@0 | 514 | return Tuple7<A&, B&, C&, D&, E&, F&, G&>(a, b, c, d, e, f, g); |
michael@0 | 515 | } |
michael@0 | 516 | |
michael@0 | 517 | template <class A, class B, class C, class D, class E, class F, class G, |
michael@0 | 518 | class H> |
michael@0 | 519 | inline Tuple8<A&, B&, C&, D&, E&, F&, G&, H&> MakeRefTuple(A& a, B& b, C& c, |
michael@0 | 520 | D& d, E& e, F& f, |
michael@0 | 521 | G& g, H& h) { |
michael@0 | 522 | return Tuple8<A&, B&, C&, D&, E&, F&, G&, H&>(a, b, c, d, e, f, g, h); |
michael@0 | 523 | } |
michael@0 | 524 | |
michael@0 | 525 | // Dispatchers ---------------------------------------------------------------- |
michael@0 | 526 | // |
michael@0 | 527 | // Helper functions that call the given method on an object, with the unpacked |
michael@0 | 528 | // tuple arguments. Notice that they all have the same number of arguments, |
michael@0 | 529 | // so you need only write: |
michael@0 | 530 | // DispatchToMethod(object, &Object::method, args); |
michael@0 | 531 | // This is very useful for templated dispatchers, since they don't need to know |
michael@0 | 532 | // what type |args| is. |
michael@0 | 533 | |
michael@0 | 534 | // Non-Static Dispatchers with no out params. |
michael@0 | 535 | |
michael@0 | 536 | template <class ObjT, class Method> |
michael@0 | 537 | inline void DispatchToMethod(ObjT* obj, Method method, const Tuple0& arg) { |
michael@0 | 538 | (obj->*method)(); |
michael@0 | 539 | } |
michael@0 | 540 | |
michael@0 | 541 | template <class ObjT, class Method, class A> |
michael@0 | 542 | inline void DispatchToMethod(ObjT* obj, Method method, const A& arg) { |
michael@0 | 543 | (obj->*method)(base::internal::UnwrapTraits<A>::Unwrap(arg)); |
michael@0 | 544 | } |
michael@0 | 545 | |
michael@0 | 546 | template <class ObjT, class Method, class A> |
michael@0 | 547 | inline void DispatchToMethod(ObjT* obj, Method method, const Tuple1<A>& arg) { |
michael@0 | 548 | (obj->*method)(base::internal::UnwrapTraits<A>::Unwrap(arg.a)); |
michael@0 | 549 | } |
michael@0 | 550 | |
michael@0 | 551 | template<class ObjT, class Method, class A, class B> |
michael@0 | 552 | inline void DispatchToMethod(ObjT* obj, |
michael@0 | 553 | Method method, |
michael@0 | 554 | const Tuple2<A, B>& arg) { |
michael@0 | 555 | (obj->*method)(base::internal::UnwrapTraits<A>::Unwrap(arg.a), |
michael@0 | 556 | base::internal::UnwrapTraits<B>::Unwrap(arg.b)); |
michael@0 | 557 | } |
michael@0 | 558 | |
michael@0 | 559 | template<class ObjT, class Method, class A, class B, class C> |
michael@0 | 560 | inline void DispatchToMethod(ObjT* obj, Method method, |
michael@0 | 561 | const Tuple3<A, B, C>& arg) { |
michael@0 | 562 | (obj->*method)(base::internal::UnwrapTraits<A>::Unwrap(arg.a), |
michael@0 | 563 | base::internal::UnwrapTraits<B>::Unwrap(arg.b), |
michael@0 | 564 | base::internal::UnwrapTraits<C>::Unwrap(arg.c)); |
michael@0 | 565 | } |
michael@0 | 566 | |
michael@0 | 567 | template<class ObjT, class Method, class A, class B, class C, class D> |
michael@0 | 568 | inline void DispatchToMethod(ObjT* obj, Method method, |
michael@0 | 569 | const Tuple4<A, B, C, D>& arg) { |
michael@0 | 570 | (obj->*method)(base::internal::UnwrapTraits<A>::Unwrap(arg.a), |
michael@0 | 571 | base::internal::UnwrapTraits<B>::Unwrap(arg.b), |
michael@0 | 572 | base::internal::UnwrapTraits<C>::Unwrap(arg.c), |
michael@0 | 573 | base::internal::UnwrapTraits<D>::Unwrap(arg.d)); |
michael@0 | 574 | } |
michael@0 | 575 | |
michael@0 | 576 | template<class ObjT, class Method, class A, class B, class C, class D, class E> |
michael@0 | 577 | inline void DispatchToMethod(ObjT* obj, Method method, |
michael@0 | 578 | const Tuple5<A, B, C, D, E>& arg) { |
michael@0 | 579 | (obj->*method)(base::internal::UnwrapTraits<A>::Unwrap(arg.a), |
michael@0 | 580 | base::internal::UnwrapTraits<B>::Unwrap(arg.b), |
michael@0 | 581 | base::internal::UnwrapTraits<C>::Unwrap(arg.c), |
michael@0 | 582 | base::internal::UnwrapTraits<D>::Unwrap(arg.d), |
michael@0 | 583 | base::internal::UnwrapTraits<E>::Unwrap(arg.e)); |
michael@0 | 584 | } |
michael@0 | 585 | |
michael@0 | 586 | template<class ObjT, class Method, class A, class B, class C, class D, class E, |
michael@0 | 587 | class F> |
michael@0 | 588 | inline void DispatchToMethod(ObjT* obj, Method method, |
michael@0 | 589 | const Tuple6<A, B, C, D, E, F>& arg) { |
michael@0 | 590 | (obj->*method)(base::internal::UnwrapTraits<A>::Unwrap(arg.a), |
michael@0 | 591 | base::internal::UnwrapTraits<B>::Unwrap(arg.b), |
michael@0 | 592 | base::internal::UnwrapTraits<C>::Unwrap(arg.c), |
michael@0 | 593 | base::internal::UnwrapTraits<D>::Unwrap(arg.d), |
michael@0 | 594 | base::internal::UnwrapTraits<E>::Unwrap(arg.e), |
michael@0 | 595 | base::internal::UnwrapTraits<F>::Unwrap(arg.f)); |
michael@0 | 596 | } |
michael@0 | 597 | |
michael@0 | 598 | template<class ObjT, class Method, class A, class B, class C, class D, class E, |
michael@0 | 599 | class F, class G> |
michael@0 | 600 | inline void DispatchToMethod(ObjT* obj, Method method, |
michael@0 | 601 | const Tuple7<A, B, C, D, E, F, G>& arg) { |
michael@0 | 602 | (obj->*method)(base::internal::UnwrapTraits<A>::Unwrap(arg.a), |
michael@0 | 603 | base::internal::UnwrapTraits<B>::Unwrap(arg.b), |
michael@0 | 604 | base::internal::UnwrapTraits<C>::Unwrap(arg.c), |
michael@0 | 605 | base::internal::UnwrapTraits<D>::Unwrap(arg.d), |
michael@0 | 606 | base::internal::UnwrapTraits<E>::Unwrap(arg.e), |
michael@0 | 607 | base::internal::UnwrapTraits<F>::Unwrap(arg.f), |
michael@0 | 608 | base::internal::UnwrapTraits<G>::Unwrap(arg.g)); |
michael@0 | 609 | } |
michael@0 | 610 | |
michael@0 | 611 | template<class ObjT, class Method, class A, class B, class C, class D, class E, |
michael@0 | 612 | class F, class G, class H> |
michael@0 | 613 | inline void DispatchToMethod(ObjT* obj, Method method, |
michael@0 | 614 | const Tuple8<A, B, C, D, E, F, G, H>& arg) { |
michael@0 | 615 | (obj->*method)(base::internal::UnwrapTraits<A>::Unwrap(arg.a), |
michael@0 | 616 | base::internal::UnwrapTraits<B>::Unwrap(arg.b), |
michael@0 | 617 | base::internal::UnwrapTraits<C>::Unwrap(arg.c), |
michael@0 | 618 | base::internal::UnwrapTraits<D>::Unwrap(arg.d), |
michael@0 | 619 | base::internal::UnwrapTraits<E>::Unwrap(arg.e), |
michael@0 | 620 | base::internal::UnwrapTraits<F>::Unwrap(arg.f), |
michael@0 | 621 | base::internal::UnwrapTraits<G>::Unwrap(arg.g), |
michael@0 | 622 | base::internal::UnwrapTraits<H>::Unwrap(arg.h)); |
michael@0 | 623 | } |
michael@0 | 624 | |
michael@0 | 625 | // Static Dispatchers with no out params. |
michael@0 | 626 | |
michael@0 | 627 | template <class Function> |
michael@0 | 628 | inline void DispatchToFunction(Function function, const Tuple0& arg) { |
michael@0 | 629 | (*function)(); |
michael@0 | 630 | } |
michael@0 | 631 | |
michael@0 | 632 | template <class Function, class A> |
michael@0 | 633 | inline void DispatchToFunction(Function function, const A& arg) { |
michael@0 | 634 | (*function)(arg); |
michael@0 | 635 | } |
michael@0 | 636 | |
michael@0 | 637 | template <class Function, class A> |
michael@0 | 638 | inline void DispatchToFunction(Function function, const Tuple1<A>& arg) { |
michael@0 | 639 | (*function)(base::internal::UnwrapTraits<A>::Unwrap(arg.a)); |
michael@0 | 640 | } |
michael@0 | 641 | |
michael@0 | 642 | template<class Function, class A, class B> |
michael@0 | 643 | inline void DispatchToFunction(Function function, const Tuple2<A, B>& arg) { |
michael@0 | 644 | (*function)(base::internal::UnwrapTraits<A>::Unwrap(arg.a), |
michael@0 | 645 | base::internal::UnwrapTraits<B>::Unwrap(arg.b)); |
michael@0 | 646 | } |
michael@0 | 647 | |
michael@0 | 648 | template<class Function, class A, class B, class C> |
michael@0 | 649 | inline void DispatchToFunction(Function function, const Tuple3<A, B, C>& arg) { |
michael@0 | 650 | (*function)(base::internal::UnwrapTraits<A>::Unwrap(arg.a), |
michael@0 | 651 | base::internal::UnwrapTraits<B>::Unwrap(arg.b), |
michael@0 | 652 | base::internal::UnwrapTraits<C>::Unwrap(arg.c)); |
michael@0 | 653 | } |
michael@0 | 654 | |
michael@0 | 655 | template<class Function, class A, class B, class C, class D> |
michael@0 | 656 | inline void DispatchToFunction(Function function, |
michael@0 | 657 | const Tuple4<A, B, C, D>& arg) { |
michael@0 | 658 | (*function)(base::internal::UnwrapTraits<A>::Unwrap(arg.a), |
michael@0 | 659 | base::internal::UnwrapTraits<B>::Unwrap(arg.b), |
michael@0 | 660 | base::internal::UnwrapTraits<C>::Unwrap(arg.c), |
michael@0 | 661 | base::internal::UnwrapTraits<D>::Unwrap(arg.d)); |
michael@0 | 662 | } |
michael@0 | 663 | |
michael@0 | 664 | template<class Function, class A, class B, class C, class D, class E> |
michael@0 | 665 | inline void DispatchToFunction(Function function, |
michael@0 | 666 | const Tuple5<A, B, C, D, E>& arg) { |
michael@0 | 667 | (*function)(base::internal::UnwrapTraits<A>::Unwrap(arg.a), |
michael@0 | 668 | base::internal::UnwrapTraits<B>::Unwrap(arg.b), |
michael@0 | 669 | base::internal::UnwrapTraits<C>::Unwrap(arg.c), |
michael@0 | 670 | base::internal::UnwrapTraits<D>::Unwrap(arg.d), |
michael@0 | 671 | base::internal::UnwrapTraits<E>::Unwrap(arg.e)); |
michael@0 | 672 | } |
michael@0 | 673 | |
michael@0 | 674 | template<class Function, class A, class B, class C, class D, class E, class F> |
michael@0 | 675 | inline void DispatchToFunction(Function function, |
michael@0 | 676 | const Tuple6<A, B, C, D, E, F>& arg) { |
michael@0 | 677 | (*function)(base::internal::UnwrapTraits<A>::Unwrap(arg.a), |
michael@0 | 678 | base::internal::UnwrapTraits<B>::Unwrap(arg.b), |
michael@0 | 679 | base::internal::UnwrapTraits<C>::Unwrap(arg.c), |
michael@0 | 680 | base::internal::UnwrapTraits<D>::Unwrap(arg.d), |
michael@0 | 681 | base::internal::UnwrapTraits<E>::Unwrap(arg.e), |
michael@0 | 682 | base::internal::UnwrapTraits<F>::Unwrap(arg.f)); |
michael@0 | 683 | } |
michael@0 | 684 | |
michael@0 | 685 | template<class Function, class A, class B, class C, class D, class E, class F, |
michael@0 | 686 | class G> |
michael@0 | 687 | inline void DispatchToFunction(Function function, |
michael@0 | 688 | const Tuple7<A, B, C, D, E, F, G>& arg) { |
michael@0 | 689 | (*function)(base::internal::UnwrapTraits<A>::Unwrap(arg.a), |
michael@0 | 690 | base::internal::UnwrapTraits<B>::Unwrap(arg.b), |
michael@0 | 691 | base::internal::UnwrapTraits<C>::Unwrap(arg.c), |
michael@0 | 692 | base::internal::UnwrapTraits<D>::Unwrap(arg.d), |
michael@0 | 693 | base::internal::UnwrapTraits<E>::Unwrap(arg.e), |
michael@0 | 694 | base::internal::UnwrapTraits<F>::Unwrap(arg.f), |
michael@0 | 695 | base::internal::UnwrapTraits<G>::Unwrap(arg.g)); |
michael@0 | 696 | } |
michael@0 | 697 | |
michael@0 | 698 | template<class Function, class A, class B, class C, class D, class E, class F, |
michael@0 | 699 | class G, class H> |
michael@0 | 700 | inline void DispatchToFunction(Function function, |
michael@0 | 701 | const Tuple8<A, B, C, D, E, F, G, H>& arg) { |
michael@0 | 702 | (*function)(base::internal::UnwrapTraits<A>::Unwrap(arg.a), |
michael@0 | 703 | base::internal::UnwrapTraits<B>::Unwrap(arg.b), |
michael@0 | 704 | base::internal::UnwrapTraits<C>::Unwrap(arg.c), |
michael@0 | 705 | base::internal::UnwrapTraits<D>::Unwrap(arg.d), |
michael@0 | 706 | base::internal::UnwrapTraits<E>::Unwrap(arg.e), |
michael@0 | 707 | base::internal::UnwrapTraits<F>::Unwrap(arg.f), |
michael@0 | 708 | base::internal::UnwrapTraits<G>::Unwrap(arg.g), |
michael@0 | 709 | base::internal::UnwrapTraits<H>::Unwrap(arg.h)); |
michael@0 | 710 | } |
michael@0 | 711 | |
michael@0 | 712 | // Dispatchers with 0 out param (as a Tuple0). |
michael@0 | 713 | |
michael@0 | 714 | template <class ObjT, class Method> |
michael@0 | 715 | inline void DispatchToMethod(ObjT* obj, |
michael@0 | 716 | Method method, |
michael@0 | 717 | const Tuple0& arg, Tuple0*) { |
michael@0 | 718 | (obj->*method)(); |
michael@0 | 719 | } |
michael@0 | 720 | |
michael@0 | 721 | template <class ObjT, class Method, class A> |
michael@0 | 722 | inline void DispatchToMethod(ObjT* obj, Method method, const A& arg, Tuple0*) { |
michael@0 | 723 | (obj->*method)(base::internal::UnwrapTraits<A>::Unwrap(arg)); |
michael@0 | 724 | } |
michael@0 | 725 | |
michael@0 | 726 | template <class ObjT, class Method, class A> |
michael@0 | 727 | inline void DispatchToMethod(ObjT* obj, |
michael@0 | 728 | Method method, |
michael@0 | 729 | const Tuple1<A>& arg, Tuple0*) { |
michael@0 | 730 | (obj->*method)(base::internal::UnwrapTraits<A>::Unwrap(arg.a)); |
michael@0 | 731 | } |
michael@0 | 732 | |
michael@0 | 733 | template<class ObjT, class Method, class A, class B> |
michael@0 | 734 | inline void DispatchToMethod(ObjT* obj, |
michael@0 | 735 | Method method, |
michael@0 | 736 | const Tuple2<A, B>& arg, Tuple0*) { |
michael@0 | 737 | (obj->*method)(base::internal::UnwrapTraits<A>::Unwrap(arg.a), |
michael@0 | 738 | base::internal::UnwrapTraits<B>::Unwrap(arg.b)); |
michael@0 | 739 | } |
michael@0 | 740 | |
michael@0 | 741 | template<class ObjT, class Method, class A, class B, class C> |
michael@0 | 742 | inline void DispatchToMethod(ObjT* obj, Method method, |
michael@0 | 743 | const Tuple3<A, B, C>& arg, Tuple0*) { |
michael@0 | 744 | (obj->*method)(base::internal::UnwrapTraits<A>::Unwrap(arg.a), |
michael@0 | 745 | base::internal::UnwrapTraits<B>::Unwrap(arg.b), |
michael@0 | 746 | base::internal::UnwrapTraits<C>::Unwrap(arg.c)); |
michael@0 | 747 | } |
michael@0 | 748 | |
michael@0 | 749 | template<class ObjT, class Method, class A, class B, class C, class D> |
michael@0 | 750 | inline void DispatchToMethod(ObjT* obj, Method method, |
michael@0 | 751 | const Tuple4<A, B, C, D>& arg, Tuple0*) { |
michael@0 | 752 | (obj->*method)(base::internal::UnwrapTraits<A>::Unwrap(arg.a), |
michael@0 | 753 | base::internal::UnwrapTraits<B>::Unwrap(arg.b), |
michael@0 | 754 | base::internal::UnwrapTraits<C>::Unwrap(arg.c), |
michael@0 | 755 | base::internal::UnwrapTraits<D>::Unwrap(arg.d)); |
michael@0 | 756 | } |
michael@0 | 757 | |
michael@0 | 758 | template<class ObjT, class Method, class A, class B, class C, class D, class E> |
michael@0 | 759 | inline void DispatchToMethod(ObjT* obj, Method method, |
michael@0 | 760 | const Tuple5<A, B, C, D, E>& arg, Tuple0*) { |
michael@0 | 761 | (obj->*method)(base::internal::UnwrapTraits<A>::Unwrap(arg.a), |
michael@0 | 762 | base::internal::UnwrapTraits<B>::Unwrap(arg.b), |
michael@0 | 763 | base::internal::UnwrapTraits<C>::Unwrap(arg.c), |
michael@0 | 764 | base::internal::UnwrapTraits<D>::Unwrap(arg.d), |
michael@0 | 765 | base::internal::UnwrapTraits<E>::Unwrap(arg.e)); |
michael@0 | 766 | } |
michael@0 | 767 | |
michael@0 | 768 | template<class ObjT, class Method, class A, class B, class C, class D, class E, |
michael@0 | 769 | class F> |
michael@0 | 770 | inline void DispatchToMethod(ObjT* obj, Method method, |
michael@0 | 771 | const Tuple6<A, B, C, D, E, F>& arg, Tuple0*) { |
michael@0 | 772 | (obj->*method)(base::internal::UnwrapTraits<A>::Unwrap(arg.a), |
michael@0 | 773 | base::internal::UnwrapTraits<B>::Unwrap(arg.b), |
michael@0 | 774 | base::internal::UnwrapTraits<C>::Unwrap(arg.c), |
michael@0 | 775 | base::internal::UnwrapTraits<D>::Unwrap(arg.d), |
michael@0 | 776 | base::internal::UnwrapTraits<E>::Unwrap(arg.e), |
michael@0 | 777 | base::internal::UnwrapTraits<F>::Unwrap(arg.f)); |
michael@0 | 778 | } |
michael@0 | 779 | |
michael@0 | 780 | // Dispatchers with 1 out param. |
michael@0 | 781 | |
michael@0 | 782 | template<class ObjT, class Method, |
michael@0 | 783 | class OutA> |
michael@0 | 784 | inline void DispatchToMethod(ObjT* obj, Method method, |
michael@0 | 785 | const Tuple0& in, |
michael@0 | 786 | Tuple1<OutA>* out) { |
michael@0 | 787 | (obj->*method)(&out->a); |
michael@0 | 788 | } |
michael@0 | 789 | |
michael@0 | 790 | template<class ObjT, class Method, class InA, |
michael@0 | 791 | class OutA> |
michael@0 | 792 | inline void DispatchToMethod(ObjT* obj, Method method, |
michael@0 | 793 | const InA& in, |
michael@0 | 794 | Tuple1<OutA>* out) { |
michael@0 | 795 | (obj->*method)(in, &out->a); |
michael@0 | 796 | } |
michael@0 | 797 | |
michael@0 | 798 | template<class ObjT, class Method, class InA, |
michael@0 | 799 | class OutA> |
michael@0 | 800 | inline void DispatchToMethod(ObjT* obj, Method method, |
michael@0 | 801 | const Tuple1<InA>& in, |
michael@0 | 802 | Tuple1<OutA>* out) { |
michael@0 | 803 | (obj->*method)(base::internal::UnwrapTraits<InA>::Unwrap(in.a), &out->a); |
michael@0 | 804 | } |
michael@0 | 805 | |
michael@0 | 806 | template<class ObjT, class Method, class InA, class InB, |
michael@0 | 807 | class OutA> |
michael@0 | 808 | inline void DispatchToMethod(ObjT* obj, Method method, |
michael@0 | 809 | const Tuple2<InA, InB>& in, |
michael@0 | 810 | Tuple1<OutA>* out) { |
michael@0 | 811 | (obj->*method)(base::internal::UnwrapTraits<InA>::Unwrap(in.a), |
michael@0 | 812 | base::internal::UnwrapTraits<InB>::Unwrap(in.b), |
michael@0 | 813 | &out->a); |
michael@0 | 814 | } |
michael@0 | 815 | |
michael@0 | 816 | template<class ObjT, class Method, class InA, class InB, class InC, |
michael@0 | 817 | class OutA> |
michael@0 | 818 | inline void DispatchToMethod(ObjT* obj, Method method, |
michael@0 | 819 | const Tuple3<InA, InB, InC>& in, |
michael@0 | 820 | Tuple1<OutA>* out) { |
michael@0 | 821 | (obj->*method)(base::internal::UnwrapTraits<InA>::Unwrap(in.a), |
michael@0 | 822 | base::internal::UnwrapTraits<InB>::Unwrap(in.b), |
michael@0 | 823 | base::internal::UnwrapTraits<InC>::Unwrap(in.c), |
michael@0 | 824 | &out->a); |
michael@0 | 825 | } |
michael@0 | 826 | |
michael@0 | 827 | template<class ObjT, class Method, class InA, class InB, class InC, class InD, |
michael@0 | 828 | class OutA> |
michael@0 | 829 | inline void DispatchToMethod(ObjT* obj, Method method, |
michael@0 | 830 | const Tuple4<InA, InB, InC, InD>& in, |
michael@0 | 831 | Tuple1<OutA>* out) { |
michael@0 | 832 | (obj->*method)(base::internal::UnwrapTraits<InA>::Unwrap(in.a), |
michael@0 | 833 | base::internal::UnwrapTraits<InB>::Unwrap(in.b), |
michael@0 | 834 | base::internal::UnwrapTraits<InC>::Unwrap(in.c), |
michael@0 | 835 | base::internal::UnwrapTraits<InD>::Unwrap(in.d), |
michael@0 | 836 | &out->a); |
michael@0 | 837 | } |
michael@0 | 838 | |
michael@0 | 839 | template<class ObjT, class Method, class InA, class InB, class InC, class InD, |
michael@0 | 840 | class InE, class OutA> |
michael@0 | 841 | inline void DispatchToMethod(ObjT* obj, Method method, |
michael@0 | 842 | const Tuple5<InA, InB, InC, InD, InE>& in, |
michael@0 | 843 | Tuple1<OutA>* out) { |
michael@0 | 844 | (obj->*method)(base::internal::UnwrapTraits<InA>::Unwrap(in.a), |
michael@0 | 845 | base::internal::UnwrapTraits<InB>::Unwrap(in.b), |
michael@0 | 846 | base::internal::UnwrapTraits<InC>::Unwrap(in.c), |
michael@0 | 847 | base::internal::UnwrapTraits<InD>::Unwrap(in.d), |
michael@0 | 848 | base::internal::UnwrapTraits<InE>::Unwrap(in.e), |
michael@0 | 849 | &out->a); |
michael@0 | 850 | } |
michael@0 | 851 | |
michael@0 | 852 | template<class ObjT, class Method, |
michael@0 | 853 | class InA, class InB, class InC, class InD, class InE, class InF, |
michael@0 | 854 | class OutA> |
michael@0 | 855 | inline void DispatchToMethod(ObjT* obj, Method method, |
michael@0 | 856 | const Tuple6<InA, InB, InC, InD, InE, InF>& in, |
michael@0 | 857 | Tuple1<OutA>* out) { |
michael@0 | 858 | (obj->*method)(base::internal::UnwrapTraits<InA>::Unwrap(in.a), |
michael@0 | 859 | base::internal::UnwrapTraits<InB>::Unwrap(in.b), |
michael@0 | 860 | base::internal::UnwrapTraits<InC>::Unwrap(in.c), |
michael@0 | 861 | base::internal::UnwrapTraits<InD>::Unwrap(in.d), |
michael@0 | 862 | base::internal::UnwrapTraits<InE>::Unwrap(in.e), |
michael@0 | 863 | base::internal::UnwrapTraits<InF>::Unwrap(in.f), |
michael@0 | 864 | &out->a); |
michael@0 | 865 | } |
michael@0 | 866 | |
michael@0 | 867 | // Dispatchers with 2 out params. |
michael@0 | 868 | |
michael@0 | 869 | template<class ObjT, class Method, |
michael@0 | 870 | class OutA, class OutB> |
michael@0 | 871 | inline void DispatchToMethod(ObjT* obj, Method method, |
michael@0 | 872 | const Tuple0& in, |
michael@0 | 873 | Tuple2<OutA, OutB>* out) { |
michael@0 | 874 | (obj->*method)(&out->a, &out->b); |
michael@0 | 875 | } |
michael@0 | 876 | |
michael@0 | 877 | template<class ObjT, class Method, class InA, |
michael@0 | 878 | class OutA, class OutB> |
michael@0 | 879 | inline void DispatchToMethod(ObjT* obj, Method method, |
michael@0 | 880 | const InA& in, |
michael@0 | 881 | Tuple2<OutA, OutB>* out) { |
michael@0 | 882 | (obj->*method)(in, &out->a, &out->b); |
michael@0 | 883 | } |
michael@0 | 884 | |
michael@0 | 885 | template<class ObjT, class Method, class InA, |
michael@0 | 886 | class OutA, class OutB> |
michael@0 | 887 | inline void DispatchToMethod(ObjT* obj, Method method, |
michael@0 | 888 | const Tuple1<InA>& in, |
michael@0 | 889 | Tuple2<OutA, OutB>* out) { |
michael@0 | 890 | (obj->*method)( |
michael@0 | 891 | base::internal::UnwrapTraits<InA>::Unwrap(in.a), &out->a, &out->b); |
michael@0 | 892 | } |
michael@0 | 893 | |
michael@0 | 894 | template<class ObjT, class Method, class InA, class InB, |
michael@0 | 895 | class OutA, class OutB> |
michael@0 | 896 | inline void DispatchToMethod(ObjT* obj, Method method, |
michael@0 | 897 | const Tuple2<InA, InB>& in, |
michael@0 | 898 | Tuple2<OutA, OutB>* out) { |
michael@0 | 899 | (obj->*method)(base::internal::UnwrapTraits<InA>::Unwrap(in.a), |
michael@0 | 900 | base::internal::UnwrapTraits<InB>::Unwrap(in.b), |
michael@0 | 901 | &out->a, |
michael@0 | 902 | &out->b); |
michael@0 | 903 | } |
michael@0 | 904 | |
michael@0 | 905 | template<class ObjT, class Method, class InA, class InB, class InC, |
michael@0 | 906 | class OutA, class OutB> |
michael@0 | 907 | inline void DispatchToMethod(ObjT* obj, Method method, |
michael@0 | 908 | const Tuple3<InA, InB, InC>& in, |
michael@0 | 909 | Tuple2<OutA, OutB>* out) { |
michael@0 | 910 | (obj->*method)(base::internal::UnwrapTraits<InA>::Unwrap(in.a), |
michael@0 | 911 | base::internal::UnwrapTraits<InB>::Unwrap(in.b), |
michael@0 | 912 | base::internal::UnwrapTraits<InC>::Unwrap(in.c), |
michael@0 | 913 | &out->a, |
michael@0 | 914 | &out->b); |
michael@0 | 915 | } |
michael@0 | 916 | |
michael@0 | 917 | template<class ObjT, class Method, class InA, class InB, class InC, class InD, |
michael@0 | 918 | class OutA, class OutB> |
michael@0 | 919 | inline void DispatchToMethod(ObjT* obj, Method method, |
michael@0 | 920 | const Tuple4<InA, InB, InC, InD>& in, |
michael@0 | 921 | Tuple2<OutA, OutB>* out) { |
michael@0 | 922 | (obj->*method)(base::internal::UnwrapTraits<InA>::Unwrap(in.a), |
michael@0 | 923 | base::internal::UnwrapTraits<InB>::Unwrap(in.b), |
michael@0 | 924 | base::internal::UnwrapTraits<InC>::Unwrap(in.c), |
michael@0 | 925 | base::internal::UnwrapTraits<InD>::Unwrap(in.d), |
michael@0 | 926 | &out->a, |
michael@0 | 927 | &out->b); |
michael@0 | 928 | } |
michael@0 | 929 | |
michael@0 | 930 | template<class ObjT, class Method, |
michael@0 | 931 | class InA, class InB, class InC, class InD, class InE, |
michael@0 | 932 | class OutA, class OutB> |
michael@0 | 933 | inline void DispatchToMethod(ObjT* obj, Method method, |
michael@0 | 934 | const Tuple5<InA, InB, InC, InD, InE>& in, |
michael@0 | 935 | Tuple2<OutA, OutB>* out) { |
michael@0 | 936 | (obj->*method)(base::internal::UnwrapTraits<InA>::Unwrap(in.a), |
michael@0 | 937 | base::internal::UnwrapTraits<InB>::Unwrap(in.b), |
michael@0 | 938 | base::internal::UnwrapTraits<InC>::Unwrap(in.c), |
michael@0 | 939 | base::internal::UnwrapTraits<InD>::Unwrap(in.d), |
michael@0 | 940 | base::internal::UnwrapTraits<InE>::Unwrap(in.e), |
michael@0 | 941 | &out->a, |
michael@0 | 942 | &out->b); |
michael@0 | 943 | } |
michael@0 | 944 | |
michael@0 | 945 | template<class ObjT, class Method, |
michael@0 | 946 | class InA, class InB, class InC, class InD, class InE, class InF, |
michael@0 | 947 | class OutA, class OutB> |
michael@0 | 948 | inline void DispatchToMethod(ObjT* obj, Method method, |
michael@0 | 949 | const Tuple6<InA, InB, InC, InD, InE, InF>& in, |
michael@0 | 950 | Tuple2<OutA, OutB>* out) { |
michael@0 | 951 | (obj->*method)(base::internal::UnwrapTraits<InA>::Unwrap(in.a), |
michael@0 | 952 | base::internal::UnwrapTraits<InB>::Unwrap(in.b), |
michael@0 | 953 | base::internal::UnwrapTraits<InC>::Unwrap(in.c), |
michael@0 | 954 | base::internal::UnwrapTraits<InD>::Unwrap(in.d), |
michael@0 | 955 | base::internal::UnwrapTraits<InE>::Unwrap(in.e), |
michael@0 | 956 | base::internal::UnwrapTraits<InF>::Unwrap(in.f), |
michael@0 | 957 | &out->a, |
michael@0 | 958 | &out->b); |
michael@0 | 959 | } |
michael@0 | 960 | |
michael@0 | 961 | // Dispatchers with 3 out params. |
michael@0 | 962 | |
michael@0 | 963 | template<class ObjT, class Method, |
michael@0 | 964 | class OutA, class OutB, class OutC> |
michael@0 | 965 | inline void DispatchToMethod(ObjT* obj, Method method, |
michael@0 | 966 | const Tuple0& in, |
michael@0 | 967 | Tuple3<OutA, OutB, OutC>* out) { |
michael@0 | 968 | (obj->*method)(&out->a, &out->b, &out->c); |
michael@0 | 969 | } |
michael@0 | 970 | |
michael@0 | 971 | template<class ObjT, class Method, class InA, |
michael@0 | 972 | class OutA, class OutB, class OutC> |
michael@0 | 973 | inline void DispatchToMethod(ObjT* obj, Method method, |
michael@0 | 974 | const InA& in, |
michael@0 | 975 | Tuple3<OutA, OutB, OutC>* out) { |
michael@0 | 976 | (obj->*method)(in, &out->a, &out->b, &out->c); |
michael@0 | 977 | } |
michael@0 | 978 | |
michael@0 | 979 | template<class ObjT, class Method, class InA, |
michael@0 | 980 | class OutA, class OutB, class OutC> |
michael@0 | 981 | inline void DispatchToMethod(ObjT* obj, Method method, |
michael@0 | 982 | const Tuple1<InA>& in, |
michael@0 | 983 | Tuple3<OutA, OutB, OutC>* out) { |
michael@0 | 984 | (obj->*method)(base::internal::UnwrapTraits<InA>::Unwrap(in.a), |
michael@0 | 985 | &out->a, |
michael@0 | 986 | &out->b, |
michael@0 | 987 | &out->c); |
michael@0 | 988 | } |
michael@0 | 989 | |
michael@0 | 990 | template<class ObjT, class Method, class InA, class InB, |
michael@0 | 991 | class OutA, class OutB, class OutC> |
michael@0 | 992 | inline void DispatchToMethod(ObjT* obj, Method method, |
michael@0 | 993 | const Tuple2<InA, InB>& in, |
michael@0 | 994 | Tuple3<OutA, OutB, OutC>* out) { |
michael@0 | 995 | (obj->*method)(base::internal::UnwrapTraits<InA>::Unwrap(in.a), |
michael@0 | 996 | base::internal::UnwrapTraits<InB>::Unwrap(in.b), |
michael@0 | 997 | &out->a, |
michael@0 | 998 | &out->b, |
michael@0 | 999 | &out->c); |
michael@0 | 1000 | } |
michael@0 | 1001 | |
michael@0 | 1002 | template<class ObjT, class Method, class InA, class InB, class InC, |
michael@0 | 1003 | class OutA, class OutB, class OutC> |
michael@0 | 1004 | inline void DispatchToMethod(ObjT* obj, Method method, |
michael@0 | 1005 | const Tuple3<InA, InB, InC>& in, |
michael@0 | 1006 | Tuple3<OutA, OutB, OutC>* out) { |
michael@0 | 1007 | (obj->*method)(base::internal::UnwrapTraits<InA>::Unwrap(in.a), |
michael@0 | 1008 | base::internal::UnwrapTraits<InB>::Unwrap(in.b), |
michael@0 | 1009 | base::internal::UnwrapTraits<InC>::Unwrap(in.c), |
michael@0 | 1010 | &out->a, |
michael@0 | 1011 | &out->b, |
michael@0 | 1012 | &out->c); |
michael@0 | 1013 | } |
michael@0 | 1014 | |
michael@0 | 1015 | template<class ObjT, class Method, class InA, class InB, class InC, class InD, |
michael@0 | 1016 | class OutA, class OutB, class OutC> |
michael@0 | 1017 | inline void DispatchToMethod(ObjT* obj, Method method, |
michael@0 | 1018 | const Tuple4<InA, InB, InC, InD>& in, |
michael@0 | 1019 | Tuple3<OutA, OutB, OutC>* out) { |
michael@0 | 1020 | (obj->*method)(base::internal::UnwrapTraits<InA>::Unwrap(in.a), |
michael@0 | 1021 | base::internal::UnwrapTraits<InB>::Unwrap(in.b), |
michael@0 | 1022 | base::internal::UnwrapTraits<InC>::Unwrap(in.c), |
michael@0 | 1023 | base::internal::UnwrapTraits<InD>::Unwrap(in.d), |
michael@0 | 1024 | &out->a, |
michael@0 | 1025 | &out->b, |
michael@0 | 1026 | &out->c); |
michael@0 | 1027 | } |
michael@0 | 1028 | |
michael@0 | 1029 | template<class ObjT, class Method, |
michael@0 | 1030 | class InA, class InB, class InC, class InD, class InE, |
michael@0 | 1031 | class OutA, class OutB, class OutC> |
michael@0 | 1032 | inline void DispatchToMethod(ObjT* obj, Method method, |
michael@0 | 1033 | const Tuple5<InA, InB, InC, InD, InE>& in, |
michael@0 | 1034 | Tuple3<OutA, OutB, OutC>* out) { |
michael@0 | 1035 | (obj->*method)(base::internal::UnwrapTraits<InA>::Unwrap(in.a), |
michael@0 | 1036 | base::internal::UnwrapTraits<InB>::Unwrap(in.b), |
michael@0 | 1037 | base::internal::UnwrapTraits<InC>::Unwrap(in.c), |
michael@0 | 1038 | base::internal::UnwrapTraits<InD>::Unwrap(in.d), |
michael@0 | 1039 | base::internal::UnwrapTraits<InE>::Unwrap(in.e), |
michael@0 | 1040 | &out->a, |
michael@0 | 1041 | &out->b, |
michael@0 | 1042 | &out->c); |
michael@0 | 1043 | } |
michael@0 | 1044 | |
michael@0 | 1045 | template<class ObjT, class Method, |
michael@0 | 1046 | class InA, class InB, class InC, class InD, class InE, class InF, |
michael@0 | 1047 | class OutA, class OutB, class OutC> |
michael@0 | 1048 | inline void DispatchToMethod(ObjT* obj, Method method, |
michael@0 | 1049 | const Tuple6<InA, InB, InC, InD, InE, InF>& in, |
michael@0 | 1050 | Tuple3<OutA, OutB, OutC>* out) { |
michael@0 | 1051 | (obj->*method)(base::internal::UnwrapTraits<InA>::Unwrap(in.a), |
michael@0 | 1052 | base::internal::UnwrapTraits<InB>::Unwrap(in.b), |
michael@0 | 1053 | base::internal::UnwrapTraits<InC>::Unwrap(in.c), |
michael@0 | 1054 | base::internal::UnwrapTraits<InD>::Unwrap(in.d), |
michael@0 | 1055 | base::internal::UnwrapTraits<InE>::Unwrap(in.e), |
michael@0 | 1056 | base::internal::UnwrapTraits<InF>::Unwrap(in.f), |
michael@0 | 1057 | &out->a, |
michael@0 | 1058 | &out->b, |
michael@0 | 1059 | &out->c); |
michael@0 | 1060 | } |
michael@0 | 1061 | |
michael@0 | 1062 | // Dispatchers with 4 out params. |
michael@0 | 1063 | |
michael@0 | 1064 | template<class ObjT, class Method, |
michael@0 | 1065 | class OutA, class OutB, class OutC, class OutD> |
michael@0 | 1066 | inline void DispatchToMethod(ObjT* obj, Method method, |
michael@0 | 1067 | const Tuple0& in, |
michael@0 | 1068 | Tuple4<OutA, OutB, OutC, OutD>* out) { |
michael@0 | 1069 | (obj->*method)(&out->a, &out->b, &out->c, &out->d); |
michael@0 | 1070 | } |
michael@0 | 1071 | |
michael@0 | 1072 | template<class ObjT, class Method, class InA, |
michael@0 | 1073 | class OutA, class OutB, class OutC, class OutD> |
michael@0 | 1074 | inline void DispatchToMethod(ObjT* obj, Method method, |
michael@0 | 1075 | const InA& in, |
michael@0 | 1076 | Tuple4<OutA, OutB, OutC, OutD>* out) { |
michael@0 | 1077 | (obj->*method)(base::internal::UnwrapTraits<InA>::Unwrap(in), |
michael@0 | 1078 | &out->a, |
michael@0 | 1079 | &out->b, |
michael@0 | 1080 | &out->c, |
michael@0 | 1081 | &out->d); |
michael@0 | 1082 | } |
michael@0 | 1083 | |
michael@0 | 1084 | template<class ObjT, class Method, class InA, |
michael@0 | 1085 | class OutA, class OutB, class OutC, class OutD> |
michael@0 | 1086 | inline void DispatchToMethod(ObjT* obj, Method method, |
michael@0 | 1087 | const Tuple1<InA>& in, |
michael@0 | 1088 | Tuple4<OutA, OutB, OutC, OutD>* out) { |
michael@0 | 1089 | (obj->*method)(base::internal::UnwrapTraits<InA>::Unwrap(in.a), |
michael@0 | 1090 | &out->a, |
michael@0 | 1091 | &out->b, |
michael@0 | 1092 | &out->c, |
michael@0 | 1093 | &out->d); |
michael@0 | 1094 | } |
michael@0 | 1095 | |
michael@0 | 1096 | template<class ObjT, class Method, class InA, class InB, |
michael@0 | 1097 | class OutA, class OutB, class OutC, class OutD> |
michael@0 | 1098 | inline void DispatchToMethod(ObjT* obj, Method method, |
michael@0 | 1099 | const Tuple2<InA, InB>& in, |
michael@0 | 1100 | Tuple4<OutA, OutB, OutC, OutD>* out) { |
michael@0 | 1101 | (obj->*method)(base::internal::UnwrapTraits<InA>::Unwrap(in.a), |
michael@0 | 1102 | base::internal::UnwrapTraits<InB>::Unwrap(in.b), |
michael@0 | 1103 | &out->a, |
michael@0 | 1104 | &out->b, |
michael@0 | 1105 | &out->c, |
michael@0 | 1106 | &out->d); |
michael@0 | 1107 | } |
michael@0 | 1108 | |
michael@0 | 1109 | template<class ObjT, class Method, class InA, class InB, class InC, |
michael@0 | 1110 | class OutA, class OutB, class OutC, class OutD> |
michael@0 | 1111 | inline void DispatchToMethod(ObjT* obj, Method method, |
michael@0 | 1112 | const Tuple3<InA, InB, InC>& in, |
michael@0 | 1113 | Tuple4<OutA, OutB, OutC, OutD>* out) { |
michael@0 | 1114 | (obj->*method)(base::internal::UnwrapTraits<InA>::Unwrap(in.a), |
michael@0 | 1115 | base::internal::UnwrapTraits<InB>::Unwrap(in.b), |
michael@0 | 1116 | base::internal::UnwrapTraits<InC>::Unwrap(in.c), |
michael@0 | 1117 | &out->a, |
michael@0 | 1118 | &out->b, |
michael@0 | 1119 | &out->c, |
michael@0 | 1120 | &out->d); |
michael@0 | 1121 | } |
michael@0 | 1122 | |
michael@0 | 1123 | template<class ObjT, class Method, class InA, class InB, class InC, class InD, |
michael@0 | 1124 | class OutA, class OutB, class OutC, class OutD> |
michael@0 | 1125 | inline void DispatchToMethod(ObjT* obj, Method method, |
michael@0 | 1126 | const Tuple4<InA, InB, InC, InD>& in, |
michael@0 | 1127 | Tuple4<OutA, OutB, OutC, OutD>* out) { |
michael@0 | 1128 | (obj->*method)(base::internal::UnwrapTraits<InA>::Unwrap(in.a), |
michael@0 | 1129 | base::internal::UnwrapTraits<InB>::Unwrap(in.b), |
michael@0 | 1130 | base::internal::UnwrapTraits<InC>::Unwrap(in.c), |
michael@0 | 1131 | base::internal::UnwrapTraits<InD>::Unwrap(in.d), |
michael@0 | 1132 | &out->a, |
michael@0 | 1133 | &out->b, |
michael@0 | 1134 | &out->c, |
michael@0 | 1135 | &out->d); |
michael@0 | 1136 | } |
michael@0 | 1137 | |
michael@0 | 1138 | template<class ObjT, class Method, |
michael@0 | 1139 | class InA, class InB, class InC, class InD, class InE, |
michael@0 | 1140 | class OutA, class OutB, class OutC, class OutD> |
michael@0 | 1141 | inline void DispatchToMethod(ObjT* obj, Method method, |
michael@0 | 1142 | const Tuple5<InA, InB, InC, InD, InE>& in, |
michael@0 | 1143 | Tuple4<OutA, OutB, OutC, OutD>* out) { |
michael@0 | 1144 | (obj->*method)(base::internal::UnwrapTraits<InA>::Unwrap(in.a), |
michael@0 | 1145 | base::internal::UnwrapTraits<InB>::Unwrap(in.b), |
michael@0 | 1146 | base::internal::UnwrapTraits<InC>::Unwrap(in.c), |
michael@0 | 1147 | base::internal::UnwrapTraits<InD>::Unwrap(in.d), |
michael@0 | 1148 | base::internal::UnwrapTraits<InE>::Unwrap(in.e), |
michael@0 | 1149 | &out->a, |
michael@0 | 1150 | &out->b, |
michael@0 | 1151 | &out->c, |
michael@0 | 1152 | &out->d); |
michael@0 | 1153 | } |
michael@0 | 1154 | |
michael@0 | 1155 | template<class ObjT, class Method, |
michael@0 | 1156 | class InA, class InB, class InC, class InD, class InE, class InF, |
michael@0 | 1157 | class OutA, class OutB, class OutC, class OutD> |
michael@0 | 1158 | inline void DispatchToMethod(ObjT* obj, Method method, |
michael@0 | 1159 | const Tuple6<InA, InB, InC, InD, InE, InF>& in, |
michael@0 | 1160 | Tuple4<OutA, OutB, OutC, OutD>* out) { |
michael@0 | 1161 | (obj->*method)(base::internal::UnwrapTraits<InA>::Unwrap(in.a), |
michael@0 | 1162 | base::internal::UnwrapTraits<InB>::Unwrap(in.b), |
michael@0 | 1163 | base::internal::UnwrapTraits<InC>::Unwrap(in.c), |
michael@0 | 1164 | base::internal::UnwrapTraits<InD>::Unwrap(in.d), |
michael@0 | 1165 | base::internal::UnwrapTraits<InE>::Unwrap(in.e), |
michael@0 | 1166 | base::internal::UnwrapTraits<InF>::Unwrap(in.f), |
michael@0 | 1167 | &out->a, |
michael@0 | 1168 | &out->b, |
michael@0 | 1169 | &out->c, |
michael@0 | 1170 | &out->d); |
michael@0 | 1171 | } |
michael@0 | 1172 | |
michael@0 | 1173 | // Dispatchers with 5 out params. |
michael@0 | 1174 | |
michael@0 | 1175 | template<class ObjT, class Method, |
michael@0 | 1176 | class OutA, class OutB, class OutC, class OutD, class OutE> |
michael@0 | 1177 | inline void DispatchToMethod(ObjT* obj, Method method, |
michael@0 | 1178 | const Tuple0& in, |
michael@0 | 1179 | Tuple5<OutA, OutB, OutC, OutD, OutE>* out) { |
michael@0 | 1180 | (obj->*method)(&out->a, &out->b, &out->c, &out->d, &out->e); |
michael@0 | 1181 | } |
michael@0 | 1182 | |
michael@0 | 1183 | template<class ObjT, class Method, class InA, |
michael@0 | 1184 | class OutA, class OutB, class OutC, class OutD, class OutE> |
michael@0 | 1185 | inline void DispatchToMethod(ObjT* obj, Method method, |
michael@0 | 1186 | const InA& in, |
michael@0 | 1187 | Tuple5<OutA, OutB, OutC, OutD, OutE>* out) { |
michael@0 | 1188 | (obj->*method)(base::internal::UnwrapTraits<InA>::Unwrap(in), |
michael@0 | 1189 | &out->a, |
michael@0 | 1190 | &out->b, |
michael@0 | 1191 | &out->c, |
michael@0 | 1192 | &out->d, |
michael@0 | 1193 | &out->e); |
michael@0 | 1194 | } |
michael@0 | 1195 | |
michael@0 | 1196 | template<class ObjT, class Method, class InA, |
michael@0 | 1197 | class OutA, class OutB, class OutC, class OutD, class OutE> |
michael@0 | 1198 | inline void DispatchToMethod(ObjT* obj, Method method, |
michael@0 | 1199 | const Tuple1<InA>& in, |
michael@0 | 1200 | Tuple5<OutA, OutB, OutC, OutD, OutE>* out) { |
michael@0 | 1201 | (obj->*method)(base::internal::UnwrapTraits<InA>::Unwrap(in.a), |
michael@0 | 1202 | &out->a, |
michael@0 | 1203 | &out->b, |
michael@0 | 1204 | &out->c, |
michael@0 | 1205 | &out->d, |
michael@0 | 1206 | &out->e); |
michael@0 | 1207 | } |
michael@0 | 1208 | |
michael@0 | 1209 | template<class ObjT, class Method, class InA, class InB, |
michael@0 | 1210 | class OutA, class OutB, class OutC, class OutD, class OutE> |
michael@0 | 1211 | inline void DispatchToMethod(ObjT* obj, Method method, |
michael@0 | 1212 | const Tuple2<InA, InB>& in, |
michael@0 | 1213 | Tuple5<OutA, OutB, OutC, OutD, OutE>* out) { |
michael@0 | 1214 | (obj->*method)(base::internal::UnwrapTraits<InA>::Unwrap(in.a), |
michael@0 | 1215 | base::internal::UnwrapTraits<InB>::Unwrap(in.b), |
michael@0 | 1216 | &out->a, |
michael@0 | 1217 | &out->b, |
michael@0 | 1218 | &out->c, |
michael@0 | 1219 | &out->d, |
michael@0 | 1220 | &out->e); |
michael@0 | 1221 | } |
michael@0 | 1222 | |
michael@0 | 1223 | template<class ObjT, class Method, class InA, class InB, class InC, |
michael@0 | 1224 | class OutA, class OutB, class OutC, class OutD, class OutE> |
michael@0 | 1225 | inline void DispatchToMethod(ObjT* obj, Method method, |
michael@0 | 1226 | const Tuple3<InA, InB, InC>& in, |
michael@0 | 1227 | Tuple5<OutA, OutB, OutC, OutD, OutE>* out) { |
michael@0 | 1228 | (obj->*method)(base::internal::UnwrapTraits<InA>::Unwrap(in.a), |
michael@0 | 1229 | base::internal::UnwrapTraits<InB>::Unwrap(in.b), |
michael@0 | 1230 | base::internal::UnwrapTraits<InC>::Unwrap(in.c), |
michael@0 | 1231 | &out->a, |
michael@0 | 1232 | &out->b, |
michael@0 | 1233 | &out->c, |
michael@0 | 1234 | &out->d, |
michael@0 | 1235 | &out->e); |
michael@0 | 1236 | } |
michael@0 | 1237 | |
michael@0 | 1238 | template<class ObjT, class Method, class InA, class InB, class InC, class InD, |
michael@0 | 1239 | class OutA, class OutB, class OutC, class OutD, class OutE> |
michael@0 | 1240 | inline void DispatchToMethod(ObjT* obj, Method method, |
michael@0 | 1241 | const Tuple4<InA, InB, InC, InD>& in, |
michael@0 | 1242 | Tuple5<OutA, OutB, OutC, OutD, OutE>* out) { |
michael@0 | 1243 | (obj->*method)(base::internal::UnwrapTraits<InA>::Unwrap(in.a), |
michael@0 | 1244 | base::internal::UnwrapTraits<InB>::Unwrap(in.b), |
michael@0 | 1245 | base::internal::UnwrapTraits<InC>::Unwrap(in.c), |
michael@0 | 1246 | base::internal::UnwrapTraits<InD>::Unwrap(in.d), |
michael@0 | 1247 | &out->a, |
michael@0 | 1248 | &out->b, |
michael@0 | 1249 | &out->c, |
michael@0 | 1250 | &out->d, |
michael@0 | 1251 | &out->e); |
michael@0 | 1252 | } |
michael@0 | 1253 | |
michael@0 | 1254 | template<class ObjT, class Method, |
michael@0 | 1255 | class InA, class InB, class InC, class InD, class InE, |
michael@0 | 1256 | class OutA, class OutB, class OutC, class OutD, class OutE> |
michael@0 | 1257 | inline void DispatchToMethod(ObjT* obj, Method method, |
michael@0 | 1258 | const Tuple5<InA, InB, InC, InD, InE>& in, |
michael@0 | 1259 | Tuple5<OutA, OutB, OutC, OutD, OutE>* out) { |
michael@0 | 1260 | (obj->*method)(base::internal::UnwrapTraits<InA>::Unwrap(in.a), |
michael@0 | 1261 | base::internal::UnwrapTraits<InB>::Unwrap(in.b), |
michael@0 | 1262 | base::internal::UnwrapTraits<InC>::Unwrap(in.c), |
michael@0 | 1263 | base::internal::UnwrapTraits<InD>::Unwrap(in.d), |
michael@0 | 1264 | base::internal::UnwrapTraits<InE>::Unwrap(in.e), |
michael@0 | 1265 | &out->a, |
michael@0 | 1266 | &out->b, |
michael@0 | 1267 | &out->c, |
michael@0 | 1268 | &out->d, |
michael@0 | 1269 | &out->e); |
michael@0 | 1270 | } |
michael@0 | 1271 | |
michael@0 | 1272 | template<class ObjT, class Method, |
michael@0 | 1273 | class InA, class InB, class InC, class InD, class InE, class InF, |
michael@0 | 1274 | class OutA, class OutB, class OutC, class OutD, class OutE> |
michael@0 | 1275 | inline void DispatchToMethod(ObjT* obj, Method method, |
michael@0 | 1276 | const Tuple6<InA, InB, InC, InD, InE, InF>& in, |
michael@0 | 1277 | Tuple5<OutA, OutB, OutC, OutD, OutE>* out) { |
michael@0 | 1278 | (obj->*method)(base::internal::UnwrapTraits<InA>::Unwrap(in.a), |
michael@0 | 1279 | base::internal::UnwrapTraits<InB>::Unwrap(in.b), |
michael@0 | 1280 | base::internal::UnwrapTraits<InC>::Unwrap(in.c), |
michael@0 | 1281 | base::internal::UnwrapTraits<InD>::Unwrap(in.d), |
michael@0 | 1282 | base::internal::UnwrapTraits<InE>::Unwrap(in.e), |
michael@0 | 1283 | base::internal::UnwrapTraits<InF>::Unwrap(in.f), |
michael@0 | 1284 | &out->a, |
michael@0 | 1285 | &out->b, |
michael@0 | 1286 | &out->c, |
michael@0 | 1287 | &out->d, |
michael@0 | 1288 | &out->e); |
michael@0 | 1289 | } |
michael@0 | 1290 | |
michael@0 | 1291 | #endif // BASE_TUPLE_H__ |