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 Tuple6, 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 6 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. |
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 (obj->*method)(arg.a, arg.b, arg.c, arg.d, arg.e, arg.f); | 583 (obj->*method)(arg.a, arg.b, arg.c, arg.d, arg.e, arg.f); |
584 } | 584 } |
585 | 585 |
586 template<class ObjT, class Method, class A, class B, class C, class D, class E, | 586 template<class ObjT, class Method, class A, class B, class C, class D, class E, |
587 class F, class G> | 587 class F, class G> |
588 inline void DispatchToMethod(ObjT* obj, Method method, | 588 inline void DispatchToMethod(ObjT* obj, Method method, |
589 const Tuple7<A, B, C, D, E, F, G>& arg) { | 589 const Tuple7<A, B, C, D, E, F, G>& arg) { |
590 (obj->*method)(arg.a, arg.b, arg.c, arg.d, arg.e, arg.f, arg.g); | 590 (obj->*method)(arg.a, arg.b, arg.c, arg.d, arg.e, arg.f, arg.g); |
591 } | 591 } |
592 | 592 |
| 593 template<class ObjT, class Method, class A, class B, class C, class D, class E, |
| 594 class F, class G, class H> |
| 595 inline void DispatchToMethod(ObjT* obj, Method method, |
| 596 const Tuple8<A, B, C, D, E, F, G, H>& arg) { |
| 597 (obj->*method)(arg.a, arg.b, arg.c, arg.d, arg.e, arg.f, arg.g, arg.h); |
| 598 } |
| 599 |
593 // Static Dispatchers with no out params. | 600 // Static Dispatchers with no out params. |
594 | 601 |
595 template <class Function> | 602 template <class Function> |
596 inline void DispatchToFunction(Function function, const Tuple0& arg) { | 603 inline void DispatchToFunction(Function function, const Tuple0& arg) { |
597 (*function)(); | 604 (*function)(); |
598 } | 605 } |
599 | 606 |
600 template <class Function, class A> | 607 template <class Function, class A> |
601 inline void DispatchToFunction(Function function, const A& arg) { | 608 inline void DispatchToFunction(Function function, const A& arg) { |
602 (*function)(arg); | 609 (*function)(arg); |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1040 class InA, class InB, class InC, class InD, class InE, class InF, | 1047 class InA, class InB, class InC, class InD, class InE, class InF, |
1041 class OutA, class OutB, class OutC, class OutD, class OutE> | 1048 class OutA, class OutB, class OutC, class OutD, class OutE> |
1042 inline void DispatchToMethod(ObjT* obj, Method method, | 1049 inline void DispatchToMethod(ObjT* obj, Method method, |
1043 const Tuple6<InA, InB, InC, InD, InE, InF>& in, | 1050 const Tuple6<InA, InB, InC, InD, InE, InF>& in, |
1044 Tuple5<OutA, OutB, OutC, OutD, OutE>* out) { | 1051 Tuple5<OutA, OutB, OutC, OutD, OutE>* out) { |
1045 (obj->*method)(in.a, in.b, in.c, in.d, in.e, in.f, | 1052 (obj->*method)(in.a, in.b, in.c, in.d, in.e, in.f, |
1046 &out->a, &out->b, &out->c, &out->d, &out->e); | 1053 &out->a, &out->b, &out->c, &out->d, &out->e); |
1047 } | 1054 } |
1048 | 1055 |
1049 #endif // BASE_TUPLE_H__ | 1056 #endif // BASE_TUPLE_H__ |
OLD | NEW |