license.bot | f003cfe | 2008-08-24 09:55:55 +0900 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
initial.commit | 3f4a732 | 2008-07-27 06:49:38 +0900 | [diff] [blame] | 4 | |
deanm@google.com | 96aac0a | 2008-08-25 22:42:07 +0900 | [diff] [blame] | 5 | // A Tuple is a generic templatized container, similar in concept to std::pair. |
ojan@google.com | 3835509 | 2008-10-10 06:58:05 +0900 | [diff] [blame] | 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, |
deanm@google.com | 96aac0a | 2008-08-25 22:42:07 +0900 | [diff] [blame] | 8 | // and will construct and return the appropriate Tuple object. The functions |
| 9 | // DispatchToMethod and DispatchToFunction take a function pointer or instance |
| 10 | // and method pointer, and unpack a tuple into arguments to the call. |
| 11 | // |
| 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. |
| 14 | // |
| 15 | // Example usage: |
| 16 | // // These two methods of creating a Tuple are identical. |
| 17 | // Tuple2<int, const char*> tuple_a(1, "wee"); |
| 18 | // Tuple2<int, const char*> tuple_b = MakeTuple(1, "wee"); |
| 19 | // |
| 20 | // void SomeFunc(int a, const char* b) { } |
| 21 | // DispatchToFunction(&SomeFunc, tuple_a); // SomeFunc(1, "wee") |
| 22 | // DispatchToFunction( |
| 23 | // &SomeFunc, MakeTuple(10, "foo")); // SomeFunc(10, "foo") |
| 24 | // |
| 25 | // struct { void SomeMeth(int a, int b, int c) { } } foo; |
| 26 | // DispatchToMethod(&foo, &Foo::SomeMeth, MakeTuple(1, 2, 3)); |
| 27 | // // foo->SomeMeth(1, 2, 3); |
| 28 | |
initial.commit | 3f4a732 | 2008-07-27 06:49:38 +0900 | [diff] [blame] | 29 | #ifndef BASE_TUPLE_H__ |
| 30 | #define BASE_TUPLE_H__ |
| 31 | |
| 32 | // Traits ---------------------------------------------------------------------- |
| 33 | // |
| 34 | // A simple traits class for tuple arguments. |
| 35 | // |
| 36 | // ValueType: the bare, nonref version of a type (same as the type for nonrefs). |
| 37 | // RefType: the ref version of a type (same as the type for refs). |
| 38 | // ParamType: what type to pass to functions (refs should not be constified). |
| 39 | |
| 40 | template <class P> |
| 41 | struct TupleTraits { |
| 42 | typedef P ValueType; |
| 43 | typedef P& RefType; |
| 44 | typedef const P& ParamType; |
| 45 | }; |
| 46 | |
| 47 | template <class P> |
| 48 | struct TupleTraits<P&> { |
| 49 | typedef P ValueType; |
| 50 | typedef P& RefType; |
| 51 | typedef P& ParamType; |
| 52 | }; |
| 53 | |
| 54 | // Tuple ----------------------------------------------------------------------- |
| 55 | // |
| 56 | // This set of classes is useful for bundling 0 or more heterogeneous data types |
| 57 | // into a single variable. The advantage of this is that it greatly simplifies |
| 58 | // function objects that need to take an arbitrary number of parameters; see |
| 59 | // RunnableMethod and IPC::MessageWithTuple. |
| 60 | // |
deanm@google.com | ff4b729 | 2008-08-21 19:58:08 +0900 | [diff] [blame] | 61 | // Tuple0 is supplied to act as a 'void' type. It can be used, for example, |
| 62 | // when dispatching to a function that accepts no arguments (see the |
| 63 | // Dispatchers below). |
initial.commit | 3f4a732 | 2008-07-27 06:49:38 +0900 | [diff] [blame] | 64 | // Tuple1<A> is rarely useful. One such use is when A is non-const ref that you |
| 65 | // want filled by the dispatchee, and the tuple is merely a container for that |
| 66 | // output (a "tier"). See MakeRefTuple and its usages. |
| 67 | |
| 68 | struct Tuple0 { |
| 69 | typedef Tuple0 ValueTuple; |
| 70 | typedef Tuple0 RefTuple; |
mpcomplete@google.com | a74ef82 | 2009-05-21 03:24:14 +0900 | [diff] [blame^] | 71 | typedef Tuple0 ParamTuple; |
initial.commit | 3f4a732 | 2008-07-27 06:49:38 +0900 | [diff] [blame] | 72 | }; |
| 73 | |
| 74 | template <class A> |
| 75 | struct Tuple1 { |
| 76 | public: |
| 77 | typedef A TypeA; |
| 78 | typedef Tuple1<typename TupleTraits<A>::ValueType> ValueTuple; |
| 79 | typedef Tuple1<typename TupleTraits<A>::RefType> RefTuple; |
mpcomplete@google.com | a74ef82 | 2009-05-21 03:24:14 +0900 | [diff] [blame^] | 80 | typedef Tuple1<typename TupleTraits<A>::ParamType> ParamTuple; |
initial.commit | 3f4a732 | 2008-07-27 06:49:38 +0900 | [diff] [blame] | 81 | |
| 82 | Tuple1() {} |
| 83 | explicit Tuple1(typename TupleTraits<A>::ParamType a) : a(a) {} |
| 84 | |
| 85 | A a; |
| 86 | }; |
| 87 | |
| 88 | template <class A, class B> |
| 89 | struct Tuple2 { |
| 90 | public: |
| 91 | typedef A TypeA; |
| 92 | typedef B TypeB; |
| 93 | typedef Tuple2<typename TupleTraits<A>::ValueType, |
| 94 | typename TupleTraits<B>::ValueType> ValueTuple; |
| 95 | typedef Tuple2<typename TupleTraits<A>::RefType, |
| 96 | typename TupleTraits<B>::RefType> RefTuple; |
mpcomplete@google.com | a74ef82 | 2009-05-21 03:24:14 +0900 | [diff] [blame^] | 97 | typedef Tuple2<typename TupleTraits<A>::ParamType, |
| 98 | typename TupleTraits<B>::ParamType> ParamTuple; |
initial.commit | 3f4a732 | 2008-07-27 06:49:38 +0900 | [diff] [blame] | 99 | |
| 100 | Tuple2() {} |
| 101 | Tuple2(typename TupleTraits<A>::ParamType a, |
| 102 | typename TupleTraits<B>::ParamType b) |
| 103 | : a(a), b(b) { |
| 104 | } |
| 105 | |
| 106 | A a; |
| 107 | B b; |
| 108 | }; |
| 109 | |
| 110 | template <class A, class B, class C> |
| 111 | struct Tuple3 { |
| 112 | public: |
| 113 | typedef A TypeA; |
| 114 | typedef B TypeB; |
| 115 | typedef C TypeC; |
| 116 | typedef Tuple3<typename TupleTraits<A>::ValueType, |
| 117 | typename TupleTraits<B>::ValueType, |
| 118 | typename TupleTraits<C>::ValueType> ValueTuple; |
| 119 | typedef Tuple3<typename TupleTraits<A>::RefType, |
| 120 | typename TupleTraits<B>::RefType, |
| 121 | typename TupleTraits<C>::RefType> RefTuple; |
mpcomplete@google.com | a74ef82 | 2009-05-21 03:24:14 +0900 | [diff] [blame^] | 122 | typedef Tuple3<typename TupleTraits<A>::ParamType, |
| 123 | typename TupleTraits<B>::ParamType, |
| 124 | typename TupleTraits<C>::ParamType> ParamTuple; |
initial.commit | 3f4a732 | 2008-07-27 06:49:38 +0900 | [diff] [blame] | 125 | |
| 126 | Tuple3() {} |
| 127 | Tuple3(typename TupleTraits<A>::ParamType a, |
| 128 | typename TupleTraits<B>::ParamType b, |
| 129 | typename TupleTraits<C>::ParamType c) |
| 130 | : a(a), b(b), c(c){ |
| 131 | } |
| 132 | |
| 133 | A a; |
| 134 | B b; |
| 135 | C c; |
| 136 | }; |
| 137 | |
| 138 | template <class A, class B, class C, class D> |
| 139 | struct Tuple4 { |
| 140 | public: |
| 141 | typedef A TypeA; |
| 142 | typedef B TypeB; |
| 143 | typedef C TypeC; |
| 144 | typedef D TypeD; |
| 145 | typedef Tuple4<typename TupleTraits<A>::ValueType, |
| 146 | typename TupleTraits<B>::ValueType, |
| 147 | typename TupleTraits<C>::ValueType, |
| 148 | typename TupleTraits<D>::ValueType> ValueTuple; |
| 149 | typedef Tuple4<typename TupleTraits<A>::RefType, |
| 150 | typename TupleTraits<B>::RefType, |
| 151 | typename TupleTraits<C>::RefType, |
| 152 | typename TupleTraits<D>::RefType> RefTuple; |
mpcomplete@google.com | a74ef82 | 2009-05-21 03:24:14 +0900 | [diff] [blame^] | 153 | typedef Tuple4<typename TupleTraits<A>::ParamType, |
| 154 | typename TupleTraits<B>::ParamType, |
| 155 | typename TupleTraits<C>::ParamType, |
| 156 | typename TupleTraits<D>::ParamType> ParamTuple; |
initial.commit | 3f4a732 | 2008-07-27 06:49:38 +0900 | [diff] [blame] | 157 | |
| 158 | Tuple4() {} |
| 159 | Tuple4(typename TupleTraits<A>::ParamType a, |
| 160 | typename TupleTraits<B>::ParamType b, |
| 161 | typename TupleTraits<C>::ParamType c, |
| 162 | typename TupleTraits<D>::ParamType d) |
| 163 | : a(a), b(b), c(c), d(d) { |
| 164 | } |
| 165 | |
| 166 | A a; |
| 167 | B b; |
| 168 | C c; |
| 169 | D d; |
| 170 | }; |
| 171 | |
| 172 | template <class A, class B, class C, class D, class E> |
| 173 | struct Tuple5 { |
| 174 | public: |
| 175 | typedef A TypeA; |
| 176 | typedef B TypeB; |
| 177 | typedef C TypeC; |
| 178 | typedef D TypeD; |
| 179 | typedef E TypeE; |
| 180 | typedef Tuple5<typename TupleTraits<A>::ValueType, |
| 181 | typename TupleTraits<B>::ValueType, |
| 182 | typename TupleTraits<C>::ValueType, |
| 183 | typename TupleTraits<D>::ValueType, |
| 184 | typename TupleTraits<E>::ValueType> ValueTuple; |
| 185 | typedef Tuple5<typename TupleTraits<A>::RefType, |
| 186 | typename TupleTraits<B>::RefType, |
| 187 | typename TupleTraits<C>::RefType, |
| 188 | typename TupleTraits<D>::RefType, |
| 189 | typename TupleTraits<E>::RefType> RefTuple; |
mpcomplete@google.com | a74ef82 | 2009-05-21 03:24:14 +0900 | [diff] [blame^] | 190 | typedef Tuple5<typename TupleTraits<A>::ParamType, |
| 191 | typename TupleTraits<B>::ParamType, |
| 192 | typename TupleTraits<C>::ParamType, |
| 193 | typename TupleTraits<D>::ParamType, |
| 194 | typename TupleTraits<E>::ParamType> ParamTuple; |
initial.commit | 3f4a732 | 2008-07-27 06:49:38 +0900 | [diff] [blame] | 195 | |
| 196 | Tuple5() {} |
| 197 | Tuple5(typename TupleTraits<A>::ParamType a, |
| 198 | typename TupleTraits<B>::ParamType b, |
| 199 | typename TupleTraits<C>::ParamType c, |
| 200 | typename TupleTraits<D>::ParamType d, |
| 201 | typename TupleTraits<E>::ParamType e) |
| 202 | : a(a), b(b), c(c), d(d), e(e) { |
| 203 | } |
| 204 | |
| 205 | A a; |
| 206 | B b; |
| 207 | C c; |
| 208 | D d; |
| 209 | E e; |
| 210 | }; |
| 211 | |
ojan@google.com | 3835509 | 2008-10-10 06:58:05 +0900 | [diff] [blame] | 212 | template <class A, class B, class C, class D, class E, class F> |
| 213 | struct Tuple6 { |
| 214 | public: |
| 215 | typedef A TypeA; |
| 216 | typedef B TypeB; |
| 217 | typedef C TypeC; |
| 218 | typedef D TypeD; |
| 219 | typedef E TypeE; |
| 220 | typedef F TypeF; |
| 221 | typedef Tuple6<typename TupleTraits<A>::ValueType, |
| 222 | typename TupleTraits<B>::ValueType, |
| 223 | typename TupleTraits<C>::ValueType, |
| 224 | typename TupleTraits<D>::ValueType, |
| 225 | typename TupleTraits<E>::ValueType, |
| 226 | typename TupleTraits<F>::ValueType> ValueTuple; |
| 227 | typedef Tuple6<typename TupleTraits<A>::RefType, |
| 228 | typename TupleTraits<B>::RefType, |
| 229 | typename TupleTraits<C>::RefType, |
| 230 | typename TupleTraits<D>::RefType, |
| 231 | typename TupleTraits<E>::RefType, |
| 232 | typename TupleTraits<F>::RefType> RefTuple; |
mpcomplete@google.com | a74ef82 | 2009-05-21 03:24:14 +0900 | [diff] [blame^] | 233 | typedef Tuple6<typename TupleTraits<A>::ParamType, |
| 234 | typename TupleTraits<B>::ParamType, |
| 235 | typename TupleTraits<C>::ParamType, |
| 236 | typename TupleTraits<D>::ParamType, |
| 237 | typename TupleTraits<E>::ParamType, |
| 238 | typename TupleTraits<F>::ParamType> ParamTuple; |
ojan@google.com | 3835509 | 2008-10-10 06:58:05 +0900 | [diff] [blame] | 239 | |
| 240 | Tuple6() {} |
| 241 | Tuple6(typename TupleTraits<A>::ParamType a, |
| 242 | typename TupleTraits<B>::ParamType b, |
| 243 | typename TupleTraits<C>::ParamType c, |
| 244 | typename TupleTraits<D>::ParamType d, |
| 245 | typename TupleTraits<E>::ParamType e, |
| 246 | typename TupleTraits<F>::ParamType f) |
| 247 | : a(a), b(b), c(c), d(d), e(e), f(f) { |
| 248 | } |
| 249 | |
| 250 | A a; |
| 251 | B b; |
| 252 | C c; |
| 253 | D d; |
| 254 | E e; |
| 255 | F f; |
| 256 | }; |
| 257 | |
sky@google.com | 67c3575 | 2008-11-13 07:10:20 +0900 | [diff] [blame] | 258 | template <class A, class B, class C, class D, class E, class F, class G> |
| 259 | struct Tuple7 { |
| 260 | public: |
| 261 | typedef A TypeA; |
| 262 | typedef B TypeB; |
| 263 | typedef C TypeC; |
| 264 | typedef D TypeD; |
| 265 | typedef E TypeE; |
| 266 | typedef F TypeF; |
| 267 | typedef G TypeG; |
| 268 | typedef Tuple7<typename TupleTraits<A>::ValueType, |
| 269 | typename TupleTraits<B>::ValueType, |
| 270 | typename TupleTraits<C>::ValueType, |
| 271 | typename TupleTraits<D>::ValueType, |
| 272 | typename TupleTraits<E>::ValueType, |
| 273 | typename TupleTraits<F>::ValueType, |
| 274 | typename TupleTraits<G>::ValueType> ValueTuple; |
| 275 | typedef Tuple7<typename TupleTraits<A>::RefType, |
| 276 | typename TupleTraits<B>::RefType, |
| 277 | typename TupleTraits<C>::RefType, |
| 278 | typename TupleTraits<D>::RefType, |
| 279 | typename TupleTraits<E>::RefType, |
| 280 | typename TupleTraits<F>::RefType, |
| 281 | typename TupleTraits<G>::RefType> RefTuple; |
mpcomplete@google.com | a74ef82 | 2009-05-21 03:24:14 +0900 | [diff] [blame^] | 282 | typedef Tuple7<typename TupleTraits<A>::ParamType, |
| 283 | typename TupleTraits<B>::ParamType, |
| 284 | typename TupleTraits<C>::ParamType, |
| 285 | typename TupleTraits<D>::ParamType, |
| 286 | typename TupleTraits<E>::ParamType, |
| 287 | typename TupleTraits<F>::ParamType, |
| 288 | typename TupleTraits<G>::ParamType> ParamTuple; |
sky@google.com | 67c3575 | 2008-11-13 07:10:20 +0900 | [diff] [blame] | 289 | |
| 290 | Tuple7() {} |
| 291 | Tuple7(typename TupleTraits<A>::ParamType a, |
| 292 | typename TupleTraits<B>::ParamType b, |
| 293 | typename TupleTraits<C>::ParamType c, |
| 294 | typename TupleTraits<D>::ParamType d, |
| 295 | typename TupleTraits<E>::ParamType e, |
| 296 | typename TupleTraits<F>::ParamType f, |
| 297 | typename TupleTraits<G>::ParamType g) |
| 298 | : a(a), b(b), c(c), d(d), e(e), f(f), g(g) { |
| 299 | } |
| 300 | |
| 301 | A a; |
| 302 | B b; |
| 303 | C c; |
| 304 | D d; |
| 305 | E e; |
| 306 | F f; |
| 307 | G g; |
| 308 | }; |
| 309 | |
initial.commit | 3f4a732 | 2008-07-27 06:49:38 +0900 | [diff] [blame] | 310 | // Tuple creators ------------------------------------------------------------- |
| 311 | // |
| 312 | // Helper functions for constructing tuples while inferring the template |
| 313 | // argument types. |
| 314 | |
| 315 | inline Tuple0 MakeTuple() { |
| 316 | return Tuple0(); |
| 317 | } |
| 318 | |
| 319 | template <class A> |
| 320 | inline Tuple1<A> MakeTuple(const A& a) { |
| 321 | return Tuple1<A>(a); |
| 322 | } |
| 323 | |
| 324 | template <class A, class B> |
| 325 | inline Tuple2<A, B> MakeTuple(const A& a, const B& b) { |
| 326 | return Tuple2<A, B>(a, b); |
| 327 | } |
| 328 | |
| 329 | template <class A, class B, class C> |
| 330 | inline Tuple3<A, B, C> MakeTuple(const A& a, const B& b, const C& c) { |
| 331 | return Tuple3<A, B, C>(a, b, c); |
| 332 | } |
| 333 | |
| 334 | template <class A, class B, class C, class D> |
| 335 | inline Tuple4<A, B, C, D> MakeTuple(const A& a, const B& b, const C& c, |
| 336 | const D& d) { |
| 337 | return Tuple4<A, B, C, D>(a, b, c, d); |
| 338 | } |
| 339 | |
| 340 | template <class A, class B, class C, class D, class E> |
| 341 | inline Tuple5<A, B, C, D, E> MakeTuple(const A& a, const B& b, const C& c, |
| 342 | const D& d, const E& e) { |
| 343 | return Tuple5<A, B, C, D, E>(a, b, c, d, e); |
| 344 | } |
| 345 | |
ojan@google.com | 3835509 | 2008-10-10 06:58:05 +0900 | [diff] [blame] | 346 | template <class A, class B, class C, class D, class E, class F> |
| 347 | inline Tuple6<A, B, C, D, E, F> MakeTuple(const A& a, const B& b, const C& c, |
| 348 | const D& d, const E& e, const F& f) { |
| 349 | return Tuple6<A, B, C, D, E, F>(a, b, c, d, e, f); |
| 350 | } |
| 351 | |
sky@google.com | 67c3575 | 2008-11-13 07:10:20 +0900 | [diff] [blame] | 352 | template <class A, class B, class C, class D, class E, class F, class G> |
| 353 | inline Tuple7<A, B, C, D, E, F, G> MakeTuple(const A& a, const B& b, const C& c, |
| 354 | const D& d, const E& e, const F& f, |
| 355 | const G& g) { |
| 356 | return Tuple7<A, B, C, D, E, F, G>(a, b, c, d, e, f, g); |
| 357 | } |
| 358 | |
initial.commit | 3f4a732 | 2008-07-27 06:49:38 +0900 | [diff] [blame] | 359 | // The following set of helpers make what Boost refers to as "Tiers" - a tuple |
| 360 | // of references. |
| 361 | |
| 362 | template <class A> |
| 363 | inline Tuple1<A&> MakeRefTuple(A& a) { |
| 364 | return Tuple1<A&>(a); |
| 365 | } |
| 366 | |
| 367 | template <class A, class B> |
| 368 | inline Tuple2<A&, B&> MakeRefTuple(A& a, B& b) { |
| 369 | return Tuple2<A&, B&>(a, b); |
| 370 | } |
| 371 | |
| 372 | template <class A, class B, class C> |
| 373 | inline Tuple3<A&, B&, C&> MakeRefTuple(A& a, B& b, C& c) { |
| 374 | return Tuple3<A&, B&, C&>(a, b, c); |
| 375 | } |
| 376 | |
| 377 | template <class A, class B, class C, class D> |
| 378 | inline Tuple4<A&, B&, C&, D&> MakeRefTuple(A& a, B& b, C& c, D& d) { |
| 379 | return Tuple4<A&, B&, C&, D&>(a, b, c, d); |
| 380 | } |
| 381 | |
| 382 | template <class A, class B, class C, class D, class E> |
| 383 | inline Tuple5<A&, B&, C&, D&, E&> MakeRefTuple(A& a, B& b, C& c, D& d, E& e) { |
| 384 | return Tuple5<A&, B&, C&, D&, E&>(a, b, c, d, e); |
| 385 | } |
| 386 | |
ojan@google.com | 3835509 | 2008-10-10 06:58:05 +0900 | [diff] [blame] | 387 | template <class A, class B, class C, class D, class E, class F> |
| 388 | inline Tuple6<A&, B&, C&, D&, E&, F&> MakeRefTuple(A& a, B& b, C& c, D& d, E& e, |
| 389 | F& f) { |
| 390 | return Tuple6<A&, B&, C&, D&, E&, F&>(a, b, c, d, e, f); |
| 391 | } |
| 392 | |
sky@google.com | 67c3575 | 2008-11-13 07:10:20 +0900 | [diff] [blame] | 393 | template <class A, class B, class C, class D, class E, class F, class G> |
| 394 | inline Tuple7<A&, B&, C&, D&, E&, F&, G&> MakeRefTuple(A& a, B& b, C& c, D& d, |
| 395 | E& e, F& f, G& g) { |
| 396 | return Tuple7<A&, B&, C&, D&, E&, F&, G&>(a, b, c, d, e, f, g); |
| 397 | } |
| 398 | |
initial.commit | 3f4a732 | 2008-07-27 06:49:38 +0900 | [diff] [blame] | 399 | // Dispatchers ---------------------------------------------------------------- |
| 400 | // |
| 401 | // Helper functions that call the given method on an object, with the unpacked |
| 402 | // tuple arguments. Notice that they all have the same number of arguments, |
| 403 | // so you need only write: |
| 404 | // DispatchToMethod(object, &Object::method, args); |
| 405 | // This is very useful for templated dispatchers, since they don't need to know |
| 406 | // what type |args| is. |
| 407 | |
| 408 | // Non-Static Dispatchers with no out params. |
| 409 | |
| 410 | template <class ObjT, class Method> |
| 411 | inline void DispatchToMethod(ObjT* obj, Method method, const Tuple0& arg) { |
| 412 | (obj->*method)(); |
| 413 | } |
| 414 | |
| 415 | template <class ObjT, class Method, class A> |
| 416 | inline void DispatchToMethod(ObjT* obj, Method method, const A& arg) { |
| 417 | (obj->*method)(arg); |
| 418 | } |
| 419 | |
| 420 | template <class ObjT, class Method, class A> |
| 421 | inline void DispatchToMethod(ObjT* obj, Method method, const Tuple1<A>& arg) { |
| 422 | (obj->*method)(arg.a); |
| 423 | } |
| 424 | |
| 425 | template<class ObjT, class Method, class A, class B> |
maruel@chromium.org | 8fe7adc | 2009-03-04 00:01:12 +0900 | [diff] [blame] | 426 | inline void DispatchToMethod(ObjT* obj, |
| 427 | Method method, |
| 428 | const Tuple2<A, B>& arg) { |
initial.commit | 3f4a732 | 2008-07-27 06:49:38 +0900 | [diff] [blame] | 429 | (obj->*method)(arg.a, arg.b); |
| 430 | } |
| 431 | |
| 432 | template<class ObjT, class Method, class A, class B, class C> |
| 433 | inline void DispatchToMethod(ObjT* obj, Method method, |
| 434 | const Tuple3<A, B, C>& arg) { |
| 435 | (obj->*method)(arg.a, arg.b, arg.c); |
| 436 | } |
| 437 | |
| 438 | template<class ObjT, class Method, class A, class B, class C, class D> |
| 439 | inline void DispatchToMethod(ObjT* obj, Method method, |
| 440 | const Tuple4<A, B, C, D>& arg) { |
| 441 | (obj->*method)(arg.a, arg.b, arg.c, arg.d); |
| 442 | } |
| 443 | |
| 444 | template<class ObjT, class Method, class A, class B, class C, class D, class E> |
| 445 | inline void DispatchToMethod(ObjT* obj, Method method, |
| 446 | const Tuple5<A, B, C, D, E>& arg) { |
| 447 | (obj->*method)(arg.a, arg.b, arg.c, arg.d, arg.e); |
| 448 | } |
| 449 | |
ojan@google.com | 3835509 | 2008-10-10 06:58:05 +0900 | [diff] [blame] | 450 | template<class ObjT, class Method, class A, class B, class C, class D, class E, |
| 451 | class F> |
| 452 | inline void DispatchToMethod(ObjT* obj, Method method, |
| 453 | const Tuple6<A, B, C, D, E, F>& arg) { |
| 454 | (obj->*method)(arg.a, arg.b, arg.c, arg.d, arg.e, arg.f); |
| 455 | } |
| 456 | |
sky@google.com | 67c3575 | 2008-11-13 07:10:20 +0900 | [diff] [blame] | 457 | template<class ObjT, class Method, class A, class B, class C, class D, class E, |
| 458 | class F, class G> |
| 459 | inline void DispatchToMethod(ObjT* obj, Method method, |
| 460 | const Tuple7<A, B, C, D, E, F, G>& arg) { |
| 461 | (obj->*method)(arg.a, arg.b, arg.c, arg.d, arg.e, arg.f, arg.g); |
| 462 | } |
| 463 | |
initial.commit | 3f4a732 | 2008-07-27 06:49:38 +0900 | [diff] [blame] | 464 | // Static Dispatchers with no out params. |
| 465 | |
| 466 | template <class Function> |
| 467 | inline void DispatchToFunction(Function function, const Tuple0& arg) { |
| 468 | (*function)(); |
| 469 | } |
| 470 | |
| 471 | template <class Function, class A> |
| 472 | inline void DispatchToFunction(Function function, const A& arg) { |
| 473 | (*function)(arg); |
| 474 | } |
| 475 | |
| 476 | template <class Function, class A> |
| 477 | inline void DispatchToFunction(Function function, const Tuple1<A>& arg) { |
| 478 | (*function)(arg.a); |
| 479 | } |
| 480 | |
| 481 | template<class Function, class A, class B> |
| 482 | inline void DispatchToFunction(Function function, const Tuple2<A, B>& arg) { |
| 483 | (*function)(arg.a, arg.b); |
| 484 | } |
| 485 | |
| 486 | template<class Function, class A, class B, class C> |
| 487 | inline void DispatchToFunction(Function function, const Tuple3<A, B, C>& arg) { |
| 488 | (*function)(arg.a, arg.b, arg.c); |
| 489 | } |
| 490 | |
| 491 | template<class Function, class A, class B, class C, class D> |
| 492 | inline void DispatchToFunction(Function function, |
| 493 | const Tuple4<A, B, C, D>& arg) { |
| 494 | (*function)(arg.a, arg.b, arg.c, arg.d); |
| 495 | } |
| 496 | |
| 497 | template<class Function, class A, class B, class C, class D, class E> |
| 498 | inline void DispatchToFunction(Function function, |
| 499 | const Tuple5<A, B, C, D, E>& arg) { |
| 500 | (*function)(arg.a, arg.b, arg.c, arg.d, arg.e); |
| 501 | } |
| 502 | |
ojan@google.com | 3835509 | 2008-10-10 06:58:05 +0900 | [diff] [blame] | 503 | template<class Function, class A, class B, class C, class D, class E, class F> |
| 504 | inline void DispatchToFunction(Function function, |
| 505 | const Tuple6<A, B, C, D, E, F>& arg) { |
| 506 | (*function)(arg.a, arg.b, arg.c, arg.d, arg.e, arg.f); |
| 507 | } |
| 508 | |
initial.commit | 3f4a732 | 2008-07-27 06:49:38 +0900 | [diff] [blame] | 509 | // Dispatchers with 0 out param (as a Tuple0). |
| 510 | |
| 511 | template <class ObjT, class Method> |
maruel@chromium.org | 8fe7adc | 2009-03-04 00:01:12 +0900 | [diff] [blame] | 512 | inline void DispatchToMethod(ObjT* obj, |
| 513 | Method method, |
| 514 | const Tuple0& arg, Tuple0*) { |
initial.commit | 3f4a732 | 2008-07-27 06:49:38 +0900 | [diff] [blame] | 515 | (obj->*method)(); |
| 516 | } |
| 517 | |
| 518 | template <class ObjT, class Method, class A> |
| 519 | inline void DispatchToMethod(ObjT* obj, Method method, const A& arg, Tuple0*) { |
| 520 | (obj->*method)(arg); |
| 521 | } |
| 522 | |
| 523 | template <class ObjT, class Method, class A> |
maruel@chromium.org | 8fe7adc | 2009-03-04 00:01:12 +0900 | [diff] [blame] | 524 | inline void DispatchToMethod(ObjT* obj, |
| 525 | Method method, |
| 526 | const Tuple1<A>& arg, Tuple0*) { |
initial.commit | 3f4a732 | 2008-07-27 06:49:38 +0900 | [diff] [blame] | 527 | (obj->*method)(arg.a); |
| 528 | } |
| 529 | |
| 530 | template<class ObjT, class Method, class A, class B> |
maruel@chromium.org | 8fe7adc | 2009-03-04 00:01:12 +0900 | [diff] [blame] | 531 | inline void DispatchToMethod(ObjT* obj, |
| 532 | Method method, |
| 533 | const Tuple2<A, B>& arg, Tuple0*) { |
initial.commit | 3f4a732 | 2008-07-27 06:49:38 +0900 | [diff] [blame] | 534 | (obj->*method)(arg.a, arg.b); |
| 535 | } |
| 536 | |
| 537 | template<class ObjT, class Method, class A, class B, class C> |
| 538 | inline void DispatchToMethod(ObjT* obj, Method method, |
| 539 | const Tuple3<A, B, C>& arg, Tuple0*) { |
| 540 | (obj->*method)(arg.a, arg.b, arg.c); |
| 541 | } |
| 542 | |
| 543 | template<class ObjT, class Method, class A, class B, class C, class D> |
| 544 | inline void DispatchToMethod(ObjT* obj, Method method, |
| 545 | const Tuple4<A, B, C, D>& arg, Tuple0*) { |
| 546 | (obj->*method)(arg.a, arg.b, arg.c, arg.d); |
| 547 | } |
| 548 | |
| 549 | template<class ObjT, class Method, class A, class B, class C, class D, class E> |
| 550 | inline void DispatchToMethod(ObjT* obj, Method method, |
| 551 | const Tuple5<A, B, C, D, E>& arg, Tuple0*) { |
| 552 | (obj->*method)(arg.a, arg.b, arg.c, arg.d, arg.e); |
| 553 | } |
| 554 | |
ojan@google.com | 3835509 | 2008-10-10 06:58:05 +0900 | [diff] [blame] | 555 | template<class ObjT, class Method, class A, class B, class C, class D, class E, |
| 556 | class F> |
| 557 | inline void DispatchToMethod(ObjT* obj, Method method, |
| 558 | const Tuple6<A, B, C, D, E, F>& arg, Tuple0*) { |
| 559 | (obj->*method)(arg.a, arg.b, arg.c, arg.d, arg.e, arg.f); |
| 560 | } |
| 561 | |
initial.commit | 3f4a732 | 2008-07-27 06:49:38 +0900 | [diff] [blame] | 562 | // Dispatchers with 1 out param. |
| 563 | |
| 564 | template<class ObjT, class Method, |
| 565 | class OutA> |
| 566 | inline void DispatchToMethod(ObjT* obj, Method method, |
| 567 | const Tuple0& in, |
| 568 | Tuple1<OutA>* out) { |
| 569 | (obj->*method)(&out->a); |
| 570 | } |
| 571 | |
| 572 | template<class ObjT, class Method, class InA, |
| 573 | class OutA> |
| 574 | inline void DispatchToMethod(ObjT* obj, Method method, |
| 575 | const InA& in, |
| 576 | Tuple1<OutA>* out) { |
| 577 | (obj->*method)(in, &out->a); |
| 578 | } |
| 579 | |
| 580 | template<class ObjT, class Method, class InA, |
| 581 | class OutA> |
| 582 | inline void DispatchToMethod(ObjT* obj, Method method, |
| 583 | const Tuple1<InA>& in, |
| 584 | Tuple1<OutA>* out) { |
| 585 | (obj->*method)(in.a, &out->a); |
| 586 | } |
| 587 | |
| 588 | template<class ObjT, class Method, class InA, class InB, |
| 589 | class OutA> |
| 590 | inline void DispatchToMethod(ObjT* obj, Method method, |
| 591 | const Tuple2<InA, InB>& in, |
| 592 | Tuple1<OutA>* out) { |
| 593 | (obj->*method)(in.a, in.b, &out->a); |
| 594 | } |
| 595 | |
| 596 | template<class ObjT, class Method, class InA, class InB, class InC, |
| 597 | class OutA> |
| 598 | inline void DispatchToMethod(ObjT* obj, Method method, |
| 599 | const Tuple3<InA, InB, InC>& in, |
| 600 | Tuple1<OutA>* out) { |
| 601 | (obj->*method)(in.a, in.b, in.c, &out->a); |
| 602 | } |
| 603 | |
| 604 | template<class ObjT, class Method, class InA, class InB, class InC, class InD, |
| 605 | class OutA> |
| 606 | inline void DispatchToMethod(ObjT* obj, Method method, |
| 607 | const Tuple4<InA, InB, InC, InD>& in, |
| 608 | Tuple1<OutA>* out) { |
| 609 | (obj->*method)(in.a, in.b, in.c, in.d, &out->a); |
| 610 | } |
| 611 | |
| 612 | template<class ObjT, class Method, |
| 613 | class InA, class InB, class InC, class InD, class InE, |
| 614 | class OutA> |
| 615 | inline void DispatchToMethod(ObjT* obj, Method method, |
| 616 | const Tuple5<InA, InB, InC, InD, InE>& in, |
| 617 | Tuple1<OutA>* out) { |
| 618 | (obj->*method)(in.a, in.b, in.c, in.d, in.e, &out->a); |
| 619 | } |
| 620 | |
ojan@google.com | 3835509 | 2008-10-10 06:58:05 +0900 | [diff] [blame] | 621 | template<class ObjT, class Method, |
| 622 | class InA, class InB, class InC, class InD, class InE, class InF, |
| 623 | class OutA> |
| 624 | inline void DispatchToMethod(ObjT* obj, Method method, |
| 625 | const Tuple6<InA, InB, InC, InD, InE, InF>& in, |
| 626 | Tuple1<OutA>* out) { |
| 627 | (obj->*method)(in.a, in.b, in.c, in.d, in.e, in.f, &out->a); |
| 628 | } |
| 629 | |
initial.commit | 3f4a732 | 2008-07-27 06:49:38 +0900 | [diff] [blame] | 630 | // Dispatchers with 2 out params. |
| 631 | |
| 632 | template<class ObjT, class Method, |
| 633 | class OutA, class OutB> |
| 634 | inline void DispatchToMethod(ObjT* obj, Method method, |
| 635 | const Tuple0& in, |
| 636 | Tuple2<OutA, OutB>* out) { |
| 637 | (obj->*method)(&out->a, &out->b); |
| 638 | } |
| 639 | |
| 640 | template<class ObjT, class Method, class InA, |
| 641 | class OutA, class OutB> |
| 642 | inline void DispatchToMethod(ObjT* obj, Method method, |
| 643 | const InA& in, |
| 644 | Tuple2<OutA, OutB>* out) { |
| 645 | (obj->*method)(in, &out->a, &out->b); |
| 646 | } |
| 647 | |
| 648 | template<class ObjT, class Method, class InA, |
| 649 | class OutA, class OutB> |
| 650 | inline void DispatchToMethod(ObjT* obj, Method method, |
| 651 | const Tuple1<InA>& in, |
| 652 | Tuple2<OutA, OutB>* out) { |
| 653 | (obj->*method)(in.a, &out->a, &out->b); |
| 654 | } |
| 655 | |
| 656 | template<class ObjT, class Method, class InA, class InB, |
| 657 | class OutA, class OutB> |
| 658 | inline void DispatchToMethod(ObjT* obj, Method method, |
| 659 | const Tuple2<InA, InB>& in, |
| 660 | Tuple2<OutA, OutB>* out) { |
| 661 | (obj->*method)(in.a, in.b, &out->a, &out->b); |
| 662 | } |
| 663 | |
| 664 | template<class ObjT, class Method, class InA, class InB, class InC, |
| 665 | class OutA, class OutB> |
| 666 | inline void DispatchToMethod(ObjT* obj, Method method, |
| 667 | const Tuple3<InA, InB, InC>& in, |
| 668 | Tuple2<OutA, OutB>* out) { |
| 669 | (obj->*method)(in.a, in.b, in.c, &out->a, &out->b); |
| 670 | } |
| 671 | |
| 672 | template<class ObjT, class Method, class InA, class InB, class InC, class InD, |
| 673 | class OutA, class OutB> |
| 674 | inline void DispatchToMethod(ObjT* obj, Method method, |
| 675 | const Tuple4<InA, InB, InC, InD>& in, |
| 676 | Tuple2<OutA, OutB>* out) { |
| 677 | (obj->*method)(in.a, in.b, in.c, in.d, &out->a, &out->b); |
| 678 | } |
| 679 | |
| 680 | template<class ObjT, class Method, |
| 681 | class InA, class InB, class InC, class InD, class InE, |
| 682 | class OutA, class OutB> |
| 683 | inline void DispatchToMethod(ObjT* obj, Method method, |
| 684 | const Tuple5<InA, InB, InC, InD, InE>& in, |
| 685 | Tuple2<OutA, OutB>* out) { |
| 686 | (obj->*method)(in.a, in.b, in.c, in.d, in.e, &out->a, &out->b); |
| 687 | } |
| 688 | |
ojan@google.com | 3835509 | 2008-10-10 06:58:05 +0900 | [diff] [blame] | 689 | template<class ObjT, class Method, |
| 690 | class InA, class InB, class InC, class InD, class InE, class InF, |
| 691 | class OutA, class OutB> |
| 692 | inline void DispatchToMethod(ObjT* obj, Method method, |
| 693 | const Tuple6<InA, InB, InC, InD, InE, InF>& in, |
| 694 | Tuple2<OutA, OutB>* out) { |
| 695 | (obj->*method)(in.a, in.b, in.c, in.d, in.e, in.f, &out->a, &out->b); |
| 696 | } |
| 697 | |
initial.commit | 3f4a732 | 2008-07-27 06:49:38 +0900 | [diff] [blame] | 698 | // Dispatchers with 3 out params. |
| 699 | |
| 700 | template<class ObjT, class Method, |
| 701 | class OutA, class OutB, class OutC> |
| 702 | inline void DispatchToMethod(ObjT* obj, Method method, |
| 703 | const Tuple0& in, |
| 704 | Tuple3<OutA, OutB, OutC>* out) { |
| 705 | (obj->*method)(&out->a, &out->b, &out->c); |
| 706 | } |
| 707 | |
| 708 | template<class ObjT, class Method, class InA, |
| 709 | class OutA, class OutB, class OutC> |
| 710 | inline void DispatchToMethod(ObjT* obj, Method method, |
| 711 | const InA& in, |
| 712 | Tuple3<OutA, OutB, OutC>* out) { |
| 713 | (obj->*method)(in, &out->a, &out->b, &out->c); |
| 714 | } |
| 715 | |
| 716 | template<class ObjT, class Method, class InA, |
| 717 | class OutA, class OutB, class OutC> |
| 718 | inline void DispatchToMethod(ObjT* obj, Method method, |
| 719 | const Tuple1<InA>& in, |
| 720 | Tuple3<OutA, OutB, OutC>* out) { |
| 721 | (obj->*method)(in.a, &out->a, &out->b, &out->c); |
| 722 | } |
| 723 | |
| 724 | template<class ObjT, class Method, class InA, class InB, |
| 725 | class OutA, class OutB, class OutC> |
| 726 | inline void DispatchToMethod(ObjT* obj, Method method, |
| 727 | const Tuple2<InA, InB>& in, |
| 728 | Tuple3<OutA, OutB, OutC>* out) { |
| 729 | (obj->*method)(in.a, in.b, &out->a, &out->b, &out->c); |
| 730 | } |
| 731 | |
| 732 | template<class ObjT, class Method, class InA, class InB, class InC, |
| 733 | class OutA, class OutB, class OutC> |
| 734 | inline void DispatchToMethod(ObjT* obj, Method method, |
| 735 | const Tuple3<InA, InB, InC>& in, |
| 736 | Tuple3<OutA, OutB, OutC>* out) { |
| 737 | (obj->*method)(in.a, in.b, in.c, &out->a, &out->b, &out->c); |
| 738 | } |
| 739 | |
| 740 | template<class ObjT, class Method, class InA, class InB, class InC, class InD, |
| 741 | class OutA, class OutB, class OutC> |
| 742 | inline void DispatchToMethod(ObjT* obj, Method method, |
| 743 | const Tuple4<InA, InB, InC, InD>& in, |
| 744 | Tuple3<OutA, OutB, OutC>* out) { |
| 745 | (obj->*method)(in.a, in.b, in.c, in.d, &out->a, &out->b, &out->c); |
| 746 | } |
| 747 | |
| 748 | template<class ObjT, class Method, |
| 749 | class InA, class InB, class InC, class InD, class InE, |
| 750 | class OutA, class OutB, class OutC> |
| 751 | inline void DispatchToMethod(ObjT* obj, Method method, |
| 752 | const Tuple5<InA, InB, InC, InD, InE>& in, |
| 753 | Tuple3<OutA, OutB, OutC>* out) { |
| 754 | (obj->*method)(in.a, in.b, in.c, in.d, in.e, &out->a, &out->b, &out->c); |
| 755 | } |
| 756 | |
ojan@google.com | 3835509 | 2008-10-10 06:58:05 +0900 | [diff] [blame] | 757 | template<class ObjT, class Method, |
| 758 | class InA, class InB, class InC, class InD, class InE, class InF, |
| 759 | class OutA, class OutB, class OutC> |
| 760 | inline void DispatchToMethod(ObjT* obj, Method method, |
| 761 | const Tuple6<InA, InB, InC, InD, InE, InF>& in, |
| 762 | Tuple3<OutA, OutB, OutC>* out) { |
| 763 | (obj->*method)(in.a, in.b, in.c, in.d, in.e, in.f, &out->a, &out->b, &out->c); |
| 764 | } |
| 765 | |
initial.commit | 3f4a732 | 2008-07-27 06:49:38 +0900 | [diff] [blame] | 766 | // Dispatchers with 4 out params. |
| 767 | |
| 768 | template<class ObjT, class Method, |
| 769 | class OutA, class OutB, class OutC, class OutD> |
| 770 | inline void DispatchToMethod(ObjT* obj, Method method, |
| 771 | const Tuple0& in, |
| 772 | Tuple4<OutA, OutB, OutC, OutD>* out) { |
| 773 | (obj->*method)(&out->a, &out->b, &out->c, &out->d); |
| 774 | } |
| 775 | |
| 776 | template<class ObjT, class Method, class InA, |
| 777 | class OutA, class OutB, class OutC, class OutD> |
| 778 | inline void DispatchToMethod(ObjT* obj, Method method, |
| 779 | const InA& in, |
| 780 | Tuple4<OutA, OutB, OutC, OutD>* out) { |
| 781 | (obj->*method)(in, &out->a, &out->b, &out->c, &out->d); |
| 782 | } |
| 783 | |
| 784 | template<class ObjT, class Method, class InA, |
| 785 | class OutA, class OutB, class OutC, class OutD> |
| 786 | inline void DispatchToMethod(ObjT* obj, Method method, |
| 787 | const Tuple1<InA>& in, |
| 788 | Tuple4<OutA, OutB, OutC, OutD>* out) { |
| 789 | (obj->*method)(in.a, &out->a, &out->b, &out->c, &out->d); |
| 790 | } |
| 791 | |
| 792 | template<class ObjT, class Method, class InA, class InB, |
| 793 | class OutA, class OutB, class OutC, class OutD> |
| 794 | inline void DispatchToMethod(ObjT* obj, Method method, |
| 795 | const Tuple2<InA, InB>& in, |
| 796 | Tuple4<OutA, OutB, OutC, OutD>* out) { |
| 797 | (obj->*method)(in.a, in.b, &out->a, &out->b, &out->c, &out->d); |
| 798 | } |
| 799 | |
| 800 | template<class ObjT, class Method, class InA, class InB, class InC, |
| 801 | class OutA, class OutB, class OutC, class OutD> |
| 802 | inline void DispatchToMethod(ObjT* obj, Method method, |
| 803 | const Tuple3<InA, InB, InC>& in, |
| 804 | Tuple4<OutA, OutB, OutC, OutD>* out) { |
| 805 | (obj->*method)(in.a, in.b, in.c, &out->a, &out->b, &out->c, &out->d); |
| 806 | } |
| 807 | |
| 808 | template<class ObjT, class Method, class InA, class InB, class InC, class InD, |
| 809 | class OutA, class OutB, class OutC, class OutD> |
| 810 | inline void DispatchToMethod(ObjT* obj, Method method, |
| 811 | const Tuple4<InA, InB, InC, InD>& in, |
| 812 | Tuple4<OutA, OutB, OutC, OutD>* out) { |
| 813 | (obj->*method)(in.a, in.b, in.c, in.d, &out->a, &out->b, &out->c, &out->d); |
| 814 | } |
| 815 | |
| 816 | template<class ObjT, class Method, |
| 817 | class InA, class InB, class InC, class InD, class InE, |
| 818 | class OutA, class OutB, class OutC, class OutD> |
| 819 | inline void DispatchToMethod(ObjT* obj, Method method, |
| 820 | const Tuple5<InA, InB, InC, InD, InE>& in, |
| 821 | Tuple4<OutA, OutB, OutC, OutD>* out) { |
| 822 | (obj->*method)(in.a, in.b, in.c, in.d, in.e, |
| 823 | &out->a, &out->b, &out->c, &out->d); |
| 824 | } |
| 825 | |
ojan@google.com | 3835509 | 2008-10-10 06:58:05 +0900 | [diff] [blame] | 826 | template<class ObjT, class Method, |
| 827 | class InA, class InB, class InC, class InD, class InE, class InF, |
| 828 | class OutA, class OutB, class OutC, class OutD> |
| 829 | inline void DispatchToMethod(ObjT* obj, Method method, |
| 830 | const Tuple6<InA, InB, InC, InD, InE, InF>& in, |
| 831 | Tuple4<OutA, OutB, OutC, OutD>* out) { |
| 832 | (obj->*method)(in.a, in.b, in.c, in.d, in.e, in.f, |
| 833 | &out->a, &out->b, &out->c, &out->d); |
| 834 | } |
| 835 | |
initial.commit | 3f4a732 | 2008-07-27 06:49:38 +0900 | [diff] [blame] | 836 | // Dispatchers with 5 out params. |
| 837 | |
| 838 | template<class ObjT, class Method, |
| 839 | class OutA, class OutB, class OutC, class OutD, class OutE> |
| 840 | inline void DispatchToMethod(ObjT* obj, Method method, |
| 841 | const Tuple0& in, |
| 842 | Tuple5<OutA, OutB, OutC, OutD, OutE>* out) { |
| 843 | (obj->*method)(&out->a, &out->b, &out->c, &out->d, &out->e); |
| 844 | } |
| 845 | |
| 846 | template<class ObjT, class Method, class InA, |
| 847 | class OutA, class OutB, class OutC, class OutD, class OutE> |
| 848 | inline void DispatchToMethod(ObjT* obj, Method method, |
| 849 | const InA& in, |
| 850 | Tuple5<OutA, OutB, OutC, OutD, OutE>* out) { |
| 851 | (obj->*method)(in, &out->a, &out->b, &out->c, &out->d, &out->e); |
| 852 | } |
| 853 | |
| 854 | template<class ObjT, class Method, class InA, |
| 855 | class OutA, class OutB, class OutC, class OutD, class OutE> |
| 856 | inline void DispatchToMethod(ObjT* obj, Method method, |
| 857 | const Tuple1<InA>& in, |
| 858 | Tuple5<OutA, OutB, OutC, OutD, OutE>* out) { |
| 859 | (obj->*method)(in.a, &out->a, &out->b, &out->c, &out->d, &out->e); |
| 860 | } |
| 861 | |
| 862 | template<class ObjT, class Method, class InA, class InB, |
| 863 | class OutA, class OutB, class OutC, class OutD, class OutE> |
| 864 | inline void DispatchToMethod(ObjT* obj, Method method, |
| 865 | const Tuple2<InA, InB>& in, |
| 866 | Tuple5<OutA, OutB, OutC, OutD, OutE>* out) { |
| 867 | (obj->*method)(in.a, in.b, &out->a, &out->b, &out->c, &out->d, &out->e); |
| 868 | } |
| 869 | |
| 870 | template<class ObjT, class Method, class InA, class InB, class InC, |
| 871 | class OutA, class OutB, class OutC, class OutD, class OutE> |
| 872 | inline void DispatchToMethod(ObjT* obj, Method method, |
| 873 | const Tuple3<InA, InB, InC>& in, |
| 874 | Tuple5<OutA, OutB, OutC, OutD, OutE>* out) { |
| 875 | (obj->*method)(in.a, in.b, in.c, &out->a, &out->b, &out->c, &out->d, &out->e); |
| 876 | } |
| 877 | |
| 878 | template<class ObjT, class Method, class InA, class InB, class InC, class InD, |
| 879 | class OutA, class OutB, class OutC, class OutD, class OutE> |
| 880 | inline void DispatchToMethod(ObjT* obj, Method method, |
| 881 | const Tuple4<InA, InB, InC, InD>& in, |
| 882 | Tuple5<OutA, OutB, OutC, OutD, OutE>* out) { |
| 883 | (obj->*method)(in.a, in.b, in.c, in.d, &out->a, &out->b, &out->c, &out->d, |
| 884 | &out->e); |
| 885 | } |
| 886 | |
| 887 | template<class ObjT, class Method, |
| 888 | class InA, class InB, class InC, class InD, class InE, |
| 889 | class OutA, class OutB, class OutC, class OutD, class OutE> |
| 890 | inline void DispatchToMethod(ObjT* obj, Method method, |
| 891 | const Tuple5<InA, InB, InC, InD, InE>& in, |
| 892 | Tuple5<OutA, OutB, OutC, OutD, OutE>* out) { |
| 893 | (obj->*method)(in.a, in.b, in.c, in.d, in.e, |
| 894 | &out->a, &out->b, &out->c, &out->d, &out->e); |
| 895 | } |
| 896 | |
ojan@google.com | 3835509 | 2008-10-10 06:58:05 +0900 | [diff] [blame] | 897 | template<class ObjT, class Method, |
| 898 | class InA, class InB, class InC, class InD, class InE, class InF, |
| 899 | class OutA, class OutB, class OutC, class OutD, class OutE> |
| 900 | inline void DispatchToMethod(ObjT* obj, Method method, |
| 901 | const Tuple6<InA, InB, InC, InD, InE, InF>& in, |
| 902 | Tuple5<OutA, OutB, OutC, OutD, OutE>* out) { |
| 903 | (obj->*method)(in.a, in.b, in.c, in.d, in.e, in.f, |
| 904 | &out->a, &out->b, &out->c, &out->d, &out->e); |
| 905 | } |
| 906 | |
initial.commit | 3f4a732 | 2008-07-27 06:49:38 +0900 | [diff] [blame] | 907 | #endif // BASE_TUPLE_H__ |