r2corba 1.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (254) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGES +159 -0
  3. data/LICENSE +59 -0
  4. data/README +62 -0
  5. data/THANKS +52 -0
  6. data/bin/r2corba +8 -0
  7. data/bin/ridlc +11 -0
  8. data/bin/rins +7 -0
  9. data/ext/ext.mwc +6 -0
  10. data/ext/extload/extload.c +60 -0
  11. data/ext/libr2tao/any.cpp +1543 -0
  12. data/ext/libr2tao/exception.cpp +202 -0
  13. data/ext/libr2tao/exception.h +104 -0
  14. data/ext/libr2tao/longdouble.cpp +173 -0
  15. data/ext/libr2tao/longdouble.h +31 -0
  16. data/ext/libr2tao/object.cpp +1150 -0
  17. data/ext/libr2tao/object.h +38 -0
  18. data/ext/libr2tao/orb.cpp +1029 -0
  19. data/ext/libr2tao/orb.h +36 -0
  20. data/ext/libr2tao/r2tao_export.h +45 -0
  21. data/ext/libr2tao/r2tao_ext.h +38 -0
  22. data/ext/libr2tao/required.cpp +463 -0
  23. data/ext/libr2tao/required.h +187 -0
  24. data/ext/libr2tao/typecode.cpp +888 -0
  25. data/ext/libr2tao/typecode.h +45 -0
  26. data/ext/libr2tao/values.cpp +2938 -0
  27. data/ext/libr2tao/values.h +396 -0
  28. data/ext/librpoa/iortable.cpp +250 -0
  29. data/ext/librpoa/poa.cpp +1076 -0
  30. data/ext/librpoa/poa.h +24 -0
  31. data/ext/librpoa/rpoa_export.h +44 -0
  32. data/ext/librpoa/servant.cpp +1338 -0
  33. data/ext/librpoa/servant.h +116 -0
  34. data/ext/librpoa/srvreq_fix.cpp +283 -0
  35. data/ext/librpoa/srvreq_fix.h +149 -0
  36. data/ext/librpol/policies.cpp +763 -0
  37. data/ext/librpol/policies.h +15 -0
  38. data/ext/librpol/rpol_export.h +44 -0
  39. data/lib/corba/cbase/IORMap.rb +33 -0
  40. data/lib/corba/cbase/ORB.rb +231 -0
  41. data/lib/corba/cbase/Request.rb +134 -0
  42. data/lib/corba/cbase/Streams.rb +129 -0
  43. data/lib/corba/cbase/Stub.rb +19 -0
  44. data/lib/corba/cbase/Typecode.rb +441 -0
  45. data/lib/corba/cbase/Values.rb +129 -0
  46. data/lib/corba/cbase/exception.rb +66 -0
  47. data/lib/corba/cbase/poa.rb +23 -0
  48. data/lib/corba/cbase/policies.rb +78 -0
  49. data/lib/corba/cbase/post_require.rb +14 -0
  50. data/lib/corba/cbase/require.rb +28 -0
  51. data/lib/corba/cmds/base.rb +85 -0
  52. data/lib/corba/cmds/test.rb +30 -0
  53. data/lib/corba/common/Any.rb +91 -0
  54. data/lib/corba/common/IDL.rb +104 -0
  55. data/lib/corba/common/ORB.rb +368 -0
  56. data/lib/corba/common/Object.rb +208 -0
  57. data/lib/corba/common/Request.rb +20 -0
  58. data/lib/corba/common/Servant.rb +108 -0
  59. data/lib/corba/common/Struct.rb +22 -0
  60. data/lib/corba/common/Stub.rb +79 -0
  61. data/lib/corba/common/Typecode.rb +1121 -0
  62. data/lib/corba/common/Union.rb +56 -0
  63. data/lib/corba/common/Values.rb +92 -0
  64. data/lib/corba/common/const.rb +22 -0
  65. data/lib/corba/common/exception.rb +68 -0
  66. data/lib/corba/common/require.rb +27 -0
  67. data/lib/corba/common/version.rb +22 -0
  68. data/lib/corba/idl/IDL.rb +21 -0
  69. data/lib/corba/idl/IORTable.pidl +62 -0
  70. data/lib/corba/idl/TAO_Ext.pidl +46 -0
  71. data/lib/corba/idl/require.rb +20 -0
  72. data/lib/corba/jbase/Any.rb +273 -0
  73. data/lib/corba/jbase/IORMap.rb +36 -0
  74. data/lib/corba/jbase/ORB.rb +99 -0
  75. data/lib/corba/jbase/Object.rb +98 -0
  76. data/lib/corba/jbase/Request.rb +226 -0
  77. data/lib/corba/jbase/Servant.rb +247 -0
  78. data/lib/corba/jbase/ServerRequest.rb +128 -0
  79. data/lib/corba/jbase/Streams.rb +671 -0
  80. data/lib/corba/jbase/Stub.rb +38 -0
  81. data/lib/corba/jbase/Typecode.rb +520 -0
  82. data/lib/corba/jbase/Values.rb +173 -0
  83. data/lib/corba/jbase/exception.rb +106 -0
  84. data/lib/corba/jbase/poa.rb +229 -0
  85. data/lib/corba/jbase/policies.rb +300 -0
  86. data/lib/corba/jbase/post_require.rb +14 -0
  87. data/lib/corba/jbase/require.rb +86 -0
  88. data/lib/corba/naming.rb +14 -0
  89. data/lib/corba/naming_service.rb +15 -0
  90. data/lib/corba/poa.rb +15 -0
  91. data/lib/corba/policies.rb +18 -0
  92. data/lib/corba/require.rb +17 -0
  93. data/lib/corba/svcs/ins/cos_naming.rb +426 -0
  94. data/lib/corba/svcs/ins/ins.rb +526 -0
  95. data/lib/corba/svcs/ins/naming_service.rb +119 -0
  96. data/lib/corba.rb +16 -0
  97. data/lib/ridlbe/ruby/config.rb +336 -0
  98. data/lib/ridlbe/ruby/require.rb +16 -0
  99. data/lib/ridlbe/ruby/walker.rb +1582 -0
  100. data/mkrf_conf_srcgem.rb +186 -0
  101. data/rakelib/bin.rake +80 -0
  102. data/rakelib/bin.rb +146 -0
  103. data/rakelib/build.rake +87 -0
  104. data/rakelib/config.rake +52 -0
  105. data/rakelib/config.rb +450 -0
  106. data/rakelib/ext.rake +242 -0
  107. data/rakelib/ext.rb +308 -0
  108. data/rakelib/ext_r2tao.rb +232 -0
  109. data/rakelib/gem.rake +212 -0
  110. data/rakelib/gem.rb +146 -0
  111. data/rakelib/package.rake +26 -0
  112. data/rakelib/test.rake +23 -0
  113. data/test/BiDirectional/Test.idl +34 -0
  114. data/test/BiDirectional/client.rb +132 -0
  115. data/test/BiDirectional/run_test.rb +68 -0
  116. data/test/BiDirectional/server.rb +169 -0
  117. data/test/CORBA_Services/Naming/BindingIterator/Test.idl +27 -0
  118. data/test/CORBA_Services/Naming/BindingIterator/client.rb +121 -0
  119. data/test/CORBA_Services/Naming/BindingIterator/run_test.rb +82 -0
  120. data/test/CORBA_Services/Naming/BindingIterator/server.rb +109 -0
  121. data/test/CORBA_Services/Naming/Corbaname/Test.idl +27 -0
  122. data/test/CORBA_Services/Naming/Corbaname/client.rb +85 -0
  123. data/test/CORBA_Services/Naming/Corbaname/run_test.rb +88 -0
  124. data/test/CORBA_Services/Naming/Corbaname/server.rb +135 -0
  125. data/test/CORBA_Services/Naming/Simple/Test.idl +27 -0
  126. data/test/CORBA_Services/Naming/Simple/client.rb +84 -0
  127. data/test/CORBA_Services/Naming/Simple/run_test.rb +82 -0
  128. data/test/CORBA_Services/Naming/Simple/server.rb +109 -0
  129. data/test/Collocation/Diamond.idl +39 -0
  130. data/test/Collocation/run_test.rb +52 -0
  131. data/test/Collocation/test.rb +195 -0
  132. data/test/Connect_Timeout/Test.idl +27 -0
  133. data/test/Connect_Timeout/client.rb +111 -0
  134. data/test/Connect_Timeout/run_test.rb +52 -0
  135. data/test/DII/Test.idl +27 -0
  136. data/test/DII/client.rb +115 -0
  137. data/test/DII/run_test.rb +69 -0
  138. data/test/DII/server.rb +95 -0
  139. data/test/DSI/Test.idl +27 -0
  140. data/test/DSI/client.rb +66 -0
  141. data/test/DSI/run_test.rb +69 -0
  142. data/test/DSI/server.rb +106 -0
  143. data/test/Exceptions/Test.idl +48 -0
  144. data/test/Exceptions/client.rb +118 -0
  145. data/test/Exceptions/run_test.rb +69 -0
  146. data/test/Exceptions/server.rb +131 -0
  147. data/test/Hello/Test.idl +27 -0
  148. data/test/Hello/client.rb +78 -0
  149. data/test/Hello/run_test.rb +71 -0
  150. data/test/Hello/server.rb +95 -0
  151. data/test/IDL_Test/Test.idl +113 -0
  152. data/test/IDL_Test/Test_inc.idl +17 -0
  153. data/test/IDL_Test/client.rb +102 -0
  154. data/test/IDL_Test/run_test.rb +69 -0
  155. data/test/IDL_Test/server.rb +99 -0
  156. data/test/IORMap/Test.idl +27 -0
  157. data/test/IORMap/client.rb +73 -0
  158. data/test/IORMap/run_test.rb +69 -0
  159. data/test/IORMap/server.rb +114 -0
  160. data/test/IORTable/Test.idl +27 -0
  161. data/test/IORTable/client.rb +75 -0
  162. data/test/IORTable/run_test.rb +69 -0
  163. data/test/IORTable/server.rb +130 -0
  164. data/test/Implicit_Conversion/Test.idl +31 -0
  165. data/test/Implicit_Conversion/client.rb +110 -0
  166. data/test/Implicit_Conversion/run_test.rb +69 -0
  167. data/test/Implicit_Conversion/server.rb +99 -0
  168. data/test/Multi_Threading/Multiple_ORB/Test.idl +27 -0
  169. data/test/Multi_Threading/Multiple_ORB/client.rb +82 -0
  170. data/test/Multi_Threading/Multiple_ORB/run_test.rb +71 -0
  171. data/test/Multi_Threading/Multiple_ORB/server.rb +108 -0
  172. data/test/Multi_Threading/Simple/Test.idl +27 -0
  173. data/test/Multi_Threading/Simple/client.rb +88 -0
  174. data/test/Multi_Threading/Simple/run_test.rb +69 -0
  175. data/test/Multi_Threading/Simple/server.rb +118 -0
  176. data/test/Multi_Threading/Threads/Test.idl +31 -0
  177. data/test/Multi_Threading/Threads/client.rb +80 -0
  178. data/test/Multi_Threading/Threads/run_test.rb +76 -0
  179. data/test/Multi_Threading/Threads/server.rb +119 -0
  180. data/test/Multi_Threading/Threads/watchdog.rb +87 -0
  181. data/test/Multiple_Servant_Interfaces/Test.idl +34 -0
  182. data/test/Multiple_Servant_Interfaces/client.rb +70 -0
  183. data/test/Multiple_Servant_Interfaces/run_test.rb +69 -0
  184. data/test/Multiple_Servant_Interfaces/server.rb +102 -0
  185. data/test/Nil/Test.idl +27 -0
  186. data/test/Nil/run_test.rb +52 -0
  187. data/test/Nil/test.rb +78 -0
  188. data/test/OBV/AbstractInterface/client.rb +179 -0
  189. data/test/OBV/AbstractInterface/run_test.rb +69 -0
  190. data/test/OBV/AbstractInterface/server.rb +149 -0
  191. data/test/OBV/AbstractInterface/test.idl +53 -0
  192. data/test/OBV/Custom/OBV.idl +18 -0
  193. data/test/OBV/Custom/OBV_impl.rb +40 -0
  194. data/test/OBV/Custom/client.rb +86 -0
  195. data/test/OBV/Custom/run_test.rb +69 -0
  196. data/test/OBV/Custom/server.rb +100 -0
  197. data/test/OBV/Simple/OBV.idl +15 -0
  198. data/test/OBV/Simple/OBV_impl.rb +26 -0
  199. data/test/OBV/Simple/client.rb +86 -0
  200. data/test/OBV/Simple/run_test.rb +69 -0
  201. data/test/OBV/Simple/server.rb +100 -0
  202. data/test/OBV/Simple_Event/Event.idl +15 -0
  203. data/test/OBV/Simple_Event/Event_impl.rb +26 -0
  204. data/test/OBV/Simple_Event/client.rb +86 -0
  205. data/test/OBV/Simple_Event/run_test.rb +69 -0
  206. data/test/OBV/Simple_Event/server.rb +100 -0
  207. data/test/OBV/Supports/client.rb +116 -0
  208. data/test/OBV/Supports/run_test.rb +69 -0
  209. data/test/OBV/Supports/server.rb +103 -0
  210. data/test/OBV/Supports/supports.idl +33 -0
  211. data/test/OBV/Supports/supports_impl.rb +57 -0
  212. data/test/OBV/Tree/client.rb +116 -0
  213. data/test/OBV/Tree/run_test.rb +69 -0
  214. data/test/OBV/Tree/server.rb +117 -0
  215. data/test/OBV/Tree/test.idl +32 -0
  216. data/test/OBV/Truncatable/Extra.idl +27 -0
  217. data/test/OBV/Truncatable/Truncatable.idl +105 -0
  218. data/test/OBV/Truncatable/Truncatable_impl.rb +86 -0
  219. data/test/OBV/Truncatable/client.rb +279 -0
  220. data/test/OBV/Truncatable/run_test.rb +69 -0
  221. data/test/OBV/Truncatable/server.rb +89 -0
  222. data/test/OBV/ValueBox/client.rb +497 -0
  223. data/test/OBV/ValueBox/run_test.rb +69 -0
  224. data/test/OBV/ValueBox/server.rb +271 -0
  225. data/test/OBV/ValueBox/valuebox.idl +101 -0
  226. data/test/OBV/ValueBox/vb_basic.idl +75 -0
  227. data/test/OBV/ValueBox/vb_struct.idl +68 -0
  228. data/test/OBV/ValueBox/vb_union.idl +21 -0
  229. data/test/Object/Test.idl +27 -0
  230. data/test/Object/client.rb +103 -0
  231. data/test/Object/run_test.rb +69 -0
  232. data/test/Object/server.rb +126 -0
  233. data/test/POA/Test.idl +27 -0
  234. data/test/POA/run_test.rb +52 -0
  235. data/test/POA/test.rb +112 -0
  236. data/test/Param_Test/Test.idl +182 -0
  237. data/test/Param_Test/client.rb +277 -0
  238. data/test/Param_Test/run_test.rb +69 -0
  239. data/test/Param_Test/server.rb +296 -0
  240. data/test/Performance/Simple/Test.idl +27 -0
  241. data/test/Performance/Simple/client.rb +90 -0
  242. data/test/Performance/Simple/run_test.rb +69 -0
  243. data/test/Performance/Simple/server.rb +95 -0
  244. data/test/Policies/Test.idl +27 -0
  245. data/test/Policies/run_test.rb +52 -0
  246. data/test/Policies/test.rb +144 -0
  247. data/test/Timeout/client.rb +207 -0
  248. data/test/Timeout/run_test.rb +69 -0
  249. data/test/Timeout/server.rb +109 -0
  250. data/test/Timeout/test.idl +19 -0
  251. data/test/lib/assert.rb +43 -0
  252. data/test/lib/test.rb +542 -0
  253. data/test/test_runner.rb +193 -0
  254. metadata +334 -0
