| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // A Tuple is a generic templatized container, similar in concept to std::pair. | 5 // A Tuple is a generic templatized container, similar in concept to std::pair. |
| 6 // There are classes Tuple0 to Tuple5, cooresponding to the number of elements | 6 // There are classes Tuple0 to Tuple6, cooresponding to the number of elements |
| 7 // it contains. The convenient MakeTuple() function takes 0 to 5 arguments, | 7 // it contains. The convenient MakeTuple() function takes 0 to 6 arguments, |
| 8 // and will construct and return the appropriate Tuple object. The functions | 8 // and will construct and return the appropriate Tuple object. The functions |
| 9 // DispatchToMethod and DispatchToFunction take a function pointer or instance | 9 // DispatchToMethod and DispatchToFunction take a function pointer or instance |
| 10 // and method pointer, and unpack a tuple into arguments to the call. | 10 // and method pointer, and unpack a tuple into arguments to the call. |
| 11 // | 11 // |
| 12 // Tuple elements are copied by value, and stored in the tuple. See the unit | 12 // Tuple elements are copied by value, and stored in the tuple. See the unit |
| 13 // tests for more details of how/when the values are copied. | 13 // tests for more details of how/when the values are copied. |
| 14 // | 14 // |
| 15 // Example usage: | 15 // Example usage: |
| 16 // // These two methods of creating a Tuple are identical. | 16 // // These two methods of creating a Tuple are identical. |
| 17 // Tuple2<int, const char*> tuple_a(1, "wee"); | 17 // Tuple2<int, const char*> tuple_a(1, "wee"); |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 : a(a), b(b), c(c), d(d), e(e) { | 186 : a(a), b(b), c(c), d(d), e(e) { |
| 187 } | 187 } |
| 188 | 188 |
| 189 A a; | 189 A a; |
| 190 B b; | 190 B b; |
| 191 C c; | 191 C c; |
| 192 D d; | 192 D d; |
| 193 E e; | 193 E e; |
| 194 }; | 194 }; |
| 195 | 195 |
| 196 template <class A, class B, class C, class D, class E, class F> |
| 197 struct Tuple6 { |
| 198 public: |
| 199 typedef A TypeA; |
| 200 typedef B TypeB; |
| 201 typedef C TypeC; |
| 202 typedef D TypeD; |
| 203 typedef E TypeE; |
| 204 typedef F TypeF; |
| 205 typedef Tuple6<typename TupleTraits<A>::ValueType, |
| 206 typename TupleTraits<B>::ValueType, |
| 207 typename TupleTraits<C>::ValueType, |
| 208 typename TupleTraits<D>::ValueType, |
| 209 typename TupleTraits<E>::ValueType, |
| 210 typename TupleTraits<F>::ValueType> ValueTuple; |
| 211 typedef Tuple6<typename TupleTraits<A>::RefType, |
| 212 typename TupleTraits<B>::RefType, |
| 213 typename TupleTraits<C>::RefType, |
| 214 typename TupleTraits<D>::RefType, |
| 215 typename TupleTraits<E>::RefType, |
| 216 typename TupleTraits<F>::RefType> RefTuple; |
| 217 |
| 218 Tuple6() {} |
| 219 Tuple6(typename TupleTraits<A>::ParamType a, |
| 220 typename TupleTraits<B>::ParamType b, |
| 221 typename TupleTraits<C>::ParamType c, |
| 222 typename TupleTraits<D>::ParamType d, |
| 223 typename TupleTraits<E>::ParamType e, |
| 224 typename TupleTraits<F>::ParamType f) |
| 225 : a(a), b(b), c(c), d(d), e(e), f(f) { |
| 226 } |
| 227 |
| 228 A a; |
| 229 B b; |
| 230 C c; |
| 231 D d; |
| 232 E e; |
| 233 F f; |
| 234 }; |
| 235 |
| 196 // Tuple creators ------------------------------------------------------------- | 236 // Tuple creators ------------------------------------------------------------- |
| 197 // | 237 // |
| 198 // Helper functions for constructing tuples while inferring the template | 238 // Helper functions for constructing tuples while inferring the template |
| 199 // argument types. | 239 // argument types. |
| 200 | 240 |
| 201 inline Tuple0 MakeTuple() { | 241 inline Tuple0 MakeTuple() { |
| 202 return Tuple0(); | 242 return Tuple0(); |
| 203 } | 243 } |
| 204 | 244 |
| 205 template <class A> | 245 template <class A> |
| (...skipping 16 matching lines...) Expand all Loading... |
| 222 const D& d) { | 262 const D& d) { |
| 223 return Tuple4<A, B, C, D>(a, b, c, d); | 263 return Tuple4<A, B, C, D>(a, b, c, d); |
| 224 } | 264 } |
| 225 | 265 |
| 226 template <class A, class B, class C, class D, class E> | 266 template <class A, class B, class C, class D, class E> |
| 227 inline Tuple5<A, B, C, D, E> MakeTuple(const A& a, const B& b, const C& c, | 267 inline Tuple5<A, B, C, D, E> MakeTuple(const A& a, const B& b, const C& c, |
| 228 const D& d, const E& e) { | 268 const D& d, const E& e) { |
| 229 return Tuple5<A, B, C, D, E>(a, b, c, d, e); | 269 return Tuple5<A, B, C, D, E>(a, b, c, d, e); |
| 230 } | 270 } |
| 231 | 271 |
| 272 template <class A, class B, class C, class D, class E, class F> |
| 273 inline Tuple6<A, B, C, D, E, F> MakeTuple(const A& a, const B& b, const C& c, |
| 274 const D& d, const E& e, const F& f) { |
| 275 return Tuple6<A, B, C, D, E, F>(a, b, c, d, e, f); |
| 276 } |
| 277 |
| 232 // The following set of helpers make what Boost refers to as "Tiers" - a tuple | 278 // The following set of helpers make what Boost refers to as "Tiers" - a tuple |
| 233 // of references. | 279 // of references. |
| 234 | 280 |
| 235 template <class A> | 281 template <class A> |
| 236 inline Tuple1<A&> MakeRefTuple(A& a) { | 282 inline Tuple1<A&> MakeRefTuple(A& a) { |
| 237 return Tuple1<A&>(a); | 283 return Tuple1<A&>(a); |
| 238 } | 284 } |
| 239 | 285 |
| 240 template <class A, class B> | 286 template <class A, class B> |
| 241 inline Tuple2<A&, B&> MakeRefTuple(A& a, B& b) { | 287 inline Tuple2<A&, B&> MakeRefTuple(A& a, B& b) { |
| 242 return Tuple2<A&, B&>(a, b); | 288 return Tuple2<A&, B&>(a, b); |
| 243 } | 289 } |
| 244 | 290 |
| 245 template <class A, class B, class C> | 291 template <class A, class B, class C> |
| 246 inline Tuple3<A&, B&, C&> MakeRefTuple(A& a, B& b, C& c) { | 292 inline Tuple3<A&, B&, C&> MakeRefTuple(A& a, B& b, C& c) { |
| 247 return Tuple3<A&, B&, C&>(a, b, c); | 293 return Tuple3<A&, B&, C&>(a, b, c); |
| 248 } | 294 } |
| 249 | 295 |
| 250 template <class A, class B, class C, class D> | 296 template <class A, class B, class C, class D> |
| 251 inline Tuple4<A&, B&, C&, D&> MakeRefTuple(A& a, B& b, C& c, D& d) { | 297 inline Tuple4<A&, B&, C&, D&> MakeRefTuple(A& a, B& b, C& c, D& d) { |
| 252 return Tuple4<A&, B&, C&, D&>(a, b, c, d); | 298 return Tuple4<A&, B&, C&, D&>(a, b, c, d); |
| 253 } | 299 } |
| 254 | 300 |
| 255 template <class A, class B, class C, class D, class E> | 301 template <class A, class B, class C, class D, class E> |
| 256 inline Tuple5<A&, B&, C&, D&, E&> MakeRefTuple(A& a, B& b, C& c, D& d, E& e) { | 302 inline Tuple5<A&, B&, C&, D&, E&> MakeRefTuple(A& a, B& b, C& c, D& d, E& e) { |
| 257 return Tuple5<A&, B&, C&, D&, E&>(a, b, c, d, e); | 303 return Tuple5<A&, B&, C&, D&, E&>(a, b, c, d, e); |
| 258 } | 304 } |
| 259 | 305 |
| 306 template <class A, class B, class C, class D, class E, class F> |
| 307 inline Tuple6<A&, B&, C&, D&, E&, F&> MakeRefTuple(A& a, B& b, C& c, D& d, E& e, |
| 308 F& f) { |
| 309 return Tuple6<A&, B&, C&, D&, E&, F&>(a, b, c, d, e, f); |
| 310 } |
| 311 |
| 260 // Dispatchers ---------------------------------------------------------------- | 312 // Dispatchers ---------------------------------------------------------------- |
| 261 // | 313 // |
| 262 // Helper functions that call the given method on an object, with the unpacked | 314 // Helper functions that call the given method on an object, with the unpacked |
| 263 // tuple arguments. Notice that they all have the same number of arguments, | 315 // tuple arguments. Notice that they all have the same number of arguments, |
| 264 // so you need only write: | 316 // so you need only write: |
| 265 // DispatchToMethod(object, &Object::method, args); | 317 // DispatchToMethod(object, &Object::method, args); |
| 266 // This is very useful for templated dispatchers, since they don't need to know | 318 // This is very useful for templated dispatchers, since they don't need to know |
| 267 // what type |args| is. | 319 // what type |args| is. |
| 268 | 320 |
| 269 // Non-Static Dispatchers with no out params. | 321 // Non-Static Dispatchers with no out params. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 299 const Tuple4<A, B, C, D>& arg) { | 351 const Tuple4<A, B, C, D>& arg) { |
| 300 (obj->*method)(arg.a, arg.b, arg.c, arg.d); | 352 (obj->*method)(arg.a, arg.b, arg.c, arg.d); |
| 301 } | 353 } |
| 302 | 354 |
| 303 template<class ObjT, class Method, class A, class B, class C, class D, class E> | 355 template<class ObjT, class Method, class A, class B, class C, class D, class E> |
| 304 inline void DispatchToMethod(ObjT* obj, Method method, | 356 inline void DispatchToMethod(ObjT* obj, Method method, |
| 305 const Tuple5<A, B, C, D, E>& arg) { | 357 const Tuple5<A, B, C, D, E>& arg) { |
| 306 (obj->*method)(arg.a, arg.b, arg.c, arg.d, arg.e); | 358 (obj->*method)(arg.a, arg.b, arg.c, arg.d, arg.e); |
| 307 } | 359 } |
| 308 | 360 |
| 361 template<class ObjT, class Method, class A, class B, class C, class D, class E, |
| 362 class F> |
| 363 inline void DispatchToMethod(ObjT* obj, Method method, |
| 364 const Tuple6<A, B, C, D, E, F>& arg) { |
| 365 (obj->*method)(arg.a, arg.b, arg.c, arg.d, arg.e, arg.f); |
| 366 } |
| 367 |
| 309 // Static Dispatchers with no out params. | 368 // Static Dispatchers with no out params. |
| 310 | 369 |
| 311 template <class Function> | 370 template <class Function> |
| 312 inline void DispatchToFunction(Function function, const Tuple0& arg) { | 371 inline void DispatchToFunction(Function function, const Tuple0& arg) { |
| 313 (*function)(); | 372 (*function)(); |
| 314 } | 373 } |
| 315 | 374 |
| 316 template <class Function, class A> | 375 template <class Function, class A> |
| 317 inline void DispatchToFunction(Function function, const A& arg) { | 376 inline void DispatchToFunction(Function function, const A& arg) { |
| 318 (*function)(arg); | 377 (*function)(arg); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 338 const Tuple4<A, B, C, D>& arg) { | 397 const Tuple4<A, B, C, D>& arg) { |
| 339 (*function)(arg.a, arg.b, arg.c, arg.d); | 398 (*function)(arg.a, arg.b, arg.c, arg.d); |
| 340 } | 399 } |
| 341 | 400 |
| 342 template<class Function, class A, class B, class C, class D, class E> | 401 template<class Function, class A, class B, class C, class D, class E> |
| 343 inline void DispatchToFunction(Function function, | 402 inline void DispatchToFunction(Function function, |
| 344 const Tuple5<A, B, C, D, E>& arg) { | 403 const Tuple5<A, B, C, D, E>& arg) { |
| 345 (*function)(arg.a, arg.b, arg.c, arg.d, arg.e); | 404 (*function)(arg.a, arg.b, arg.c, arg.d, arg.e); |
| 346 } | 405 } |
| 347 | 406 |
| 407 template<class Function, class A, class B, class C, class D, class E, class F> |
| 408 inline void DispatchToFunction(Function function, |
| 409 const Tuple6<A, B, C, D, E, F>& arg) { |
| 410 (*function)(arg.a, arg.b, arg.c, arg.d, arg.e, arg.f); |
| 411 } |
| 412 |
| 348 // Dispatchers with 0 out param (as a Tuple0). | 413 // Dispatchers with 0 out param (as a Tuple0). |
| 349 | 414 |
| 350 template <class ObjT, class Method> | 415 template <class ObjT, class Method> |
| 351 inline void DispatchToMethod(ObjT* obj, Method method, const Tuple0& arg, Tuple0
*) { | 416 inline void DispatchToMethod(ObjT* obj, Method method, const Tuple0& arg, Tuple0
*) { |
| 352 (obj->*method)(); | 417 (obj->*method)(); |
| 353 } | 418 } |
| 354 | 419 |
| 355 template <class ObjT, class Method, class A> | 420 template <class ObjT, class Method, class A> |
| 356 inline void DispatchToMethod(ObjT* obj, Method method, const A& arg, Tuple0*) { | 421 inline void DispatchToMethod(ObjT* obj, Method method, const A& arg, Tuple0*) { |
| 357 (obj->*method)(arg); | 422 (obj->*method)(arg); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 378 const Tuple4<A, B, C, D>& arg, Tuple0*) { | 443 const Tuple4<A, B, C, D>& arg, Tuple0*) { |
| 379 (obj->*method)(arg.a, arg.b, arg.c, arg.d); | 444 (obj->*method)(arg.a, arg.b, arg.c, arg.d); |
| 380 } | 445 } |
| 381 | 446 |
| 382 template<class ObjT, class Method, class A, class B, class C, class D, class E> | 447 template<class ObjT, class Method, class A, class B, class C, class D, class E> |
| 383 inline void DispatchToMethod(ObjT* obj, Method method, | 448 inline void DispatchToMethod(ObjT* obj, Method method, |
| 384 const Tuple5<A, B, C, D, E>& arg, Tuple0*) { | 449 const Tuple5<A, B, C, D, E>& arg, Tuple0*) { |
| 385 (obj->*method)(arg.a, arg.b, arg.c, arg.d, arg.e); | 450 (obj->*method)(arg.a, arg.b, arg.c, arg.d, arg.e); |
| 386 } | 451 } |
| 387 | 452 |
| 453 template<class ObjT, class Method, class A, class B, class C, class D, class E, |
| 454 class F> |
| 455 inline void DispatchToMethod(ObjT* obj, Method method, |
| 456 const Tuple6<A, B, C, D, E, F>& arg, Tuple0*) { |
| 457 (obj->*method)(arg.a, arg.b, arg.c, arg.d, arg.e, arg.f); |
| 458 } |
| 459 |
| 388 // Dispatchers with 1 out param. | 460 // Dispatchers with 1 out param. |
| 389 | 461 |
| 390 template<class ObjT, class Method, | 462 template<class ObjT, class Method, |
| 391 class OutA> | 463 class OutA> |
| 392 inline void DispatchToMethod(ObjT* obj, Method method, | 464 inline void DispatchToMethod(ObjT* obj, Method method, |
| 393 const Tuple0& in, | 465 const Tuple0& in, |
| 394 Tuple1<OutA>* out) { | 466 Tuple1<OutA>* out) { |
| 395 (obj->*method)(&out->a); | 467 (obj->*method)(&out->a); |
| 396 } | 468 } |
| 397 | 469 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 | 509 |
| 438 template<class ObjT, class Method, | 510 template<class ObjT, class Method, |
| 439 class InA, class InB, class InC, class InD, class InE, | 511 class InA, class InB, class InC, class InD, class InE, |
| 440 class OutA> | 512 class OutA> |
| 441 inline void DispatchToMethod(ObjT* obj, Method method, | 513 inline void DispatchToMethod(ObjT* obj, Method method, |
| 442 const Tuple5<InA, InB, InC, InD, InE>& in, | 514 const Tuple5<InA, InB, InC, InD, InE>& in, |
| 443 Tuple1<OutA>* out) { | 515 Tuple1<OutA>* out) { |
| 444 (obj->*method)(in.a, in.b, in.c, in.d, in.e, &out->a); | 516 (obj->*method)(in.a, in.b, in.c, in.d, in.e, &out->a); |
| 445 } | 517 } |
| 446 | 518 |
| 519 template<class ObjT, class Method, |
| 520 class InA, class InB, class InC, class InD, class InE, class InF, |
| 521 class OutA> |
| 522 inline void DispatchToMethod(ObjT* obj, Method method, |
| 523 const Tuple6<InA, InB, InC, InD, InE, InF>& in, |
| 524 Tuple1<OutA>* out) { |
| 525 (obj->*method)(in.a, in.b, in.c, in.d, in.e, in.f, &out->a); |
| 526 } |
| 527 |
| 447 // Dispatchers with 2 out params. | 528 // Dispatchers with 2 out params. |
| 448 | 529 |
| 449 template<class ObjT, class Method, | 530 template<class ObjT, class Method, |
| 450 class OutA, class OutB> | 531 class OutA, class OutB> |
| 451 inline void DispatchToMethod(ObjT* obj, Method method, | 532 inline void DispatchToMethod(ObjT* obj, Method method, |
| 452 const Tuple0& in, | 533 const Tuple0& in, |
| 453 Tuple2<OutA, OutB>* out) { | 534 Tuple2<OutA, OutB>* out) { |
| 454 (obj->*method)(&out->a, &out->b); | 535 (obj->*method)(&out->a, &out->b); |
| 455 } | 536 } |
| 456 | 537 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 | 577 |
| 497 template<class ObjT, class Method, | 578 template<class ObjT, class Method, |
| 498 class InA, class InB, class InC, class InD, class InE, | 579 class InA, class InB, class InC, class InD, class InE, |
| 499 class OutA, class OutB> | 580 class OutA, class OutB> |
| 500 inline void DispatchToMethod(ObjT* obj, Method method, | 581 inline void DispatchToMethod(ObjT* obj, Method method, |
| 501 const Tuple5<InA, InB, InC, InD, InE>& in, | 582 const Tuple5<InA, InB, InC, InD, InE>& in, |
| 502 Tuple2<OutA, OutB>* out) { | 583 Tuple2<OutA, OutB>* out) { |
| 503 (obj->*method)(in.a, in.b, in.c, in.d, in.e, &out->a, &out->b); | 584 (obj->*method)(in.a, in.b, in.c, in.d, in.e, &out->a, &out->b); |
| 504 } | 585 } |
| 505 | 586 |
| 587 template<class ObjT, class Method, |
| 588 class InA, class InB, class InC, class InD, class InE, class InF, |
| 589 class OutA, class OutB> |
| 590 inline void DispatchToMethod(ObjT* obj, Method method, |
| 591 const Tuple6<InA, InB, InC, InD, InE, InF>& in, |
| 592 Tuple2<OutA, OutB>* out) { |
| 593 (obj->*method)(in.a, in.b, in.c, in.d, in.e, in.f, &out->a, &out->b); |
| 594 } |
| 595 |
| 506 // Dispatchers with 3 out params. | 596 // Dispatchers with 3 out params. |
| 507 | 597 |
| 508 template<class ObjT, class Method, | 598 template<class ObjT, class Method, |
| 509 class OutA, class OutB, class OutC> | 599 class OutA, class OutB, class OutC> |
| 510 inline void DispatchToMethod(ObjT* obj, Method method, | 600 inline void DispatchToMethod(ObjT* obj, Method method, |
| 511 const Tuple0& in, | 601 const Tuple0& in, |
| 512 Tuple3<OutA, OutB, OutC>* out) { | 602 Tuple3<OutA, OutB, OutC>* out) { |
| 513 (obj->*method)(&out->a, &out->b, &out->c); | 603 (obj->*method)(&out->a, &out->b, &out->c); |
| 514 } | 604 } |
| 515 | 605 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 555 | 645 |
| 556 template<class ObjT, class Method, | 646 template<class ObjT, class Method, |
| 557 class InA, class InB, class InC, class InD, class InE, | 647 class InA, class InB, class InC, class InD, class InE, |
| 558 class OutA, class OutB, class OutC> | 648 class OutA, class OutB, class OutC> |
| 559 inline void DispatchToMethod(ObjT* obj, Method method, | 649 inline void DispatchToMethod(ObjT* obj, Method method, |
| 560 const Tuple5<InA, InB, InC, InD, InE>& in, | 650 const Tuple5<InA, InB, InC, InD, InE>& in, |
| 561 Tuple3<OutA, OutB, OutC>* out) { | 651 Tuple3<OutA, OutB, OutC>* out) { |
| 562 (obj->*method)(in.a, in.b, in.c, in.d, in.e, &out->a, &out->b, &out->c); | 652 (obj->*method)(in.a, in.b, in.c, in.d, in.e, &out->a, &out->b, &out->c); |
| 563 } | 653 } |
| 564 | 654 |
| 655 template<class ObjT, class Method, |
| 656 class InA, class InB, class InC, class InD, class InE, class InF, |
| 657 class OutA, class OutB, class OutC> |
| 658 inline void DispatchToMethod(ObjT* obj, Method method, |
| 659 const Tuple6<InA, InB, InC, InD, InE, InF>& in, |
| 660 Tuple3<OutA, OutB, OutC>* out) { |
| 661 (obj->*method)(in.a, in.b, in.c, in.d, in.e, in.f, &out->a, &out->b, &out->c); |
| 662 } |
| 663 |
| 565 // Dispatchers with 4 out params. | 664 // Dispatchers with 4 out params. |
| 566 | 665 |
| 567 template<class ObjT, class Method, | 666 template<class ObjT, class Method, |
| 568 class OutA, class OutB, class OutC, class OutD> | 667 class OutA, class OutB, class OutC, class OutD> |
| 569 inline void DispatchToMethod(ObjT* obj, Method method, | 668 inline void DispatchToMethod(ObjT* obj, Method method, |
| 570 const Tuple0& in, | 669 const Tuple0& in, |
| 571 Tuple4<OutA, OutB, OutC, OutD>* out) { | 670 Tuple4<OutA, OutB, OutC, OutD>* out) { |
| 572 (obj->*method)(&out->a, &out->b, &out->c, &out->d); | 671 (obj->*method)(&out->a, &out->b, &out->c, &out->d); |
| 573 } | 672 } |
| 574 | 673 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 template<class ObjT, class Method, | 714 template<class ObjT, class Method, |
| 616 class InA, class InB, class InC, class InD, class InE, | 715 class InA, class InB, class InC, class InD, class InE, |
| 617 class OutA, class OutB, class OutC, class OutD> | 716 class OutA, class OutB, class OutC, class OutD> |
| 618 inline void DispatchToMethod(ObjT* obj, Method method, | 717 inline void DispatchToMethod(ObjT* obj, Method method, |
| 619 const Tuple5<InA, InB, InC, InD, InE>& in, | 718 const Tuple5<InA, InB, InC, InD, InE>& in, |
| 620 Tuple4<OutA, OutB, OutC, OutD>* out) { | 719 Tuple4<OutA, OutB, OutC, OutD>* out) { |
| 621 (obj->*method)(in.a, in.b, in.c, in.d, in.e, | 720 (obj->*method)(in.a, in.b, in.c, in.d, in.e, |
| 622 &out->a, &out->b, &out->c, &out->d); | 721 &out->a, &out->b, &out->c, &out->d); |
| 623 } | 722 } |
| 624 | 723 |
| 724 template<class ObjT, class Method, |
| 725 class InA, class InB, class InC, class InD, class InE, class InF, |
| 726 class OutA, class OutB, class OutC, class OutD> |
| 727 inline void DispatchToMethod(ObjT* obj, Method method, |
| 728 const Tuple6<InA, InB, InC, InD, InE, InF>& in, |
| 729 Tuple4<OutA, OutB, OutC, OutD>* out) { |
| 730 (obj->*method)(in.a, in.b, in.c, in.d, in.e, in.f, |
| 731 &out->a, &out->b, &out->c, &out->d); |
| 732 } |
| 733 |
| 625 // Dispatchers with 5 out params. | 734 // Dispatchers with 5 out params. |
| 626 | 735 |
| 627 template<class ObjT, class Method, | 736 template<class ObjT, class Method, |
| 628 class OutA, class OutB, class OutC, class OutD, class OutE> | 737 class OutA, class OutB, class OutC, class OutD, class OutE> |
| 629 inline void DispatchToMethod(ObjT* obj, Method method, | 738 inline void DispatchToMethod(ObjT* obj, Method method, |
| 630 const Tuple0& in, | 739 const Tuple0& in, |
| 631 Tuple5<OutA, OutB, OutC, OutD, OutE>* out) { | 740 Tuple5<OutA, OutB, OutC, OutD, OutE>* out) { |
| 632 (obj->*method)(&out->a, &out->b, &out->c, &out->d, &out->e); | 741 (obj->*method)(&out->a, &out->b, &out->c, &out->d, &out->e); |
| 633 } | 742 } |
| 634 | 743 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 676 template<class ObjT, class Method, | 785 template<class ObjT, class Method, |
| 677 class InA, class InB, class InC, class InD, class InE, | 786 class InA, class InB, class InC, class InD, class InE, |
| 678 class OutA, class OutB, class OutC, class OutD, class OutE> | 787 class OutA, class OutB, class OutC, class OutD, class OutE> |
| 679 inline void DispatchToMethod(ObjT* obj, Method method, | 788 inline void DispatchToMethod(ObjT* obj, Method method, |
| 680 const Tuple5<InA, InB, InC, InD, InE>& in, | 789 const Tuple5<InA, InB, InC, InD, InE>& in, |
| 681 Tuple5<OutA, OutB, OutC, OutD, OutE>* out) { | 790 Tuple5<OutA, OutB, OutC, OutD, OutE>* out) { |
| 682 (obj->*method)(in.a, in.b, in.c, in.d, in.e, | 791 (obj->*method)(in.a, in.b, in.c, in.d, in.e, |
| 683 &out->a, &out->b, &out->c, &out->d, &out->e); | 792 &out->a, &out->b, &out->c, &out->d, &out->e); |
| 684 } | 793 } |
| 685 | 794 |
| 795 template<class ObjT, class Method, |
| 796 class InA, class InB, class InC, class InD, class InE, class InF, |
| 797 class OutA, class OutB, class OutC, class OutD, class OutE> |
| 798 inline void DispatchToMethod(ObjT* obj, Method method, |
| 799 const Tuple6<InA, InB, InC, InD, InE, InF>& in, |
| 800 Tuple5<OutA, OutB, OutC, OutD, OutE>* out) { |
| 801 (obj->*method)(in.a, in.b, in.c, in.d, in.e, in.f, |
| 802 &out->a, &out->b, &out->c, &out->d, &out->e); |
| 803 } |
| 804 |
| 686 #endif // BASE_TUPLE_H__ | 805 #endif // BASE_TUPLE_H__ |
| 687 | 806 |
| OLD | NEW |