00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef COH_TYPED_METHOD_HPP
00017 #define COH_TYPED_METHOD_HPP
00018
00019 #include "coherence/lang/compatibility.hpp"
00020
00021 #include "coherence/lang/BoxHandle.hpp"
00022 #include "coherence/lang/IllegalArgumentException.hpp"
00023 #include "coherence/lang/Method.hpp"
00024 #include "coherence/lang/SystemClassLoader.hpp"
00025 #include "coherence/lang/class_spec.hpp"
00026
00027 #include "coherence/lang/Boolean.hpp"
00028 #include "coherence/lang/Octet.hpp"
00029 #include "coherence/lang/Character16.hpp"
00030 #include "coherence/lang/Integer16.hpp"
00031 #include "coherence/lang/Integer32.hpp"
00032 #include "coherence/lang/Integer64.hpp"
00033 #include "coherence/lang/Size32.hpp"
00034 #include "coherence/lang/Size64.hpp"
00035 #include "coherence/lang/Float32.hpp"
00036 #include "coherence/lang/Float64.hpp"
00037 #include "coherence/lang/String.hpp"
00038
00039
00040 COH_OPEN_NAMESPACE2(coherence,lang)
00041
00042 namespace
00043 {
00044
00045
00046
00047
00048
00049
00050
00051
00052 template<class T>
00053 class coh_TypedMethodHelper
00054 {
00055 public:
00056
00057
00058
00059
00060 static Method::ClassView getMethodArgumentType();
00061
00062
00063
00064
00065 static int32_t getMethodModifiers();
00066 };
00067
00068 template<class T> Method::ClassView coh_TypedMethodHelper<T>::getMethodArgumentType()
00069 {
00070 return SystemClassLoader::getInstance()->loadByType(typeid(typename T::ValueType));
00071 }
00072
00073 template<> Method::ClassView coh_TypedMethodHelper<void>::getMethodArgumentType()
00074 {
00075 return NULL;
00076 }
00077
00078 template<class T> int32_t coh_TypedMethodHelper<T>::getMethodModifiers()
00079 {
00080 return Method::modifier_instance |
00081 (constness<typename T::ValueType>::applied
00082 ? Method::modifier_const
00083 : Method::modifier_mutable);
00084 }
00085
00086 template<> int32_t coh_TypedMethodHelper<void>::getMethodModifiers()
00087 {
00088 return Method::modifier_static;
00089 }
00090
00091
00092
00093
00094 template<class H, class P, class R, class A1, class A2, class A3, class A4,
00095 class A5, class A6, class A7, class A8>
00096 class coh_invoker
00097 {
00098 public:
00099 static Object::Holder invoke(Object::Holder oh, P p, ObjectArray::View va)
00100 {
00101 COH_ENSURE_PARAM_RELATION(va->length, ==, 3);
00102 return R((*cast<H>(oh).*(p))(cast<A1>(va[0]), cast<A2>(va[1]),
00103 cast<A3>(va[2]), cast<A4>(va[3]), cast<A5>(va[4]),
00104 cast<A6>(va[5]), cast<A7>(va[6]), cast<A8>(va[7])));
00105 }
00106 };
00107 }
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211 template<class P, class R, class C, class H, P M,
00212 class A1 = void, class A2 = void, class A3 = void, class A4 = void,
00213 class A5 = void, class A6 = void, class A7 = void, class A8 = void>
00214 class TypedMethod
00215 : public class_spec<TypedMethod<P, R, C, H, M, A1, A2, A3, A4, A5, A6, A7, A8>,
00216 extends<Method> >
00217 {
00218 friend class factory<TypedMethod<P, R, C, H, M, A1, A2, A3, A4, A5, A6, A7, A8> >;
00219
00220
00221
00222 protected:
00223
00224
00225
00226
00227
00228 TypedMethod(String::View vsName)
00229 : class_spec<TypedMethod<P, R, C, H, M, A1, A2, A3, A4, A5, A6, A7, A8>,
00230 extends<Method> >(vsName)
00231 {
00232 }
00233
00234
00235
00236
00237 public:
00238
00239
00240
00241 virtual int32_t getModifiers() const
00242 {
00243 return coh_TypedMethodHelper<H>::getMethodModifiers();
00244 }
00245
00246
00247
00248
00249 virtual ObjectArray::View getParameterTypes() const
00250 {
00251 ObjectArray::Handle ha =
00252 typeid(A1) == typeid(void) ? ObjectArray::create(0)
00253 : typeid(A2) == typeid(void) ? ObjectArray::create(1)
00254 : typeid(A3) == typeid(void) ? ObjectArray::create(2)
00255 : typeid(A4) == typeid(void) ? ObjectArray::create(3)
00256 : typeid(A5) == typeid(void) ? ObjectArray::create(4)
00257 : typeid(A6) == typeid(void) ? ObjectArray::create(5)
00258 : typeid(A7) == typeid(void) ? ObjectArray::create(6)
00259 : typeid(A8) == typeid(void) ? ObjectArray::create(7)
00260 : ObjectArray::create(8);
00261
00262 switch (ha->length)
00263 {
00264 case 8:
00265 ha[7] = coh_TypedMethodHelper<A8>::getMethodArgumentType();
00266 case 7:
00267 ha[6] = coh_TypedMethodHelper<A7>::getMethodArgumentType();
00268 case 6:
00269 ha[5] = coh_TypedMethodHelper<A6>::getMethodArgumentType();
00270 case 5:
00271 ha[4] = coh_TypedMethodHelper<A5>::getMethodArgumentType();
00272 case 4:
00273 ha[3] = coh_TypedMethodHelper<A4>::getMethodArgumentType();
00274 case 3:
00275 ha[2] = coh_TypedMethodHelper<A3>::getMethodArgumentType();
00276 case 2:
00277 ha[1] = coh_TypedMethodHelper<A2>::getMethodArgumentType();
00278 case 1:
00279 ha[0] = coh_TypedMethodHelper<A1>::getMethodArgumentType();
00280 case 0:
00281 break;
00282 default:
00283 coh_throw_illegal_state("unsupported method parameter count");
00284 }
00285
00286 return ha;
00287 }
00288
00289
00290
00291
00292 virtual Method::ClassView getReturnType() const
00293 {
00294 return coh_TypedMethodHelper<R>::getMethodArgumentType();
00295 }
00296
00297
00298
00299
00300 virtual Method::ClassView getDeclaringClass() const
00301 {
00302 return SystemClassLoader::getInstance()->loadByType(typeid(C));
00303 }
00304
00305
00306
00307
00308 virtual Object::Holder invoke(Object::Holder oh, ObjectArray::View vaArgs) const
00309 {
00310 if (typeid(H) == typeid(void) && oh != NULL &&
00311 !instanceof<typename C::View>(oh))
00312 {
00313 coh_throw_illegal_argument("oh must be NULL or of correct type");
00314 }
00315 return coh_invoker<H, P, R, A1, A2, A3, A4, A5, A6, A7, A8>::invoke(oh, M, vaArgs);
00316 }
00317 };
00318
00319
00320
00321 namespace
00322 {
00323
00324
00325 #define COH_INVOKER(N, HH, RR, AA1, AA2, AA3, AA4, AA5, AA6, AA7, AA8, EXEC) \
00326 class coh_invoker<HH, P, RR, AA1, AA2, AA3, AA4, AA5, AA6, AA7, AA8> \
00327 { \
00328 public: \
00329 static Object::Holder invoke(Object::Holder oh, P p, ObjectArray::View va) \
00330 { \
00331 if (!(N == 0 && va == NULL)) \
00332 { \
00333 COH_ENSURE_PARAM_RELATION(va->length, ==, N); \
00334 } \
00335 Object::Holder ohSunProWantsItToGetUsed = oh; \
00336 Object::Holder r; \
00337 EXEC; \
00338 return r; \
00339 } \
00340 }
00341
00342 #define COH_A0
00343 #define COH_A1 COH_A0, class A1
00344 #define COH_A2 COH_A1, class A2
00345 #define COH_A3 COH_A2, class A3
00346 #define COH_A4 COH_A3, class A4
00347 #define COH_A5 COH_A4, class A5
00348 #define COH_A6 COH_A5, class A6
00349 #define COH_A7 COH_A6, class A7
00350
00351 #define COH_DEF_METHOD_TEMPLATE(N, RT) template<class H, class P, class RT COH_A##N>
00352 #define COH_DEF_METHOD_TEMPLATE_VOID(N) template<class H, class P COH_A##N>
00353 #define COH_DEF_STATIC_METHOD_TEMPLATE(N, RT) template<class P, class RT COH_A##N>
00354 #define COH_DEF_STATIC_METHOD_TEMPLATE_VOID(N) template<class P COH_A##N>
00355
00356 #define COH_DEF_ARGS0
00357 #define COH_DEF_ARGS1 COH_DEF_ARGS0 cast<A1>(va[0])
00358 #define COH_DEF_ARGS2 COH_DEF_ARGS1, cast<A2>(va[1])
00359 #define COH_DEF_ARGS3 COH_DEF_ARGS2, cast<A3>(va[2])
00360 #define COH_DEF_ARGS4 COH_DEF_ARGS3, cast<A4>(va[3])
00361 #define COH_DEF_ARGS5 COH_DEF_ARGS4, cast<A5>(va[4])
00362 #define COH_DEF_ARGS6 COH_DEF_ARGS5, cast<A6>(va[5])
00363 #define COH_DEF_ARGS7 COH_DEF_ARGS6, cast<A7>(va[6])
00364
00365 #define COH_INSTANCE_METHOD *cast<H>(oh).*(p)
00366 #define COH_STATIC_METHOD *(p)
00367
00368 #define COH_DEF_EXEC(N, MS, RS) RS((MS)(COH_DEF_ARGS##N));
00369
00370 #define COH_DEF_INVOKER0(RT, HH, MS, RS) COH_INVOKER(0, HH, RT, void, void, void, void, void, void, void, void, COH_DEF_EXEC(0, MS, RS))
00371 #define COH_DEF_INVOKER1(RT, HH, MS, RS) COH_INVOKER(1, HH, RT, A1, void, void, void, void, void, void, void, COH_DEF_EXEC(1, MS, RS))
00372 #define COH_DEF_INVOKER2(RT, HH, MS, RS) COH_INVOKER(2, HH, RT, A1, A2, void, void, void, void, void, void, COH_DEF_EXEC(2, MS, RS))
00373 #define COH_DEF_INVOKER3(RT, HH, MS, RS) COH_INVOKER(3, HH, RT, A1, A2, A3, void, void, void, void, void, COH_DEF_EXEC(3, MS, RS))
00374 #define COH_DEF_INVOKER4(RT, HH, MS, RS) COH_INVOKER(4, HH, RT, A1, A2, A3, A4, void, void, void, void, COH_DEF_EXEC(4, MS, RS))
00375 #define COH_DEF_INVOKER5(RT, HH, MS, RS) COH_INVOKER(5, HH, RT, A1, A2, A3, A4, A5, void, void, void, COH_DEF_EXEC(5, MS, RS))
00376 #define COH_DEF_INVOKER6(RT, HH, MS, RS) COH_INVOKER(6, HH, RT, A1, A2, A3, A4, A5, A6, void, void, COH_DEF_EXEC(6, MS, RS))
00377 #define COH_DEF_INVOKER7(RT, HH, MS, RS) COH_INVOKER(7, HH, RT, A1, A2, A3, A4, A5, A6, A7, void, COH_DEF_EXEC(7, MS, RS))
00378
00379 #define COH_DEF_METHOD(N) \
00380 COH_DEF_METHOD_TEMPLATE(N, R) COH_DEF_INVOKER##N(R, H, COH_INSTANCE_METHOD, r = R); \
00381 COH_DEF_METHOD_TEMPLATE_VOID(N) COH_DEF_INVOKER##N(void, H, COH_INSTANCE_METHOD, ;); \
00382 COH_DEF_STATIC_METHOD_TEMPLATE(N, R) COH_DEF_INVOKER##N(R, void, COH_STATIC_METHOD, r = R); \
00383 COH_DEF_STATIC_METHOD_TEMPLATE_VOID(N) COH_DEF_INVOKER##N(void, void, COH_STATIC_METHOD, ;)
00384
00385 COH_DEF_METHOD(0);
00386 COH_DEF_METHOD(1);
00387 COH_DEF_METHOD(2);
00388 COH_DEF_METHOD(3);
00389 COH_DEF_METHOD(4);
00390 COH_DEF_METHOD(5);
00391 COH_DEF_METHOD(6);
00392 COH_DEF_METHOD(7);
00393
00394 #undef COH_DEF_METHOD
00395 #undef COH_DEF_INVOKER0
00396 #undef COH_DEF_INVOKER1
00397 #undef COH_DEF_INVOKER2
00398 #undef COH_DEF_INVOKER3
00399 #undef COH_DEF_INVOKER4
00400 #undef COH_DEF_INVOKER5
00401 #undef COH_DEF_INVOKER6
00402 #undef COH_DEF_INVOKER7
00403 #undef COH_DEF_EXEC
00404 #undef COH_STATIC_METHOD
00405 #undef COH_INSTANCE_METHOD
00406
00407 #undef COH_DEF_ARGS0
00408 #undef COH_DEF_ARGS1
00409 #undef COH_DEF_ARGS2
00410 #undef COH_DEF_ARGS3
00411 #undef COH_DEF_ARGS4
00412 #undef COH_DEF_ARGS5
00413 #undef COH_DEF_ARGS6
00414 #undef COH_DEF_ARGS7
00415
00416 #undef COH_DEF_METHOD_TEMPLATE
00417 #undef COH_DEF_METHOD_TEMPLATE_VOID
00418 #undef COH_DEF_STATIC_METHOD_TEMPLATE
00419 #undef COH_DEF_STATIC_METHOD_TEMPLATE_VOID
00420
00421 #undef COH_A0
00422 #undef COH_A1
00423 #undef COH_A2
00424 #undef COH_A3
00425 #undef COH_A4
00426 #undef COH_A5
00427 #undef COH_A6
00428 #undef COH_A7
00429
00430 #undef COH_INVOKER
00431
00432
00433
00434
00435 template<class C, class H>
00436 class coh_type_info
00437 {
00438 public: typedef H type;
00439 };
00440
00441
00442
00443
00444 template<class C>
00445 class coh_type_info<C, BoxHandle<C> >
00446 {
00447 public: typedef typename C::BoxedType type;
00448 };
00449
00450
00451
00452
00453 template<class C>
00454 class coh_type_info<C, BoxHandle<const C> >
00455 {
00456 public: typedef typename C::BoxedType type;
00457 };
00458
00459
00460
00461 #define COH_BOX_TYPE_INFO(T) \
00462 template<> \
00463 class coh_type_info<T, BoxHandle<T> > \
00464 { \
00465 public: typedef T::BoxedType type; \
00466 }; \
00467 template<> \
00468 class coh_type_info<const T, BoxHandle<const T> > \
00469 { \
00470 public: typedef T::BoxedType type; \
00471 }
00472
00473 COH_BOX_TYPE_INFO(Boolean);
00474 COH_BOX_TYPE_INFO(Octet);
00475 COH_BOX_TYPE_INFO(Character16);
00476 COH_BOX_TYPE_INFO(Integer16);
00477 COH_BOX_TYPE_INFO(Integer32);
00478 COH_BOX_TYPE_INFO(Integer64);
00479 COH_BOX_TYPE_INFO(Size32);
00480 COH_BOX_TYPE_INFO(Size64);
00481 COH_BOX_TYPE_INFO(Float32);
00482 COH_BOX_TYPE_INFO(Float64);
00483 COH_BOX_TYPE_INFO(String);
00484
00485
00486
00487
00488 template<class H>
00489 class coh_handle_info
00490 {
00491 public: typedef typename coh_type_info<typename H::ValueType, H>::type type;
00492 };
00493
00494
00495
00496
00497 template<>
00498 class coh_handle_info<void>
00499 {
00500 public: typedef void type;
00501 };
00502 }
00503
00504
00505
00506
00507
00508
00509
00510 template<int N, class R, class C, class H, class A1 = void, class A2 = void,
00511 class A3 = void, class A4 = void, class A5 = void,
00512 class A6 = void, class A7 = void, class A8 = void>
00513 class coh_signature_info \
00514 { \
00515 public: typedef void signature;
00516 };
00517
00518 #define COH_SIG_INFON(N, RS, CS, HS, AS, TS) \
00519 template<class R, class C, class A1, class A2, \
00520 class A3, class A4, class A5, \
00521 class A6, class A7, class A8> \
00522 class coh_signature_info<N, R, C, HS, A1, A2, A3, A4, A5, A6, A7, A8> \
00523 { \
00524 public: typedef typename coh_handle_info<RS>::type (CS signature)AS TS \
00525 }
00526
00527
00528 #define COH_ARG_TYPE0
00529 #define COH_ARG_TYPE1 COH_ARG_TYPE0 typename coh_handle_info<A1>::type
00530 #define COH_ARG_TYPE2 COH_ARG_TYPE1, typename coh_handle_info<A2>::type
00531 #define COH_ARG_TYPE3 COH_ARG_TYPE2, typename coh_handle_info<A3>::type
00532 #define COH_ARG_TYPE4 COH_ARG_TYPE3, typename coh_handle_info<A4>::type
00533 #define COH_ARG_TYPE5 COH_ARG_TYPE4, typename coh_handle_info<A5>::type
00534 #define COH_ARG_TYPE6 COH_ARG_TYPE5, typename coh_handle_info<A6>::type
00535 #define COH_ARG_TYPE7 COH_ARG_TYPE6, typename coh_handle_info<A7>::type
00536 #define COH_ARG_TYPE8 COH_ARG_TYPE7, typename coh_handle_info<A8>::type
00537
00538 #define COH_SIG_INFO(N) \
00539 COH_SIG_INFON(N, R, *, void ,(COH_ARG_TYPE##N), ;); \
00540 COH_SIG_INFON(N, R, C::*, typename C::Handle,(COH_ARG_TYPE##N), ;); \
00541 COH_SIG_INFON(N, R, C::*, typename C::View ,(COH_ARG_TYPE##N), const;)
00542
00543 COH_SIG_INFO(0);
00544 COH_SIG_INFO(1);
00545 COH_SIG_INFO(2);
00546 COH_SIG_INFO(3);
00547 COH_SIG_INFO(4);
00548 COH_SIG_INFO(5);
00549 COH_SIG_INFO(6);
00550 COH_SIG_INFO(7);
00551 COH_SIG_INFO(8);
00552
00553 #undef COH_SIG_INFO
00554 #undef COH_SIG_INFON
00555 #undef COH_ARG_TYPE0
00556 #undef COH_ARG_TYPE1
00557 #undef COH_ARG_TYPE2
00558 #undef COH_ARG_TYPE3
00559 #undef COH_ARG_TYPE4
00560 #undef COH_ARG_TYPE5
00561 #undef COH_ARG_TYPE6
00562 #undef COH_ARG_TYPE7
00563 #undef COH_ARG_TYPE8
00564
00565 COH_CLOSE_NAMESPACE2
00566
00567
00568
00569
00570
00571
00572
00573
00574
00575
00576
00577
00578
00579
00580
00581
00582
00583
00584
00585
00586
00587
00588
00589
00590 #define COH_OVERLOADED_STATIC_METHOD8(S, R, C, M, A1, A2, A3, A4, A5, A6, A7, A8) \
00591 coherence::lang::TypedMethod<S, \
00592 R, C, void, &C::M, A1, A2, A3, A4, A5, A6, A7, A8>::create(#M)
00593 #define COH_OVERLOADED_STATIC_METHOD7(S, R, C, M, A1, A2, A3, A4, A5, A6, A7) \
00594 COH_OVERLOADED_STATIC_METHOD8(S, R, C, M, A1, A2, A3, A4, A5, A6, A7, void)
00595 #define COH_OVERLOADED_STATIC_METHOD6(S, R, C, M, A1, A2, A3, A4, A5, A6) \
00596 COH_OVERLOADED_STATIC_METHOD7(S, R, C, M, A1, A2, A3, A4, A5, A6, void)
00597 #define COH_OVERLOADED_STATIC_METHOD5(S, R, C, M, A1, A2, A3, A4, A5) \
00598 COH_OVERLOADED_STATIC_METHOD6(S, R, C, M, A1, A2, A3, A4, A5, void)
00599 #define COH_OVERLOADED_STATIC_METHOD4(S, R, C, M, A1, A2, A3, A4) \
00600 COH_OVERLOADED_STATIC_METHOD5(S, R, C, M, A1, A2, A3, A4, void)
00601 #define COH_OVERLOADED_STATIC_METHOD3(S, R, C, M, A1, A2, A3) \
00602 COH_OVERLOADED_STATIC_METHOD4(S, R, C, M, A1, A2, A3, void)
00603 #define COH_OVERLOADED_STATIC_METHOD2(S, R, C, M, A1, A2) \
00604 COH_OVERLOADED_STATIC_METHOD3(S, R, C, M, A1, A2, void)
00605 #define COH_OVERLOADED_STATIC_METHOD1(S, R, C, M, A) \
00606 COH_OVERLOADED_STATIC_METHOD2(S, R, C, M, A, void)
00607 #define COH_OVERLOADED_STATIC_METHOD0(S, R, C, M) \
00608 COH_OVERLOADED_STATIC_METHOD1(S, R, C, M, void)
00609
00610
00611
00612
00613
00614
00615
00616
00617
00618
00619
00620
00621
00622
00623 #define COH_STATIC_METHOD(N, R, C, M, A1, A2, A3, A4, A5, A6, A7, A8) \
00624 coherence::lang::TypedMethod<coh_signature_info<N, R, C, void, A1, A2, \
00625 A3, A4, A5, A6, A7, A8>::signature, R, C, void, \
00626 &C::M, A1, A2, A3, A4, A5, A6, A7, A8>::create(#M)
00627 #define COH_STATIC_METHOD8(R, C, M, A1, A2, A3, A4, A5, A6, A7, A8) \
00628 COH_STATIC_METHOD(8, R, C, M, A1, A2, A3, A4, A5, A6, A7, A8)
00629 #define COH_STATIC_METHOD7(R, C, M, A1, A2, A3, A4, A5, A6, A7) \
00630 COH_STATIC_METHOD(7, R, C, M, A1, A2, A3, A4, A5, A6, A7, void)
00631 #define COH_STATIC_METHOD6(R, C, M, A1, A2, A3, A4, A5, A6) \
00632 COH_STATIC_METHOD(6, R, C, M, A1, A2, A3, A4, A5, A6, void, void)
00633 #define COH_STATIC_METHOD5(R, C, M, A1, A2, A3, A4, A5) \
00634 COH_STATIC_METHOD(5, R, C, M, A1, A2, A3, A4, A5, void, void, void)
00635 #define COH_STATIC_METHOD4(R, C, M, A1, A2, A3, A4) \
00636 COH_STATIC_METHOD(4, R, C, M, A1, A2, A3, A4, void, void, void, void)
00637 #define COH_STATIC_METHOD3(R, C, M, A1, A2, A3) \
00638 COH_STATIC_METHOD(3, R, C, M, A1, A2, A3, void, void, void, void, void)
00639 #define COH_STATIC_METHOD2(R, C, M, A1, A2) \
00640 COH_STATIC_METHOD(2, R, C, M, A1, A2, void, void, void, void, void, void)
00641 #define COH_STATIC_METHOD1(R, C, M, A) \
00642 COH_STATIC_METHOD(1, R, C, M, A, void, void, void, void, void, void, void)
00643 #define COH_STATIC_METHOD0(R, C, M) \
00644 COH_STATIC_METHOD(0, R, C, M, void, void, void, void, void, void, void, void)
00645
00646
00647
00648
00649
00650
00651
00652
00653
00654
00655
00656
00657
00658
00659 #define COH_CONSTRUCTOR8(C, A1, A2, A3, A4, A5, A6, A7, A8) \
00660 COH_OVERLOADED_STATIC_METHOD8(C::Handle (*)(const A1&, const A2&, \
00661 const A3&, const A4&, const A5&, const A6&, const A7&, const A8&), \
00662 C::Handle, C, create, A1, A2, A3, A4, A5, A6, A7, A8)
00663 #define COH_CONSTRUCTOR7(C, A1, A2, A3, A4, A5, A6, A7) \
00664 COH_OVERLOADED_STATIC_METHOD7(C::Handle (*)(const A1&, const A2&, \
00665 const A3&, const A4&, const A5&, const A6&, const A7&), \
00666 C::Handle, C, create, A1, A2, A3, A4, A5, A6, A7)
00667 #define COH_CONSTRUCTOR6(C, A1, A2, A3, A4, A5, A6) \
00668 COH_OVERLOADED_STATIC_METHOD6(C::Handle (*)(const A1&, const A2&, \
00669 const A3&, const A4&, const A5&, const A6&), \
00670 C::Handle, C, create, A1, A2, A3, A4, A5, A6)
00671 #define COH_CONSTRUCTOR5(C, A1, A2, A3, A4, A5) \
00672 COH_OVERLOADED_STATIC_METHOD5(C::Handle (*)(const A1&, const A2&, \
00673 const A3&, const A4&, const A5&), \
00674 C::Handle, C, create, A1, A2, A3, A4, A5)
00675 #define COH_CONSTRUCTOR4(C, A1, A2, A3, A4) \
00676 COH_OVERLOADED_STATIC_METHOD4(C::Handle (*)(const A1&, const A2&, \
00677 const A3&, const A4&), \
00678 C::Handle, C, create, A1, A2, A3, A4)
00679 #define COH_CONSTRUCTOR3(C, A1, A2, A3) \
00680 COH_OVERLOADED_STATIC_METHOD3(C::Handle (*)(const A1&, const A2&, \
00681 const A3&), \
00682 C::Handle, C, create, A1, A2, A3)
00683 #define COH_CONSTRUCTOR2(C, A1, A2) \
00684 COH_OVERLOADED_STATIC_METHOD2(C::Handle (*)(const A1&, const A2&), \
00685 C::Handle, C, create, A1, A2)
00686 #define COH_CONSTRUCTOR1(C, A1) \
00687 COH_OVERLOADED_STATIC_METHOD1(C::Handle (*)(const A1&), \
00688 C::Handle, C, create, A1)
00689 #define COH_CONSTRUCTOR0(C) \
00690 COH_OVERLOADED_STATIC_METHOD1(C::Handle (*)(), C::Handle, C, create)
00691
00692
00693
00694
00695
00696
00697
00698
00699
00700
00701
00702
00703
00704
00705
00706
00707
00708
00709
00710 #define COH_OVERLOADED_METHOD8(S, R, H, M, A1, A2, A3, A4, A5, A6, A7, A8) \
00711 coherence::lang::TypedMethod<S, \
00712 R, H::ValueType, H, &H::ValueType::M, A1, A2, A3, A4, A5, A6, A7, A8>::create(#M)
00713 #define COH_OVERLOADED_METHOD7(S, R, H, M, A1, A2, A3, A4, A5, A6, A7) \
00714 COH_OVERLOADED_METHOD8(S, R, H, M, A1, A2, A3, A4, A5, A6, A7, void)
00715 #define COH_OVERLOADED_METHOD6(S, R, H, M, A1, A2, A3, A4, A5, A6) \
00716 COH_OVERLOADED_METHOD7(S, R, H, M, A1, A2, A3, A4, A5, A6, void)
00717 #define COH_OVERLOADED_METHOD5(S, R, H, M, A1, A2, A3, A4, A5) \
00718 COH_OVERLOADED_METHOD6(S, R, H, M, A1, A2, A3, A4, A5, void)
00719 #define COH_OVERLOADED_METHOD4(S, R, H, M, A1, A2, A3, A4) \
00720 COH_OVERLOADED_METHOD5(S, R, H, M, A1, A2, A3, A4, void)
00721 #define COH_OVERLOADED_METHOD3(S, R, H, M, A1, A2, A3) \
00722 COH_OVERLOADED_METHOD4(S, R, H, M, A1, A2, A3, void)
00723 #define COH_OVERLOADED_METHOD2(S, R, H, M, A1, A2) \
00724 COH_OVERLOADED_METHOD3(S, R, H, M, A1, A2, void)
00725 #define COH_OVERLOADED_METHOD1(S, R, H, M, A) \
00726 COH_OVERLOADED_METHOD2(S, R, H, M, A, void)
00727 #define COH_OVERLOADED_METHOD0(S, R, H, M) \
00728 COH_OVERLOADED_METHOD1(S, R, H, M, void)
00729
00730
00731
00732
00733
00734
00735
00736
00737
00738
00739
00740
00741
00742
00743 #define COH_METHOD(N, R, H, M, A1, A2, A3, A4, A5, A6, A7, A8) \
00744 coherence::lang::TypedMethod<coh_signature_info<N, R, H::ValueType, H, A1, A2, \
00745 A3, A4, A5, A6, A7, A8>::signature, R, H::ValueType, H, \
00746 &H::ValueType::M, A1, A2, A3, A4, A5, A6, A7, A8>::create(#M)
00747 #define COH_METHOD8(R, H, M, A1, A2, A3, A4, A5, A6, A7, A8) \
00748 COH_METHOD(8, R, H, M, A1, A2, A3, A4, A5, A6, A7, A8)
00749 #define COH_METHOD7(R, H, M, A1, A2, A3, A4, A5, A6, A7) \
00750 COH_METHOD(7, R, H, M, A1, A2, A3, A4, A5, A6, A7, void)
00751 #define COH_METHOD6(R, H, M, A1, A2, A3, A4, A5, A6) \
00752 COH_METHOD(6, R, H, M, A1, A2, A3, A4, A5, A6, void, void)
00753 #define COH_METHOD5(R, H, M, A1, A2, A3, A4, A5) \
00754 COH_METHOD(5, R, H, M, A1, A2, A3, A4, A5, void, void, void)
00755 #define COH_METHOD4(R, H, M, A1, A2, A3, A4) \
00756 COH_METHOD(4, R, H, M, A1, A2, A3, A4, void, void, void, void)
00757 #define COH_METHOD3(R, H, M, A1, A2, A3) \
00758 COH_METHOD(3, R, H, M, A1, A2, A3, void, void, void, void, void)
00759 #define COH_METHOD2(R, H, M, A1, A2) \
00760 COH_METHOD(2, R, H, M, A1, A2, void, void, void, void, void, void)
00761 #define COH_METHOD1(R, H, M, A) \
00762 COH_METHOD(1, R, H, M, A, void, void, void, void, void, void, void)
00763 #define COH_METHOD0(R, H, M) \
00764 COH_METHOD(0, R, H, M, void, void, void, void, void, void, void, void)
00765
00766
00767
00768
00769
00770
00771
00772
00773
00774
00775
00776
00777
00778
00779
00780
00781 #define COH_MANAGED_METHOD8(S, R, H, M, A1, A2, A3, A4, A5, A6, A7, A8) \
00782 coherence::lang::TypedMethod<S, R, H::ValueType, H, \
00783 &H::ValueType::BoxedType::M, A1, A2, A3, A4, A5, A6, A7, A8>::create(#M)
00784 #define COH_MANAGED_METHOD7(S, R, H, M, A1, A2, A3, A4, A5, A6, A7) \
00785 COH_MANAGED_METHOD8(S, R, H, M, A1, A2, A3, A4, A5, A6, A7, void)
00786 #define COH_MANAGED_METHOD6(S, R, H, M, A1, A2, A3, A4, A5, A6) \
00787 COH_MANAGED_METHOD7(S, R, H, M, A1, A2, A3, A4, A5, A6, void)
00788 #define COH_MANAGED_METHOD5(S, R, H, M, A1, A2, A3, A4, A5) \
00789 COH_MANAGED_METHOD6(S, R, H, M, A1, A2, A3, A4, A5, void)
00790 #define COH_MANAGED_METHOD4(S, R, H, M, A1, A2, A3, A4) \
00791 COH_MANAGED_METHOD5(S, R, H, M, A1, A2, A3, A4, void)
00792 #define COH_MANAGED_METHOD3(S, R, H, M, A1, A2, A3) \
00793 COH_MANAGED_METHOD4(S, R, H, M, A1, A2, A3, void)
00794 #define COH_MANAGED_METHOD2(S, R, H, M, A1, A2) \
00795 COH_MANAGED_METHOD3(S, R, H, M, A1, A2, void)
00796 #define COH_MANAGED_METHOD1(S, R, H, M, A) \
00797 COH_MANAGED_METHOD2(S, R, H, M, A, void)
00798 #define COH_MANAGED_METHOD0(S, R, H, M) \
00799 COH_MANAGED_METHOD1(S, R, H, M, void)
00800
00801
00802
00803
00804
00805
00806
00807
00808 #define COH_PROPERTY(C, P, V) \
00809 COH_METHOD0(V, C::View, get##P)) \
00810 ->declare(COH_METHOD1(void, C::Handle, set##P, V)
00811
00812
00813
00814
00815
00816
00817
00818
00819 #define COH_BOX_PROPERTY(C, P, V) \
00820 COH_METHOD0(coherence::lang::BoxHandle<V::ValueType >, C::View, get##P)) \
00821 ->declare(COH_METHOD1(void, C::Handle, set##P, coherence::lang::BoxHandle<V::ValueType >)
00822
00823
00824
00825
00826
00827
00828
00829
00830
00831 #define COH_MANAGED_PROPERTY(C, P, V) \
00832 COH_MANAGED_METHOD0(V::ValueType::BoxedType (C::*)() const, coherence::lang::BoxHandle<V::ValueType >, coherence::lang::Managed<C >::View, get##P)) \
00833 ->declare(COH_MANAGED_METHOD1(void (C::*)(V::ValueType::BoxedType), void, coherence::lang::Managed<C >::Handle, set##P, coherence::lang::BoxHandle<V::ValueType >)
00834
00835 #endif // COH_TYPED_METHOD_HPP