@@ -0,0 +1,888 @@
1
+ /*--------------------------------------------------------------------
2
+ # typecode.cpp - R2TAO CORBA TypeCode support
3
+ #
4
+ # Author: Martin Corino
5
+ #
6
+ # This program is free software; you can redistribute it and/or
7
+ # modify it under the terms of the R2CORBA LICENSE which is
8
+ # included with this program.
9
+ #
10
+ # Copyright (c) Remedy IT Expertise BV
11
+ # Chamber of commerce Rotterdam nr.276339, The Netherlands
12
+ #------------------------------------------------------------------*/
13
+
14
+ #include "required.h"
15
+ #include "typecode.h"
16
+ #include "exception.h"
17
+ #include "object.h"
18
+ #include "tao/IFR_Client/IFR_BaseC.h"
19
+ #include "tao/TypeCodeFactory/TypeCodeFactory_Loader.h"
20
+ #include "tao/TypeCodeFactory_Adapter.h"
21
+ #include "tao/ORB_Core.h"
22
+ #include "ace/Dynamic_Service.h"
23
+
24
+ VALUE R2TAO_EXPORT r2corba_cTypeCode = 0;
25
+ VALUE R2TAO_EXPORT r2tao_cTypeCode = 0;
26
+
27
+ // CORBA TypeCode instance methods
28
+ static VALUE r2tao_TypeCode_kind(VALUE self);
29
+ static VALUE r2tao_TypeCode_compact_typecode(VALUE self);
30
+ static VALUE r2tao_TypeCode_equal(VALUE self, VALUE tc);
31
+ static VALUE r2tao_TypeCode_equivalent(VALUE self, VALUE tc);
32
+ static VALUE r2tao_TypeCode_id(VALUE self);
33
+ static VALUE r2tao_TypeCode_name(VALUE self);
34
+ static VALUE r2tao_TypeCode_member_count(VALUE self);
35
+ static VALUE r2tao_TypeCode_member_name(VALUE self, VALUE index);
36
+ static VALUE r2tao_TypeCode_member_type(VALUE self, VALUE index);
37
+ static VALUE r2tao_TypeCode_member_label(VALUE self, VALUE index);
38
+ static VALUE r2tao_TypeCode_member_visibility(VALUE self, VALUE index);
39
+ static VALUE r2tao_TypeCode_discriminator_type(VALUE self);
40
+ static VALUE r2tao_TypeCode_default_index(VALUE self);
41
+ static VALUE r2tao_TypeCode_length(VALUE self);
42
+ static VALUE r2tao_TypeCode_content_type(VALUE self);
43
+ static VALUE r2tao_TypeCode_fixed_digits(VALUE self);
44
+ static VALUE r2tao_TypeCode_fixed_scale(VALUE self);
45
+ static VALUE r2tao_TypeCode_type_modifier(VALUE self);
46
+ static VALUE r2tao_TypeCode_concrete_basetype(VALUE self);
47
+
48
+ // CORBA TypeCode class method
49
+ static VALUE r2tao_TypeCode_create_recursive_tc(VALUE klass, VALUE id);
50
+ static VALUE r2tao_TypeCode_create_tc(int _argc, VALUE *_argv0, VALUE klass);
51
+ static VALUE r2tao_TypeCode_get_primitive_tc(VALUE klass, VALUE kind);
52
+
53
+ static VALUE r2tao_sym_default;
54
+
55
+ void r2tao_init_Any(); // in any.cpp
56
+
57
+ void r2tao_init_LongDouble(); // in longdouble.cpp
58
+
59
+ void r2tao_Init_Typecode()
60
+ {
61
+ VALUE k;
62
+
63
+ if (r2tao_cTypeCode) return;
64
+
65
+ //rb_eval_string("puts 'r2tao_Init_Typecode start' if $VERBOSE");
66
+
67
+ r2corba_cTypeCode = rb_eval_string ("::R2CORBA::CORBA::TypeCode");
68
+ k = r2tao_cTypeCode =
69
+ rb_define_class_under (r2tao_nsCORBA_Native, "TypeCode", rb_cObject);
70
+
71
+ //rb_eval_string("puts 'r2tao_Init_Typecode 2' if $VERBOSE");
72
+
73
+ // define TypeCode methods
74
+ rb_define_method(k, "kind", RUBY_METHOD_FUNC(r2tao_TypeCode_kind), 0);
75
+ rb_define_method(k, "get_compact_typecode", RUBY_METHOD_FUNC(r2tao_TypeCode_compact_typecode), 0);
76
+ rb_define_method(k, "equal", RUBY_METHOD_FUNC(r2tao_TypeCode_equal), 1);
77
+ rb_define_method(k, "equivalent", RUBY_METHOD_FUNC(r2tao_TypeCode_equivalent), 1);
78
+ rb_define_method(k, "id", RUBY_METHOD_FUNC(r2tao_TypeCode_id), 0);
79
+ rb_define_method(k, "name", RUBY_METHOD_FUNC(r2tao_TypeCode_name), 0);
80
+ rb_define_method(k, "member_count", RUBY_METHOD_FUNC(r2tao_TypeCode_member_count), 0);
81
+ rb_define_method(k, "member_name", RUBY_METHOD_FUNC(r2tao_TypeCode_member_name), 1);
82
+ rb_define_method(k, "member_type", RUBY_METHOD_FUNC(r2tao_TypeCode_member_type), 1);
83
+ rb_define_method(k, "member_label", RUBY_METHOD_FUNC(r2tao_TypeCode_member_label), 1);
84
+ rb_define_method(k, "member_visibility", RUBY_METHOD_FUNC(r2tao_TypeCode_member_visibility), 1);
85
+ rb_define_method(k, "discriminator_type", RUBY_METHOD_FUNC(r2tao_TypeCode_discriminator_type), 0);
86
+ rb_define_method(k, "default_index", RUBY_METHOD_FUNC(r2tao_TypeCode_default_index), 0);
87
+ rb_define_method(k, "length", RUBY_METHOD_FUNC(r2tao_TypeCode_length), 0);
88
+ rb_define_method(k, "content_type", RUBY_METHOD_FUNC(r2tao_TypeCode_content_type), 0);
89
+ rb_define_method(k, "fixed_digits", RUBY_METHOD_FUNC(r2tao_TypeCode_fixed_digits), 0);
90
+ rb_define_method(k, "fixed_scale", RUBY_METHOD_FUNC(r2tao_TypeCode_fixed_scale), 0);
91
+ rb_define_method(k, "type_modifier", RUBY_METHOD_FUNC(r2tao_TypeCode_type_modifier), 0);
92
+ rb_define_method(k, "concrete_basetype", RUBY_METHOD_FUNC(r2tao_TypeCode_concrete_basetype), 0);
93
+
94
+ rb_define_singleton_method(k, "create_recursive_tc", RUBY_METHOD_FUNC(r2tao_TypeCode_create_recursive_tc), 1);
95
+ rb_define_singleton_method(k, "create_tc", RUBY_METHOD_FUNC(r2tao_TypeCode_create_tc), -1);
96
+ rb_define_singleton_method(k, "get_primitive_tc", RUBY_METHOD_FUNC(r2tao_TypeCode_get_primitive_tc), 1);
97
+
98
+ // define TypeCode-kind constants
99
+ rb_define_const (r2tao_nsCORBA, "TK_NULL", INT2NUM (CORBA::tk_null));
100
+ rb_define_const (r2tao_nsCORBA, "TK_VOID", INT2NUM (CORBA::tk_void));
101
+ rb_define_const (r2tao_nsCORBA, "TK_SHORT", INT2NUM (CORBA::tk_short));
102
+ rb_define_const (r2tao_nsCORBA, "TK_LONG", INT2NUM (CORBA::tk_long));
103
+ rb_define_const (r2tao_nsCORBA, "TK_USHORT", INT2NUM (CORBA::tk_ushort));
104
+ rb_define_const (r2tao_nsCORBA, "TK_ULONG", INT2NUM (CORBA::tk_ulong));
105
+ rb_define_const (r2tao_nsCORBA, "TK_FLOAT", INT2NUM (CORBA::tk_float));
106
+ rb_define_const (r2tao_nsCORBA, "TK_DOUBLE", INT2NUM (CORBA::tk_double));
107
+ rb_define_const (r2tao_nsCORBA, "TK_BOOLEAN", INT2NUM (CORBA::tk_boolean));
108
+ rb_define_const (r2tao_nsCORBA, "TK_CHAR", INT2NUM (CORBA::tk_char));
109
+ rb_define_const (r2tao_nsCORBA, "TK_OCTET", INT2NUM (CORBA::tk_octet));
110
+ rb_define_const (r2tao_nsCORBA, "TK_ANY", INT2NUM (CORBA::tk_any));
111
+ rb_define_const (r2tao_nsCORBA, "TK_TYPECODE", INT2NUM (CORBA::tk_TypeCode));
112
+ rb_define_const (r2tao_nsCORBA, "TK_PRINCIPAL", INT2NUM (CORBA::tk_Principal));
113
+ rb_define_const (r2tao_nsCORBA, "TK_OBJREF", INT2NUM (CORBA::tk_objref));
114
+ rb_define_const (r2tao_nsCORBA, "TK_STRUCT", INT2NUM (CORBA::tk_struct));
115
+ rb_define_const (r2tao_nsCORBA, "TK_UNION", INT2NUM (CORBA::tk_union));
116
+ rb_define_const (r2tao_nsCORBA, "TK_ENUM", INT2NUM (CORBA::tk_enum));
117
+ rb_define_const (r2tao_nsCORBA, "TK_STRING", INT2NUM (CORBA::tk_string));
118
+ rb_define_const (r2tao_nsCORBA, "TK_SEQUENCE", INT2NUM (CORBA::tk_sequence));
119
+ rb_define_const (r2tao_nsCORBA, "TK_ARRAY", INT2NUM (CORBA::tk_array));
120
+ rb_define_const (r2tao_nsCORBA, "TK_ALIAS", INT2NUM (CORBA::tk_alias));
121
+ rb_define_const (r2tao_nsCORBA, "TK_EXCEPT", INT2NUM (CORBA::tk_except));
122
+ rb_define_const (r2tao_nsCORBA, "TK_LONGLONG", INT2NUM (CORBA::tk_longlong));
123
+ rb_define_const (r2tao_nsCORBA, "TK_ULONGLONG", INT2NUM (CORBA::tk_ulonglong));
124
+ rb_define_const (r2tao_nsCORBA, "TK_LONGDOUBLE", INT2NUM (CORBA::tk_longdouble));
125
+ rb_define_const (r2tao_nsCORBA, "TK_WCHAR", INT2NUM (CORBA::tk_wchar));
126
+ rb_define_const (r2tao_nsCORBA, "TK_WSTRING", INT2NUM (CORBA::tk_wstring));
127
+ rb_define_const (r2tao_nsCORBA, "TK_FIXED", INT2NUM (CORBA::tk_fixed));
128
+ rb_define_const (r2tao_nsCORBA, "TK_VALUE", INT2NUM (CORBA::tk_value));
129
+ rb_define_const (r2tao_nsCORBA, "TK_VALUE_BOX", INT2NUM (CORBA::tk_value_box));
130
+ rb_define_const (r2tao_nsCORBA, "TK_NATIVE", INT2NUM (CORBA::tk_native));
131
+ rb_define_const (r2tao_nsCORBA, "TK_ABSTRACT_INTERFACE", INT2NUM (CORBA::tk_abstract_interface));
132
+ rb_define_const (r2tao_nsCORBA, "TK_LOCAL_INTERFACE", INT2NUM (CORBA::tk_local_interface));
133
+ rb_define_const (r2tao_nsCORBA, "TK_COMPONENT", INT2NUM (CORBA::tk_component));
134
+ rb_define_const (r2tao_nsCORBA, "TK_HOME", INT2NUM (CORBA::tk_home));
135
+ rb_define_const (r2tao_nsCORBA, "TK_EVENT", INT2NUM (CORBA::tk_event));
136
+
137
+ r2tao_sym_default = rb_eval_string(":default");
138
+
139
+ r2tao_init_Any(); // initialize CORBA::Any support
140
+
141
+ r2tao_init_LongDouble(); // initialize CORBA::LongDouble class
142
+
143
+ //rb_eval_string("puts 'r2tao_Init_Typecode end' if $VERBOSE");
144
+ }
145
+
146
+ //-------------------------------------------------------------------
147
+ // CORBA TypeCode methods
148
+ //
149
+ //===================================================================
150
+
151
+ static void _tc_free(void* ptr)
152
+ {
153
+ if (ptr)
154
+ {
155
+ if (TAO_debug_level > 10)
156
+ ACE_DEBUG ((LM_INFO, "R2TAO (%P|%t) - _tc_free:: dereferencing typecode %@\n", ptr));
157
+
158
+ CORBA::release ((CORBA::TypeCode_ptr)ptr);
159
+ }
160
+ }
161
+
162
+ R2TAO_EXPORT VALUE
163
+ r2tao_TypeCode_t2r(CORBA::TypeCode_ptr obj)
164
+ {
165
+ VALUE ret;
166
+ CORBA::TypeCode_ptr _tc;
167
+
168
+ if (TAO_debug_level > 10)
169
+ ACE_DEBUG ((LM_INFO, "R2TAO (%P|%t) - r2tao_TypeCode_t2r:: referencing typecode %@\n", obj));
170
+
171
+ _tc = CORBA::TypeCode::_duplicate(obj);
172
+ ret = Data_Wrap_Struct(r2tao_cTypeCode, 0, _tc_free, _tc);
173
+
174
+ return ret;
175
+ }
176
+
177
+ R2TAO_EXPORT CORBA::TypeCode_ptr
178
+ r2tao_TypeCode_r2t(VALUE obj)
179
+ {
180
+ CORBA::TypeCode_ptr ret;
181
+
182
+ r2tao_check_type(obj, r2tao_cTypeCode);
183
+ Data_Get_Struct(obj, CORBA::TypeCode, ret);
184
+ return ret;
185
+ }
186
+
187
+ R2TAO_EXPORT VALUE
188
+ r2corba_TypeCode_t2r(CORBA::TypeCode_ptr obj)
189
+ {
190
+ static ID from_native_ID = rb_intern ("from_native");
191
+
192
+ return rb_funcall (r2corba_cTypeCode, from_native_ID, 1, r2tao_TypeCode_t2r (obj));
193
+ }
194
+
195
+ R2TAO_EXPORT CORBA::TypeCode_ptr
196
+ r2corba_TypeCode_r2t(VALUE obj)
197
+ {
198
+ static ID tc_ID = rb_intern ("tc_");
199
+
200
+ return r2tao_TypeCode_r2t (rb_funcall (obj, tc_ID, 0));
201
+ }
202
+
203
+ /*
204
+ * Class methods
205
+ */
206
+
207
+ VALUE r2tao_TypeCode_get_primitive_tc(VALUE /*self*/, VALUE rkind)
208
+ {
209
+ CORBA::TypeCode_ptr tc = CORBA::TypeCode::_nil ();
210
+ CORBA::TCKind kind = (CORBA::TCKind)NUM2INT (rkind);
211
+ switch (kind)
212
+ {
213
+ case CORBA::tk_null:
214
+ tc = CORBA::_tc_null;
215
+ break;
216
+ case CORBA::tk_void:
217
+ tc = CORBA::_tc_void;
218
+ break;
219
+ case CORBA::tk_short:
220
+ tc = CORBA::_tc_short;
221
+ break;
222
+ case CORBA::tk_long:
223
+ tc = CORBA::_tc_long;
224
+ break;
225
+ case CORBA::tk_ushort:
226
+ tc = CORBA::_tc_ushort;
227
+ break;
228
+ case CORBA::tk_ulong:
229
+ tc = CORBA::_tc_ulong;
230
+ break;
231
+ case CORBA::tk_longlong:
232
+ tc = CORBA::_tc_longlong;
233
+ break;
234
+ case CORBA::tk_ulonglong:
235
+ tc = CORBA::_tc_ulonglong;
236
+ break;
237
+ case CORBA::tk_float:
238
+ tc = CORBA::_tc_float;
239
+ break;
240
+ case CORBA::tk_double:
241
+ tc = CORBA::_tc_double;
242
+ break;
243
+ case CORBA::tk_longdouble:
244
+ tc = CORBA::_tc_longdouble;
245
+ break;
246
+ case CORBA::tk_boolean:
247
+ tc = CORBA::_tc_boolean;
248
+ break;
249
+ case CORBA::tk_char:
250
+ tc = CORBA::_tc_char;
251
+ break;
252
+ case CORBA::tk_octet:
253
+ tc = CORBA::_tc_octet;
254
+ break;
255
+ case CORBA::tk_wchar:
256
+ tc = CORBA::_tc_wchar;
257
+ break;
258
+ case CORBA::tk_any:
259
+ tc = CORBA::_tc_any;
260
+ break;
261
+ case CORBA::tk_TypeCode:
262
+ tc = CORBA::_tc_TypeCode;
263
+ break;
264
+ case CORBA::tk_Principal:
265
+ tc = CORBA::_tc_Principal;
266
+ break;
267
+ case CORBA::tk_objref:
268
+ tc = CORBA::_tc_Object;
269
+ break;
270
+ default:
271
+ return Qnil;
272
+ }
273
+
274
+ if (TAO_debug_level > 9)
275
+ ACE_DEBUG ((LM_INFO, "R2TAO (%P|%t) - TypeCode::get_primitive_tc:: "
276
+ "referencing primitive typecode %d\n",
277
+ kind));
278
+ return r2tao_TypeCode_t2r (tc);
279
+ }
280
+
281
+ /*
282
+ * TypeCode creation
283
+ */
284
+
285
+ VALUE r2tao_TypeCode_create_recursive_tc(VALUE /*klass*/, VALUE id)
286
+ {
287
+ TAO_TypeCodeFactory_Adapter *adapter =
288
+ ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance (
289
+ TAO_ORB_Core::typecodefactory_adapter_name ());
290
+
291
+ if (adapter == 0)
292
+ {
293
+ X_CORBA(INTERNAL);
294
+ }
295
+
296
+ CORBA::TypeCode_var _tc = CORBA::TypeCode::_nil ();
297
+
298
+ R2TAO_TRY
299
+ {
300
+ CHECK_RTYPE(id, T_STRING);
301
+
302
+ if (TAO_debug_level > 9)
303
+ ACE_DEBUG ((LM_INFO, "R2TAO (%P|%t) - TypeCode::create_recursive_tc:: "
304
+ "creating recursive typecode %s\n",
305
+ RSTRING_PTR (id)));
306
+
307
+ _tc = adapter->create_recursive_tc(RSTRING_PTR (id));
308
+ }
309
+ R2TAO_CATCH;
310
+
311
+ return r2tao_TypeCode_t2r (_tc);
312
+ }
313
+
314
+ VALUE r2tao_TypeCode_create_tc(int _argc, VALUE *_argv0, VALUE /*klass*/)
315
+ {
316
+ TAO_TypeCodeFactory_Adapter *adapter =
317
+ ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance (
318
+ TAO_ORB_Core::typecodefactory_adapter_name ());
319
+
320
+ if (adapter == 0)
321
+ {
322
+ X_CORBA(INTERNAL);
323
+ }
324
+
325
+ VALUE rkind;
326
+ VALUE args;
327
+ rb_scan_args(_argc, _argv0, "1*", &rkind, &args);
328
+
329
+ CORBA::TypeCode_ptr _tc = CORBA::TypeCode::_nil ();
330
+
331
+ R2TAO_TRY
332
+ {
333
+ CORBA::TCKind _kind = (CORBA::TCKind)NUM2INT (rkind);
334
+
335
+ if (TAO_debug_level > 9)
336
+ ACE_DEBUG ((LM_INFO, "R2TAO (%P|%t) - TypeCode::create_tc:: "
337
+ "creating typecode of kind %d\n",
338
+ _kind));
339
+
340
+ switch (_kind)
341
+ {
342
+ case CORBA::tk_abstract_interface:
343
+ {
344
+ VALUE rid = rb_ary_shift (args);
345
+ VALUE rname = rb_ary_shift (args);
346
+ CHECK_RTYPE(rid, T_STRING);
347
+ CHECK_RTYPE(rname, T_STRING);
348
+ _tc = adapter->create_abstract_interface_tc (RSTRING_PTR (rid), RSTRING_PTR (rname));
349
+ }
350
+ break;
351
+
352
+ case CORBA::tk_objref:
353
+ {
354
+ VALUE rid = rb_ary_shift (args);
355
+ VALUE rname = rb_ary_shift (args);
356
+ CHECK_RTYPE(rid, T_STRING);
357
+ CHECK_RTYPE(rname, T_STRING);
358
+ _tc = adapter->create_interface_tc (RSTRING_PTR (rid), RSTRING_PTR (rname));
359
+ }
360
+ break;
361
+
362
+ case CORBA::tk_home:
363
+ {
364
+ VALUE rid = rb_ary_shift (args);
365
+ VALUE rname = rb_ary_shift (args);
366
+ CHECK_RTYPE(rid, T_STRING);
367
+ CHECK_RTYPE(rname, T_STRING);
368
+ _tc = adapter->create_home_tc (RSTRING_PTR (rid), RSTRING_PTR (rname));
369
+ }
370
+ break;
371
+
372
+ case CORBA::tk_component:
373
+ {
374
+ VALUE rid = rb_ary_shift (args);
375
+ VALUE rname = rb_ary_shift (args);
376
+ CHECK_RTYPE(rid, T_STRING);
377
+ CHECK_RTYPE(rname, T_STRING);
378
+ _tc = adapter->create_component_tc (RSTRING_PTR (rid), RSTRING_PTR (rname));
379
+ }
380
+ break;
381
+
382
+ case CORBA::tk_value_box:
383
+ case CORBA::tk_alias:
384
+ {
385
+ VALUE rid = rb_ary_shift (args);
386
+ VALUE rname = rb_ary_shift (args);
387
+ CHECK_RTYPE(rid, T_STRING);
388
+ CHECK_RTYPE(rname, T_STRING);
389
+ VALUE raliased_tc = rb_ary_shift (args);
390
+ CORBA::TypeCode_ptr _aliased_tc = r2tao_TypeCode_r2t (raliased_tc);
391
+ if (CORBA::tk_alias == _kind)
392
+ _tc = adapter->create_alias_tc (RSTRING_PTR (rid), RSTRING_PTR (rname),
393
+ _aliased_tc);
394
+ else
395
+ _tc = adapter->create_value_box_tc (RSTRING_PTR (rid), RSTRING_PTR (rname),
396
+ _aliased_tc);
397
+ }
398
+ break;
399
+
400
+ case CORBA::tk_value:
401
+ case CORBA::tk_event:
402
+ {
403
+ VALUE rid = rb_ary_shift (args);
404
+ VALUE rname = rb_ary_shift (args);
405
+ CHECK_RTYPE(rid, T_STRING);
406
+ CHECK_RTYPE(rname, T_STRING);
407
+ VALUE rmodifier = rb_ary_shift (args);
408
+ CORBA::ValueModifier modifier =
409
+ static_cast <CORBA::ValueModifier> (NUM2INT (rmodifier));
410
+ VALUE rbase_tc = rb_ary_shift (args);
411
+ CORBA::TypeCode_ptr base_tc = CORBA::TypeCode::_nil ();
412
+ if (! NIL_P(rbase_tc))
413
+ {
414
+ base_tc = r2tao_TypeCode_r2t (rbase_tc);
415
+ }
416
+ VALUE rmembers = rb_ary_shift (args);
417
+ CHECK_RTYPE(rmembers, T_ARRAY);
418
+ CORBA::ULong count = static_cast<unsigned long> (RARRAY_LEN (rmembers));
419
+ CORBA::ValueMemberSeq members (count);
420
+ members.length (count);
421
+ for (unsigned long m=0; m<count ;++m)
422
+ {
423
+ VALUE mset = rb_ary_entry (rmembers, m);
424
+ CHECK_RTYPE(mset, T_ARRAY);
425
+ VALUE mname = rb_ary_entry (mset, 0);
426
+ CHECK_RTYPE(mname, T_STRING);
427
+ VALUE rmtc = rb_ary_entry (mset, 1);
428
+ CORBA::TypeCode_ptr mtc = r2tao_TypeCode_r2t (rmtc);
429
+ VALUE raccess = rb_ary_entry (mset, 2);
430
+ CORBA::Visibility access = static_cast<CORBA::Visibility> (NUM2INT (raccess));
431
+ members[m].name = CORBA::string_dup (RSTRING_PTR (mname));
432
+ members[m].type = CORBA::TypeCode::_duplicate (mtc);
433
+ members[m].access = access;
434
+ }
435
+ if (CORBA::tk_value == _kind)
436
+ _tc = adapter->create_value_tc(RSTRING_PTR (rid),
437
+ RSTRING_PTR (rname),
438
+ modifier,
439
+ base_tc,
440
+ members);
441
+ else
442
+ _tc = adapter->create_event_tc(RSTRING_PTR (rid),
443
+ RSTRING_PTR (rname),
444
+ modifier,
445
+ base_tc,
446
+ members);
447
+ }
448
+ break;
449
+
450
+ case CORBA::tk_sequence:
451
+ case CORBA::tk_array:
452
+ {
453
+ VALUE rcont_bound = rb_ary_shift (args);
454
+ CHECK_RTYPE(rcont_bound, T_FIXNUM);
455
+ VALUE rcontent_tc = rb_ary_shift (args);
456
+ CORBA::TypeCode_ptr _content_tc = r2tao_TypeCode_r2t (rcontent_tc);
457
+ CORBA::ULong _bound = NUM2ULONG (rcont_bound);
458
+ if (CORBA::tk_sequence == _kind)
459
+ _tc = adapter->create_sequence_tc (_bound, _content_tc);
460
+ else
461
+ _tc = adapter->create_array_tc (_bound, _content_tc);
462
+ }
463
+ break;
464
+
465
+ case CORBA::tk_string:
466
+ {
467
+ VALUE rlength = rb_ary_shift (args);
468
+ CHECK_RTYPE(rlength, T_FIXNUM);
469
+ CORBA::ULong _length = NUM2ULONG (rlength);
470
+ if (_length)
471
+ {
472
+ _tc = adapter->create_string_tc (_length);
473
+ }
474
+ else
475
+ {
476
+ _tc = CORBA::_tc_string;
477
+ }
478
+ }
479
+ break;
480
+
481
+ case CORBA::tk_wstring:
482
+ {
483
+ VALUE rlength = rb_ary_shift (args);
484
+ CHECK_RTYPE(rlength, T_FIXNUM);
485
+ CORBA::ULong _length = NUM2ULONG (rlength);
486
+ if (_length)
487
+ {
488
+ _tc = adapter->create_wstring_tc (_length);
489
+ }
490
+ else
491
+ {
492
+ _tc = CORBA::_tc_wstring;
493
+ }
494
+ }
495
+ break;
496
+
497
+ case CORBA::tk_except:
498
+ case CORBA::tk_struct:
499
+ {
500
+ VALUE rid = rb_ary_shift (args);
501
+ VALUE rname = rb_ary_shift (args);
502
+ CHECK_RTYPE(rid, T_STRING);
503
+ CHECK_RTYPE(rname, T_STRING);
504
+ VALUE rmembers = rb_ary_shift (args);
505
+ CHECK_RTYPE(rmembers, T_ARRAY);
506
+ CORBA::ULong count = static_cast<unsigned long> (RARRAY_LEN (rmembers));
507
+ CORBA::StructMemberSeq members (count);
508
+ members.length (count);
509
+ for (unsigned long m=0; m<count ;++m)
510
+ {
511
+ VALUE mset = rb_ary_entry (rmembers, m);
512
+ CHECK_RTYPE(mset, T_ARRAY);
513
+ VALUE mname = rb_ary_entry (mset, 0);
514
+ CHECK_RTYPE(mname, T_STRING);
515
+ VALUE rmtc = rb_ary_entry (mset, 1);
516
+ CORBA::TypeCode_ptr mtc = r2tao_TypeCode_r2t (rmtc);
517
+ members[m].name = CORBA::string_dup (RSTRING_PTR (mname));
518
+ members[m].type = CORBA::TypeCode::_duplicate (mtc);
519
+ }
520
+ if (CORBA::tk_struct == _kind)
521
+ _tc = adapter->create_struct_tc (RSTRING_PTR (rid),
522
+ RSTRING_PTR (rname),
523
+ members);
524
+ else
525
+ _tc = adapter->create_exception_tc (RSTRING_PTR (rid),
526
+ RSTRING_PTR (rname),
527
+ members);
528
+ }
529
+ break;
530
+
531
+ case CORBA::tk_enum:
532
+ {
533
+ VALUE rid = rb_ary_shift (args);
534
+ VALUE rname = rb_ary_shift (args);
535
+ CHECK_RTYPE(rid, T_STRING);
536
+ CHECK_RTYPE(rname, T_STRING);
537
+ VALUE rmembers = rb_ary_shift (args);
538
+ CHECK_RTYPE(rmembers, T_ARRAY);
539
+ CORBA::ULong count = static_cast<unsigned long> (RARRAY_LEN (rmembers));
540
+ CORBA::EnumMemberSeq members (count);
541
+ members.length (count);
542
+ for (unsigned long m=0; m<count ;++m)
543
+ {
544
+ VALUE el = rb_ary_entry (rmembers, m);
545
+ CHECK_RTYPE(el, T_STRING);
546
+ members[m] = CORBA::string_dup (RSTRING_PTR (el));
547
+ }
548
+ _tc = adapter->create_enum_tc (RSTRING_PTR (rid),
549
+ RSTRING_PTR (rname),
550
+ members);
551
+ }
552
+ break;
553
+
554
+ case CORBA::tk_union:
555
+ {
556
+ static ID _eq_id = rb_intern ("==");
557
+
558
+ VALUE rid = rb_ary_shift (args);
559
+ VALUE rname = rb_ary_shift (args);
560
+ CHECK_RTYPE(rid, T_STRING);
561
+ CHECK_RTYPE(rname, T_STRING);
562
+ VALUE rswtc = rb_ary_shift (args);
563
+ CORBA::TypeCode_ptr swtc = r2tao_TypeCode_r2t (rswtc);
564
+ VALUE rmembers = rb_ary_shift (args);
565
+ CHECK_RTYPE(rmembers, T_ARRAY);
566
+ CORBA::ULong count = static_cast<unsigned long> (RARRAY_LEN (rmembers));
567
+ CORBA::UnionMemberSeq members (count);
568
+ members.length (count);
569
+ for (unsigned long m=0; m<count ;++m)
570
+ {
571
+ VALUE mset = rb_ary_entry (rmembers, m);
572
+ CHECK_RTYPE(mset, T_ARRAY);
573
+ VALUE mlabel = rb_ary_shift (mset);
574
+ VALUE mname = rb_ary_shift (mset);
575
+ CHECK_RTYPE(mname, T_STRING);
576
+ VALUE rmtc = rb_ary_shift (mset);
577
+ CORBA::TypeCode_ptr mtc = r2tao_TypeCode_r2t (rmtc);
578
+ if (Qtrue == rb_funcall (mlabel, _eq_id, 1, r2tao_sym_default))
579
+ {
580
+ CORBA::Octet defval = 0;
581
+ members[m].label <<= CORBA::Any::from_octet(defval);
582
+ }
583
+ else
584
+ {
585
+ r2tao_Ruby2Any(members[m].label, swtc, mlabel);
586
+ }
587
+ members[m].name = CORBA::string_dup (RSTRING_PTR (mname));
588
+ members[m].type = CORBA::TypeCode::_duplicate (mtc);
589
+ }
590
+ _tc = adapter->create_union_tc (RSTRING_PTR (rid),
591
+ RSTRING_PTR (rname),
592
+ swtc,
593
+ members);
594
+ }
595
+ break;
596
+
597
+ default:
598
+ {
599
+ return Qnil;
600
+ }
601
+ }
602
+ }
603
+ R2TAO_CATCH;
604
+
605
+ return r2tao_TypeCode_t2r (_tc);
606
+ }
607
+
608
+ /*
609
+ * Instance methods
610
+ */
611
+ VALUE r2tao_TypeCode_kind(VALUE self)
612
+ {
613
+ VALUE ret = Qnil;
614
+ CORBA::TypeCode_ptr tc = r2tao_TypeCode_r2t (self);
615
+
616
+ R2TAO_TRY
617
+ {
618
+ ret = INT2NUM ((int)tc->kind ());
619
+ }
620
+ R2TAO_CATCH;
621
+
622
+ return ret;
623
+ }
624
+
625
+ VALUE r2tao_TypeCode_compact_typecode(VALUE self)
626
+ {
627
+ VALUE ret = Qnil;
628
+ CORBA::TypeCode_ptr tc = r2tao_TypeCode_r2t (self);
629
+
630
+ R2TAO_TRY
631
+ {
632
+ ret = r2tao_TypeCode_t2r (tc->get_compact_typecode ());
633
+ }
634
+ R2TAO_CATCH;
635
+
636
+ return ret;
637
+ }
638
+
639
+ VALUE r2tao_TypeCode_equal(VALUE self, VALUE rtc)
640
+ {
641
+ VALUE ret = Qnil;
642
+ CORBA::TypeCode_ptr tc = r2tao_TypeCode_r2t (self);
643
+ CORBA::TypeCode_ptr other_tc = r2tao_TypeCode_r2t (rtc);
644
+
645
+ R2TAO_TRY
646
+ {
647
+ ret = tc->equal (other_tc) ? Qtrue : Qfalse;
648
+ }
649
+ R2TAO_CATCH;
650
+
651
+ return ret;
652
+ }
653
+
654
+ VALUE r2tao_TypeCode_equivalent(VALUE self, VALUE rtc)
655
+ {
656
+ VALUE ret = Qnil;
657
+ CORBA::TypeCode_ptr tc = r2tao_TypeCode_r2t (self);
658
+ CORBA::TypeCode_ptr other_tc = r2tao_TypeCode_r2t (rtc);
659
+
660
+ R2TAO_TRY
661
+ {
662
+ ret = tc->equivalent (other_tc) ? Qtrue : Qfalse;
663
+ }
664
+ R2TAO_CATCH;
665
+
666
+ return ret;
667
+ }
668
+
669
+ VALUE r2tao_TypeCode_id(VALUE self)
670
+ {
671
+ VALUE ret = Qnil;
672
+ CORBA::TypeCode_ptr tc = r2tao_TypeCode_r2t (self);
673
+
674
+ R2TAO_TRY
675
+ {
676
+ ret = rb_str_new2 (tc->id ());
677
+ }
678
+ R2TAO_CATCH;
679
+
680
+ return ret;
681
+ }
682
+
683
+ VALUE r2tao_TypeCode_name(VALUE self)
684
+ {
685
+ VALUE ret = Qnil;
686
+ CORBA::TypeCode_ptr tc = r2tao_TypeCode_r2t (self);
687
+
688
+ R2TAO_TRY
689
+ {
690
+ ret = rb_str_new2 (tc->name ());
691
+ }
692
+ R2TAO_CATCH;
693
+
694
+ return ret;
695
+ }
696
+
697
+ VALUE r2tao_TypeCode_member_count(VALUE self)
698
+ {
699
+ VALUE ret = Qnil;
700
+ CORBA::TypeCode_ptr tc = r2tao_TypeCode_r2t (self);
701
+
702
+ R2TAO_TRY
703
+ {
704
+ ret = ULONG2NUM (tc->member_count ());
705
+ }
706
+ R2TAO_CATCH;
707
+
708
+ return ret;
709
+ }
710
+
711
+ VALUE r2tao_TypeCode_member_name(VALUE self, VALUE index)
712
+ {
713
+ VALUE ret = Qnil;
714
+ CORBA::TypeCode_ptr tc = r2tao_TypeCode_r2t (self);
715
+
716
+ R2TAO_TRY
717
+ {
718
+ CHECK_RTYPE (index, T_FIXNUM);
719
+ ret = rb_str_new2 (tc->member_name (NUM2ULONG (index)));
720
+ }
721
+ R2TAO_CATCH;
722
+
723
+ return ret;
724
+ }
725
+
726
+ VALUE r2tao_TypeCode_member_type(VALUE self, VALUE index)
727
+ {
728
+ VALUE ret = Qnil;
729
+ CORBA::TypeCode_ptr tc = r2tao_TypeCode_r2t (self);
730
+
731
+ R2TAO_TRY
732
+ {
733
+ CHECK_RTYPE (index, T_FIXNUM);
734
+ CORBA::TypeCode_var mtc = tc->member_type (NUM2ULONG (index));
735
+ ret = r2tao_TypeCode_t2r (mtc.in ());
736
+ }
737
+ R2TAO_CATCH;
738
+
739
+ return ret;
740
+ }
741
+
742
+ VALUE r2tao_TypeCode_member_label(VALUE self, VALUE index)
743
+ {
744
+ VALUE ret = Qnil;
745
+ CORBA::TypeCode_ptr tc = r2tao_TypeCode_r2t (self);
746
+
747
+ R2TAO_TRY
748
+ {
749
+ CHECK_RTYPE (index, T_FIXNUM);
750
+ CORBA::Any* ml = tc->member_label (NUM2ULONG (index));
751
+ CORBA::TypeCode_var mt = tc->member_type (NUM2ULONG (index));
752
+ VALUE rtc = r2corba_TypeCode_t2r (mt.in ());
753
+ ret = r2tao_Any2Ruby (*ml, mt.in (), rtc, rtc);
754
+ }
755
+ R2TAO_CATCH;
756
+
757
+ return ret;
758
+ }
759
+
760
+ VALUE r2tao_TypeCode_member_visibility(VALUE self, VALUE index)
761
+ {
762
+ VALUE ret = Qnil;
763
+ CORBA::TypeCode_ptr tc = r2tao_TypeCode_r2t (self);
764
+
765
+ R2TAO_TRY
766
+ {
767
+ CHECK_RTYPE (index, T_FIXNUM);
768
+ ret = INT2NUM ((int)tc->member_visibility (NUM2ULONG (index)));
769
+ }
770
+ R2TAO_CATCH;
771
+
772
+ return ret;
773
+ }
774
+
775
+ VALUE r2tao_TypeCode_discriminator_type(VALUE self)
776
+ {
777
+ VALUE ret = Qnil;
778
+ CORBA::TypeCode_ptr tc = r2tao_TypeCode_r2t (self);
779
+
780
+ R2TAO_TRY
781
+ {
782
+ CORBA::TypeCode_var dtc = tc->discriminator_type ();
783
+ ret = r2tao_TypeCode_t2r (dtc.in ());
784
+ }
785
+ R2TAO_CATCH;
786
+
787
+ return ret;
788
+ }
789
+
790
+ VALUE r2tao_TypeCode_default_index(VALUE self)
791
+ {
792
+ VALUE ret = Qnil;
793
+ CORBA::TypeCode_ptr tc = r2tao_TypeCode_r2t (self);
794
+
795
+ R2TAO_TRY
796
+ {
797
+ ret = LONG2NUM (tc->default_index ());
798
+ }
799
+ R2TAO_CATCH;
800
+
801
+ return ret;
802
+ }
803
+
804
+ VALUE r2tao_TypeCode_length(VALUE self)
805
+ {
806
+ VALUE ret = Qnil;
807
+ CORBA::TypeCode_ptr tc = r2tao_TypeCode_r2t (self);
808
+
809
+ R2TAO_TRY
810
+ {
811
+ ret = ULONG2NUM (tc->length ());
812
+ }
813
+ R2TAO_CATCH;
814
+
815
+ return ret;
816
+ }
817
+
818
+ VALUE r2tao_TypeCode_content_type(VALUE self)
819
+ {
820
+ VALUE ret = Qnil;
821
+ CORBA::TypeCode_ptr tc = r2tao_TypeCode_r2t (self);
822
+
823
+ R2TAO_TRY
824
+ {
825
+ CORBA::TypeCode_var ctc = tc->content_type ();
826
+ ret = r2tao_TypeCode_t2r (ctc.in ());
827
+ }
828
+ R2TAO_CATCH;
829
+
830
+ return ret;
831
+ }
832
+
833
+ VALUE r2tao_TypeCode_fixed_digits(VALUE self)
834
+ {
835
+ VALUE ret = Qnil;
836
+ CORBA::TypeCode_ptr tc = r2tao_TypeCode_r2t (self);
837
+
838
+ R2TAO_TRY
839
+ {
840
+ ret = UINT2NUM (tc->fixed_digits ());
841
+ }
842
+ R2TAO_CATCH;
843
+
844
+ return ret;
845
+ }
846
+
847
+ VALUE r2tao_TypeCode_fixed_scale(VALUE self)
848
+ {
849
+ VALUE ret = Qnil;
850
+ CORBA::TypeCode_ptr tc = r2tao_TypeCode_r2t (self);
851
+
852
+ R2TAO_TRY
853
+ {
854
+ ret = UINT2NUM (tc->fixed_scale ());
855
+ }
856
+ R2TAO_CATCH;
857
+
858
+ return ret;
859
+ }
860
+
861
+ VALUE r2tao_TypeCode_type_modifier(VALUE self)
862
+ {
863
+ VALUE ret = Qnil;
864
+ CORBA::TypeCode_ptr tc = r2tao_TypeCode_r2t (self);
865
+
866
+ R2TAO_TRY
867
+ {
868
+ ret = INT2NUM (tc->type_modifier ());
869
+ }
870
+ R2TAO_CATCH;
871
+
872
+ return ret;
873
+ }
874
+
875
+ VALUE r2tao_TypeCode_concrete_basetype(VALUE self)
876
+ {
877
+ VALUE ret = Qnil;
878
+ CORBA::TypeCode_ptr tc = r2tao_TypeCode_r2t (self);
879
+
880
+ R2TAO_TRY
881
+ {
882
+ CORBA::TypeCode_var ctc = tc->concrete_base_type ();
883
+ ret = r2tao_TypeCode_t2r (ctc.in ());
884
+ }
885
+ R2TAO_CATCH;
886
+
887
+ return ret;
888
+ }