r2corba 1.6.1-x64-mingw-ucrt

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (237) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGES +173 -0
  3. data/LICENSE +59 -0
  4. data/README.rdoc +62 -0
  5. data/THANKS +54 -0
  6. data/bin/r2corba +8 -0
  7. data/bin/r2corba.bat +20 -0
  8. data/bin/ridlc +11 -0
  9. data/bin/ridlc.bat +23 -0
  10. data/bin/rins +7 -0
  11. data/bin/rins.bat +19 -0
  12. data/ext/.keep +0 -0
  13. data/lib/corba/cbase/IORMap.rb +32 -0
  14. data/lib/corba/cbase/ORB.rb +239 -0
  15. data/lib/corba/cbase/Request.rb +133 -0
  16. data/lib/corba/cbase/Streams.rb +128 -0
  17. data/lib/corba/cbase/Stub.rb +18 -0
  18. data/lib/corba/cbase/Typecode.rb +440 -0
  19. data/lib/corba/cbase/Values.rb +130 -0
  20. data/lib/corba/cbase/exception.rb +67 -0
  21. data/lib/corba/cbase/poa.rb +22 -0
  22. data/lib/corba/cbase/policies.rb +77 -0
  23. data/lib/corba/cbase/post_require.rb +13 -0
  24. data/lib/corba/cbase/require.rb +36 -0
  25. data/lib/corba/cmds/base.rb +84 -0
  26. data/lib/corba/cmds/test.rb +29 -0
  27. data/lib/corba/common/Any.rb +91 -0
  28. data/lib/corba/common/IDL.rb +100 -0
  29. data/lib/corba/common/ORB.rb +367 -0
  30. data/lib/corba/common/Object.rb +211 -0
  31. data/lib/corba/common/Request.rb +19 -0
  32. data/lib/corba/common/Servant.rb +107 -0
  33. data/lib/corba/common/Struct.rb +21 -0
  34. data/lib/corba/common/Stub.rb +78 -0
  35. data/lib/corba/common/Typecode.rb +1147 -0
  36. data/lib/corba/common/Union.rb +60 -0
  37. data/lib/corba/common/Values.rb +92 -0
  38. data/lib/corba/common/const.rb +21 -0
  39. data/lib/corba/common/exception.rb +68 -0
  40. data/lib/corba/common/require.rb +34 -0
  41. data/lib/corba/common/version.rb +21 -0
  42. data/lib/corba/idl/BiDirPolicyC.rb +62 -0
  43. data/lib/corba/idl/CosNamingC.rb +460 -0
  44. data/lib/corba/idl/CosNamingS.rb +308 -0
  45. data/lib/corba/idl/IDL.rb +20 -0
  46. data/lib/corba/idl/IORTable.pidl +61 -0
  47. data/lib/corba/idl/IORTableC.rb +116 -0
  48. data/lib/corba/idl/MessagingC.rb +903 -0
  49. data/lib/corba/idl/POAC.rb +929 -0
  50. data/lib/corba/idl/TAO_Ext.pidl +45 -0
  51. data/lib/corba/idl/TAO_ExtC.rb +178 -0
  52. data/lib/corba/idl/r2c_orb.rb +571 -0
  53. data/lib/corba/idl/require.rb +19 -0
  54. data/lib/corba/jbase/Any.rb +274 -0
  55. data/lib/corba/jbase/IORMap.rb +35 -0
  56. data/lib/corba/jbase/ORB.rb +111 -0
  57. data/lib/corba/jbase/Object.rb +98 -0
  58. data/lib/corba/jbase/Request.rb +225 -0
  59. data/lib/corba/jbase/Servant.rb +247 -0
  60. data/lib/corba/jbase/ServerRequest.rb +127 -0
  61. data/lib/corba/jbase/Streams.rb +734 -0
  62. data/lib/corba/jbase/Stub.rb +37 -0
  63. data/lib/corba/jbase/Typecode.rb +520 -0
  64. data/lib/corba/jbase/Values.rb +174 -0
  65. data/lib/corba/jbase/exception.rb +106 -0
  66. data/lib/corba/jbase/poa.rb +228 -0
  67. data/lib/corba/jbase/policies.rb +299 -0
  68. data/lib/corba/jbase/post_require.rb +13 -0
  69. data/lib/corba/jbase/require.rb +92 -0
  70. data/lib/corba/naming.rb +13 -0
  71. data/lib/corba/naming_service.rb +14 -0
  72. data/lib/corba/poa.rb +14 -0
  73. data/lib/corba/policies.rb +17 -0
  74. data/lib/corba/require.rb +16 -0
  75. data/lib/corba/svcs/ins/cos_naming.rb +432 -0
  76. data/lib/corba/svcs/ins/ins.rb +525 -0
  77. data/lib/corba/svcs/ins/naming_service.rb +118 -0
  78. data/lib/corba.rb +15 -0
  79. data/lib/ridlbe/ruby/config.rb +340 -0
  80. data/lib/ridlbe/ruby/orb.pidlc +0 -0
  81. data/lib/ridlbe/ruby/require.rb +15 -0
  82. data/lib/ridlbe/ruby/walker.rb +1605 -0
  83. data/mkrf_conf_bingem.rb +149 -0
  84. data/rakelib/bin.rake +79 -0
  85. data/rakelib/bin.rb +145 -0
  86. data/rakelib/build.rake +87 -0
  87. data/rakelib/config.rake +51 -0
  88. data/rakelib/config.rb +542 -0
  89. data/rakelib/ext.rake +183 -0
  90. data/rakelib/ext.rb +277 -0
  91. data/rakelib/ext_r2tao.rb +208 -0
  92. data/rakelib/gem.rake +251 -0
  93. data/rakelib/gem.rb +145 -0
  94. data/rakelib/package.rake +25 -0
  95. data/rakelib/test.rake +22 -0
  96. data/test/BiDirectional/Test.idl +33 -0
  97. data/test/BiDirectional/client.rb +131 -0
  98. data/test/BiDirectional/run_test.rb +67 -0
  99. data/test/BiDirectional/server.rb +167 -0
  100. data/test/CORBA_Services/Naming/BindingIterator/Test.idl +26 -0
  101. data/test/CORBA_Services/Naming/BindingIterator/client.rb +120 -0
  102. data/test/CORBA_Services/Naming/BindingIterator/run_test.rb +81 -0
  103. data/test/CORBA_Services/Naming/BindingIterator/server.rb +108 -0
  104. data/test/CORBA_Services/Naming/Corbaname/Test.idl +26 -0
  105. data/test/CORBA_Services/Naming/Corbaname/client.rb +84 -0
  106. data/test/CORBA_Services/Naming/Corbaname/run_test.rb +87 -0
  107. data/test/CORBA_Services/Naming/Corbaname/server.rb +134 -0
  108. data/test/CORBA_Services/Naming/Simple/Test.idl +26 -0
  109. data/test/CORBA_Services/Naming/Simple/client.rb +83 -0
  110. data/test/CORBA_Services/Naming/Simple/run_test.rb +81 -0
  111. data/test/CORBA_Services/Naming/Simple/server.rb +108 -0
  112. data/test/Collocation/Diamond.idl +38 -0
  113. data/test/Collocation/run_test.rb +51 -0
  114. data/test/Collocation/test.rb +201 -0
  115. data/test/Connect_Timeout/Test.idl +26 -0
  116. data/test/Connect_Timeout/client.rb +109 -0
  117. data/test/Connect_Timeout/run_test.rb +51 -0
  118. data/test/DII/Test.idl +26 -0
  119. data/test/DII/client.rb +114 -0
  120. data/test/DII/run_test.rb +68 -0
  121. data/test/DII/server.rb +94 -0
  122. data/test/DSI/Test.idl +26 -0
  123. data/test/DSI/client.rb +65 -0
  124. data/test/DSI/run_test.rb +68 -0
  125. data/test/DSI/server.rb +105 -0
  126. data/test/Exceptions/Test.idl +47 -0
  127. data/test/Exceptions/client.rb +117 -0
  128. data/test/Exceptions/run_test.rb +68 -0
  129. data/test/Exceptions/server.rb +130 -0
  130. data/test/Hello/Test.idl +26 -0
  131. data/test/Hello/client.rb +77 -0
  132. data/test/Hello/run_test.rb +70 -0
  133. data/test/Hello/server.rb +94 -0
  134. data/test/IDL_Test/Test.idl +116 -0
  135. data/test/IDL_Test/Test_inc.idl +17 -0
  136. data/test/IDL_Test/client.rb +103 -0
  137. data/test/IDL_Test/run_test.rb +68 -0
  138. data/test/IDL_Test/server.rb +103 -0
  139. data/test/IORMap/Test.idl +26 -0
  140. data/test/IORMap/client.rb +72 -0
  141. data/test/IORMap/run_test.rb +68 -0
  142. data/test/IORMap/server.rb +113 -0
  143. data/test/IORTable/Test.idl +26 -0
  144. data/test/IORTable/client.rb +74 -0
  145. data/test/IORTable/run_test.rb +68 -0
  146. data/test/IORTable/server.rb +129 -0
  147. data/test/Implicit_Conversion/Test.idl +30 -0
  148. data/test/Implicit_Conversion/client.rb +112 -0
  149. data/test/Implicit_Conversion/run_test.rb +68 -0
  150. data/test/Implicit_Conversion/server.rb +98 -0
  151. data/test/Multi_Threading/Multiple_ORB/Test.idl +26 -0
  152. data/test/Multi_Threading/Multiple_ORB/client.rb +81 -0
  153. data/test/Multi_Threading/Multiple_ORB/run_test.rb +70 -0
  154. data/test/Multi_Threading/Multiple_ORB/server.rb +107 -0
  155. data/test/Multi_Threading/Simple/Test.idl +26 -0
  156. data/test/Multi_Threading/Simple/client.rb +92 -0
  157. data/test/Multi_Threading/Simple/run_test.rb +68 -0
  158. data/test/Multi_Threading/Simple/server.rb +117 -0
  159. data/test/Multi_Threading/Threads/Test.idl +27 -0
  160. data/test/Multi_Threading/Threads/client.rb +77 -0
  161. data/test/Multi_Threading/Threads/run_test.rb +75 -0
  162. data/test/Multi_Threading/Threads/server.rb +116 -0
  163. data/test/Multi_Threading/Threads/watchdog.rb +87 -0
  164. data/test/Multiple_Servant_Interfaces/Test.idl +33 -0
  165. data/test/Multiple_Servant_Interfaces/client.rb +69 -0
  166. data/test/Multiple_Servant_Interfaces/run_test.rb +68 -0
  167. data/test/Multiple_Servant_Interfaces/server.rb +101 -0
  168. data/test/Nil/Test.idl +26 -0
  169. data/test/Nil/run_test.rb +51 -0
  170. data/test/Nil/test.rb +80 -0
  171. data/test/OBV/AbstractInterface/client.rb +178 -0
  172. data/test/OBV/AbstractInterface/run_test.rb +68 -0
  173. data/test/OBV/AbstractInterface/server.rb +149 -0
  174. data/test/OBV/AbstractInterface/test.idl +52 -0
  175. data/test/OBV/Custom/OBV.idl +18 -0
  176. data/test/OBV/Custom/OBV_impl.rb +41 -0
  177. data/test/OBV/Custom/client.rb +85 -0
  178. data/test/OBV/Custom/run_test.rb +68 -0
  179. data/test/OBV/Custom/server.rb +99 -0
  180. data/test/OBV/Simple/OBV.idl +15 -0
  181. data/test/OBV/Simple/OBV_impl.rb +26 -0
  182. data/test/OBV/Simple/client.rb +85 -0
  183. data/test/OBV/Simple/run_test.rb +68 -0
  184. data/test/OBV/Simple/server.rb +99 -0
  185. data/test/OBV/Simple_Event/Event.idl +15 -0
  186. data/test/OBV/Simple_Event/Event_impl.rb +26 -0
  187. data/test/OBV/Simple_Event/client.rb +85 -0
  188. data/test/OBV/Simple_Event/run_test.rb +68 -0
  189. data/test/OBV/Simple_Event/server.rb +99 -0
  190. data/test/OBV/Supports/client.rb +115 -0
  191. data/test/OBV/Supports/run_test.rb +68 -0
  192. data/test/OBV/Supports/server.rb +102 -0
  193. data/test/OBV/Supports/supports.idl +32 -0
  194. data/test/OBV/Supports/supports_impl.rb +59 -0
  195. data/test/OBV/Tree/client.rb +115 -0
  196. data/test/OBV/Tree/run_test.rb +68 -0
  197. data/test/OBV/Tree/server.rb +116 -0
  198. data/test/OBV/Tree/test.idl +31 -0
  199. data/test/OBV/Truncatable/Extra.idl +26 -0
  200. data/test/OBV/Truncatable/Truncatable.idl +105 -0
  201. data/test/OBV/Truncatable/Truncatable_impl.rb +85 -0
  202. data/test/OBV/Truncatable/client.rb +278 -0
  203. data/test/OBV/Truncatable/run_test.rb +68 -0
  204. data/test/OBV/Truncatable/server.rb +88 -0
  205. data/test/OBV/ValueBox/client.rb +497 -0
  206. data/test/OBV/ValueBox/run_test.rb +68 -0
  207. data/test/OBV/ValueBox/server.rb +271 -0
  208. data/test/OBV/ValueBox/valuebox.idl +101 -0
  209. data/test/OBV/ValueBox/vb_basic.idl +75 -0
  210. data/test/OBV/ValueBox/vb_struct.idl +68 -0
  211. data/test/OBV/ValueBox/vb_union.idl +21 -0
  212. data/test/Object/Test.idl +26 -0
  213. data/test/Object/client.rb +111 -0
  214. data/test/Object/run_test.rb +68 -0
  215. data/test/Object/server.rb +125 -0
  216. data/test/POA/Test.idl +27 -0
  217. data/test/POA/run_test.rb +51 -0
  218. data/test/POA/test.rb +111 -0
  219. data/test/Param_Test/Test.idl +182 -0
  220. data/test/Param_Test/client.rb +276 -0
  221. data/test/Param_Test/run_test.rb +68 -0
  222. data/test/Param_Test/server.rb +295 -0
  223. data/test/Performance/Simple/Test.idl +26 -0
  224. data/test/Performance/Simple/client.rb +89 -0
  225. data/test/Performance/Simple/run_test.rb +68 -0
  226. data/test/Performance/Simple/server.rb +94 -0
  227. data/test/Policies/Test.idl +26 -0
  228. data/test/Policies/run_test.rb +51 -0
  229. data/test/Policies/test.rb +142 -0
  230. data/test/Timeout/client.rb +206 -0
  231. data/test/Timeout/run_test.rb +68 -0
  232. data/test/Timeout/server.rb +108 -0
  233. data/test/Timeout/test.idl +18 -0
  234. data/test/lib/assert.rb +41 -0
  235. data/test/lib/test.rb +546 -0
  236. data/test/test_runner.rb +191 -0
  237. metadata +318 -0
@@ -0,0 +1,734 @@
1
+ #--------------------------------------------------------------------
2
+ # Streams.rb - Java/JacORB Definition of CORBA CDR Streams
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
+ #--------------------------------------------------------------------
12
+
13
+ module R2CORBA
14
+ module CORBA
15
+ module Portable
16
+ module InputStream
17
+ @@wrapper_klass = Class.new do
18
+ include CORBA::Portable::InputStream
19
+ def initialize(jobj)
20
+ @stream_ = jobj
21
+ end
22
+ attr_reader :stream_
23
+ end
24
+
25
+ def self._wrap_native(jobj)
26
+ if jobj.nil? || !jobj.is_a?(Native::V2_3::Portable::InputStream)
27
+ raise ArgumentError, 'Expected org.omg.CORBA.portable.InputStream'
28
+ end
29
+ @@wrapper_klass.new(jobj)
30
+ end
31
+
32
+ def read_member(tc)
33
+ tc = tc.resolved_tc # takes care of recursive typecodes
34
+ v = case tc.kind
35
+ when TK_ANY
36
+ read_any()
37
+ when TK_BOOLEAN
38
+ read_boolean()
39
+ when TK_SHORT
40
+ read_short()
41
+ when TK_LONG
42
+ read_long()
43
+ when TK_USHORT
44
+ read_ushort()
45
+ when TK_WCHAR
46
+ read_wchar()
47
+ when TK_ULONG
48
+ read_ulong()
49
+ when TK_LONGLONG
50
+ read_longlong()
51
+ when TK_ULONGLONG
52
+ read_ulonglong()
53
+ when TK_OCTET
54
+ read_octet()
55
+ when TK_FLOAT
56
+ read_float()
57
+ when TK_DOUBLE
58
+ read_double()
59
+ when TK_LONGDOUBLE
60
+ raise CORBA::NO_IMPLEMENT.new('LongDouble not supported', 0, CORBA::COMPLETED_NO)
61
+ when TK_FIXED
62
+ read_fixed()
63
+ when TK_CHAR
64
+ read_char()
65
+ when TK_STRING
66
+ read_string()
67
+ when TK_WSTRING
68
+ read_wstring()
69
+ when TK_OBJREF
70
+ read_Object()
71
+ when TK_TYPECODE
72
+ read_TypeCode()
73
+ when TK_ARRAY, TK_SEQUENCE,
74
+ TK_ENUM, TK_STRUCT, TK_EXCEPT, TK_UNION,
75
+ TK_PRINCIPAL
76
+ read_construct(tc)
77
+ when TK_ABSTRACT_INTERFACE
78
+ read_Abstract()
79
+ when TK_VALUE
80
+ read_value()
81
+ when TK_VALUE_BOX
82
+ read_valuebox(tc.get_type.boxedvalue_helper)
83
+ ## TODO: TK_NATIVE
84
+ end
85
+ v
86
+ end
87
+
88
+ def read_any()
89
+ begin
90
+ self.stream_.read_any()
91
+ rescue ::NativeException
92
+ CORBA::Exception.native2r($!)
93
+ end
94
+ end
95
+
96
+ def read_boolean()
97
+ begin
98
+ self.stream_.read_boolean()
99
+ rescue ::NativeException
100
+ CORBA::Exception.native2r($!)
101
+ end
102
+ end
103
+
104
+ def read_boolean_array(arr, offset, length)
105
+ jarr = Array.new(arr.size).to_java(:boolean)
106
+ begin
107
+ self.stream_.read_boolean_array(jarr, offset, length)
108
+ rescue ::NativeException
109
+ CORBA::Exception.native2r($!)
110
+ end
111
+ arr.fill(offset, length) {|i| jarr[i]}
112
+ end
113
+
114
+ def read_char()
115
+ begin
116
+ self.stream_.read_char().chr
117
+ rescue ::NativeException
118
+ CORBA::Exception.native2r($!)
119
+ end
120
+ end
121
+
122
+ def read_char_array(arr, offset, length)
123
+ jarr = Array.new(arr.size).to_java(:char)
124
+ begin
125
+ self.stream_.read_char_array(jarr, offset, length)
126
+ rescue ::NativeException
127
+ CORBA::Exception.native2r($!)
128
+ end
129
+ arr.fill(offset, length) {|i| jarr[i].chr }
130
+ end
131
+
132
+ def read_wchar()
133
+ begin
134
+ self.stream_.read_wchar()
135
+ rescue ::NativeException
136
+ CORBA::Exception.native2r($!)
137
+ end
138
+ end
139
+
140
+ def read_wchar_array(arr, offset, length)
141
+ jarr = Array.new(arr.size).to_java(:char)
142
+ begin
143
+ self.stream_.read_char_array(jarr, offset, length)
144
+ rescue ::NativeException
145
+ CORBA::Exception.native2r($!)
146
+ end
147
+ arr.fill(offset, length) {|i| jarr[i] }
148
+ end
149
+
150
+ def read_octet(value)
151
+ begin
152
+ [self.stream_.read_octet()].pack('c').unpack('C').first
153
+ rescue ::NativeException
154
+ CORBA::Exception.native2r($!)
155
+ end
156
+ end
157
+
158
+ def read_octet_array(arr, offset, length)
159
+ jarr = Array.new(arr.size).to_java(:byte)
160
+ begin
161
+ self.stream_.read_octet_array(jarr, offset, length)
162
+ rescue ::NativeException
163
+ CORBA::Exception.native2r($!)
164
+ end
165
+ jarr = jarr.pack('c*').unpack('C*')
166
+ arr.fill(offset, length) {|i| jarr[i] }
167
+ end
168
+
169
+ def read_short()
170
+ begin
171
+ self.stream_.read_short()
172
+ rescue ::NativeException
173
+ CORBA::Exception.native2r($!)
174
+ end
175
+ end
176
+
177
+ def read_short_array(arr, offset, length)
178
+ jarr = Array.new(arr.size).to_java(:short)
179
+ begin
180
+ self.stream_.read_short_array(jarr, offset, length)
181
+ rescue ::NativeException
182
+ CORBA::Exception.native2r($!)
183
+ end
184
+ arr.fill(offset, length) {|i| jarr[i] }
185
+ end
186
+
187
+ def read_ushort()
188
+ begin
189
+ [self.stream_.read_ushort()].pack('s').unpack('S').first
190
+ rescue ::NativeException
191
+ CORBA::Exception.native2r($!)
192
+ end
193
+ end
194
+
195
+ def read_ushort_array(arr, offset, length)
196
+ jarr = Array.new(arr.size).to_java(:short)
197
+ begin
198
+ self.stream_.read_octet_array(jarr, offset, length)
199
+ rescue ::NativeException
200
+ CORBA::Exception.native2r($!)
201
+ end
202
+ jarr = jarr.pack('s*').unpack('S*')
203
+ arr.fill(offset, length) {|i| jarr[i] }
204
+ end
205
+
206
+ def read_long()
207
+ begin
208
+ self.stream_.read_long()
209
+ rescue ::NativeException
210
+ CORBA::Exception.native2r($!)
211
+ end
212
+ end
213
+
214
+ def read_long_array(arr, offset, length)
215
+ jarr = Array.new(arr.size).to_java(:int)
216
+ begin
217
+ self.stream_.read_long_array(jarr, offset, length)
218
+ rescue ::NativeException
219
+ CORBA::Exception.native2r($!)
220
+ end
221
+ arr.fill(offset, length) {|i| jarr[i] }
222
+ end
223
+
224
+ def read_ulong()
225
+ begin
226
+ [self.stream_.read_ulong()].pack('l').unpack('L').first
227
+ rescue ::NativeException
228
+ CORBA::Exception.native2r($!)
229
+ end
230
+ end
231
+
232
+ def read_ulong_array(arr, offset, length)
233
+ jarr = Array.new(arr.size).to_java(:int)
234
+ begin
235
+ self.stream_.read_ulong_array(jarr, offset, length)
236
+ rescue ::NativeException
237
+ CORBA::Exception.native2r($!)
238
+ end
239
+ jarr = jarr.pack('l*').unpack('L*')
240
+ arr.fill(offset, length) {|i| jarr[i] }
241
+ end
242
+
243
+ def read_longlong()
244
+ begin
245
+ self.stream_.read_longlong()
246
+ rescue ::NativeException
247
+ CORBA::Exception.native2r($!)
248
+ end
249
+ end
250
+
251
+ def read_longlong_array(arr, offset, length)
252
+ jarr = Array.new(arr.size).to_java(:long)
253
+ begin
254
+ self.stream_.read_longlong_array(jarr, offset, length)
255
+ rescue ::NativeException
256
+ CORBA::Exception.native2r($!)
257
+ end
258
+ arr.fill(offset, length) {|i| jarr[i] }
259
+ end
260
+
261
+ def read_ulonglong()
262
+ begin
263
+ [self.stream_.read_ulonglong()].pack('q').unpack('Q').first
264
+ rescue ::NativeException
265
+ CORBA::Exception.native2r($!)
266
+ end
267
+ end
268
+
269
+ def read_ulonglong_array(arr, offset, length)
270
+ jarr = Array.new(arr.size).to_java(:long)
271
+ begin
272
+ self.stream_.read_ulonglong_array(jarr, offset, length)
273
+ rescue ::NativeException
274
+ CORBA::Exception.native2r($!)
275
+ end
276
+ jarr = jarr.pack('q*').unpack('Q*')
277
+ arr.fill(offset, length) {|i| jarr[i] }
278
+ end
279
+
280
+ def read_float()
281
+ begin
282
+ self.stream_.read_float()
283
+ rescue ::NativeException
284
+ CORBA::Exception.native2r($!)
285
+ end
286
+ end
287
+
288
+ def read_float_array(arr, offset, length)
289
+ jarr = Array.new(arr.size).to_java(:float)
290
+ begin
291
+ self.stream_.read_float_array(jarr, offset, length)
292
+ rescue ::NativeException
293
+ CORBA::Exception.native2r($!)
294
+ end
295
+ arr.fill(offset, length) {|i| jarr[i] }
296
+ end
297
+
298
+ def read_double()
299
+ begin
300
+ self.stream_.read_double()
301
+ rescue ::NativeException
302
+ CORBA::Exception.native2r($!)
303
+ end
304
+ end
305
+
306
+ def read_double_array(arr, offset, length)
307
+ jarr = Array.new(arr.size).to_java(:double)
308
+ begin
309
+ self.stream_.read_double_array(jarr, offset, length)
310
+ rescue ::NativeException
311
+ CORBA::Exception.native2r($!)
312
+ end
313
+ arr.fill(offset, length) {|i| jarr[i] }
314
+ end
315
+
316
+ def read_string()
317
+ begin
318
+ self.stream_.read_string()
319
+ rescue ::NativeException
320
+ CORBA::Exception.native2r($!)
321
+ end
322
+ end
323
+
324
+ def read_wstring()
325
+ begin
326
+ self.stream_.read_wstring()
327
+ rescue ::NativeException
328
+ CORBA::Exception.native2r($!)
329
+ end
330
+ end
331
+
332
+ def read_Object()
333
+ begin
334
+ CORBA::Object._wrap_native(self.stream_().read_Object())
335
+ rescue ::NativeException
336
+ CORBA::Exception.native2r($!)
337
+ end
338
+ end
339
+
340
+ def read_TypeCode()
341
+ begin
342
+ CORBA::TypeCode._wrap_native(self.stream_().read_TypeCode())
343
+ rescue ::NativeException
344
+ CORBA::Exception.native2r($!)
345
+ end
346
+ end
347
+
348
+ def read_fixed()
349
+ begin
350
+ java.math.BigDecimal.new(self.stream_.read_fixed().toString())
351
+ rescue ::NativeException
352
+ CORBA::Exception.native2r($!)
353
+ end
354
+ end
355
+
356
+ def read_construct(tc)
357
+ begin
358
+ jany = self.stream_.orb().create_any()
359
+ jany.read_value(self.stream_, tc.tc_)
360
+ CORBA::Any.from_java(jany, self.stream_.orb(), tc)
361
+ rescue ::NativeException
362
+ CORBA::Exception.native2r($!)
363
+ end
364
+ end
365
+
366
+ def read_Abstract()
367
+ begin
368
+ obj = self.stream_.read_abstract_interface()
369
+ rescue ::NativeException
370
+ CORBA::Exception.native2r($!)
371
+ end
372
+ obj = CORBA::Object._wrap_native(obj) if obj.is_a?(CORBA::Native::Object)
373
+ obj
374
+ end
375
+
376
+ def read_value()
377
+ begin
378
+ self.stream_.read_value()
379
+ rescue ::NativeException
380
+ CORBA::Exception.native2r($!)
381
+ end
382
+ end
383
+ alias :read_Value :read_value
384
+ def read_valuebox(boxedvalue_helper)
385
+ begin
386
+ self.stream_.read_value(boxedvalue_helper)
387
+ rescue ::NativeException
388
+ CORBA::Exception.native2r($!)
389
+ end
390
+ end
391
+ end
392
+
393
+ module OutputStream
394
+ @@wrapper_klass = Class.new do
395
+ include CORBA::Portable::OutputStream
396
+ def initialize(jobj)
397
+ @stream_ = jobj
398
+ end
399
+ attr_reader :stream_
400
+ end
401
+
402
+ def self._wrap_native(jobj)
403
+ if jobj.nil? || !jobj.is_a?(Native::V2_3::Portable::OutputStream)
404
+ raise ArgumentError, 'Expected org.omg.CORBA.portable.OutputStream'
405
+ end
406
+ @@wrapper_klass.new(jobj)
407
+ end
408
+
409
+ def write_member(tc, value)
410
+ tc = tc.resolved_tc # takes care of recursive typecodes
411
+ case tc.kind
412
+ when TK_ANY
413
+ write_any(value)
414
+ when TK_BOOLEAN
415
+ write_boolean(value)
416
+ when TK_SHORT
417
+ write_short(value)
418
+ when TK_LONG
419
+ write_long(value)
420
+ when TK_USHORT
421
+ write_ushort(value)
422
+ when TK_WCHAR
423
+ write_wchar(value)
424
+ when TK_ULONG
425
+ write_ulong(value)
426
+ when TK_LONGLONG
427
+ write_longlong(value)
428
+ when TK_ULONGLONG
429
+ write_ulonglong(value)
430
+ when TK_OCTET
431
+ write_octet(value)
432
+ when TK_FLOAT
433
+ write_float(value)
434
+ when TK_DOUBLE
435
+ write_double(value)
436
+ when TK_LONGDOUBLE
437
+ raise CORBA::NO_IMPLEMENT.new('LongDouble not supported', 0, CORBA::COMPLETED_NO)
438
+ when TK_FIXED
439
+ write_fixed(value)
440
+ when TK_CHAR
441
+ write_char(value)
442
+ when TK_STRING
443
+ write_string(value)
444
+ when TK_WSTRING
445
+ write_wstring(value)
446
+ when TK_OBJREF
447
+ write_Object(value)
448
+ when TK_TYPECODE
449
+ write_TypeCode(value)
450
+ when TK_ARRAY, TK_SEQUENCE,
451
+ TK_ENUM, TK_STRUCT, TK_EXCEPT, TK_UNION,
452
+ TK_PRINCIPAL
453
+ write_construct(value, tc)
454
+ when TK_ABSTRACT_INTERFACE
455
+ write_Abstract(value)
456
+ when TK_VALUE
457
+ write_value(value)
458
+ when TK_VALUE_BOX
459
+ write_valuebox(value, tc.get_type().boxedvalue_helper())
460
+ ## TODO: TK_NATIVE
461
+ end
462
+ end
463
+
464
+ def write_any(value)
465
+ begin
466
+ self.stream_.write_any(value)
467
+ rescue ::NativeException
468
+ CORBA::Exception.native2r($!)
469
+ end
470
+ end
471
+
472
+ def write_boolean(value)
473
+ begin
474
+ self.stream_.write_boolean(value)
475
+ rescue ::NativeException
476
+ CORBA::Exception.native2r($!)
477
+ end
478
+ end
479
+
480
+ def write_boolean_array(value, offset, length)
481
+ begin
482
+ self.stream_.write_boolean_array(value.to_java(:boolean), offset, length)
483
+ rescue ::NativeException
484
+ CORBA::Exception.native2r($!)
485
+ end
486
+ end
487
+
488
+ def write_char(value)
489
+ begin
490
+ self.stream_.write_char(value[0])
491
+ rescue ::NativeException
492
+ CORBA::Exception.native2r($!)
493
+ end
494
+ end
495
+
496
+ def write_char_array(value, offset, length)
497
+ begin
498
+ self.stream_.write_char_array(value.collect{|c| c[0]}.to_java(:char), offset, length)
499
+ rescue ::NativeException
500
+ CORBA::Exception.native2r($!)
501
+ end
502
+ end
503
+
504
+ def write_wchar(value)
505
+ self.stream_.write_wchar(value)
506
+ end
507
+
508
+ def write_wchar_array(value, offset, length)
509
+ begin
510
+ self.stream_.write_wchar_array(value.to_java(:char), offset, length)
511
+ rescue ::NativeException
512
+ CORBA::Exception.native2r($!)
513
+ end
514
+ end
515
+
516
+ def write_octet(value)
517
+ begin
518
+ self.stream_.write_octet([value].pack('C').unpack('c').first)
519
+ rescue ::NativeException
520
+ CORBA::Exception.native2r($!)
521
+ end
522
+ end
523
+
524
+ def write_octet_array(value, offset, length)
525
+ begin
526
+ self.stream_.write_octet_array(value.pack('C*').unpack('c*').to_java(:byte), offset, length)
527
+ rescue ::NativeException
528
+ CORBA::Exception.native2r($!)
529
+ end
530
+ end
531
+
532
+ def write_short(value)
533
+ begin
534
+ self.stream_.write_short(value)
535
+ rescue ::NativeException
536
+ CORBA::Exception.native2r($!)
537
+ end
538
+ end
539
+
540
+ def write_short_array(value, offset, length)
541
+ begin
542
+ self.stream_.write_short_array(value.to_java(:short), offset, length)
543
+ rescue ::NativeException
544
+ CORBA::Exception.native2r($!)
545
+ end
546
+ end
547
+
548
+ def write_ushort(value)
549
+ begin
550
+ self.stream_.write_ushort([value].pack('S').unpack('s').first)
551
+ rescue ::NativeException
552
+ CORBA::Exception.native2r($!)
553
+ end
554
+ end
555
+
556
+ def write_ushort_array(value, offset, length)
557
+ begin
558
+ self.stream_.write_ushort_array(value.pack('S*').unpack('s*').to_java(:short), offset, length)
559
+ rescue ::NativeException
560
+ CORBA::Exception.native2r($!)
561
+ end
562
+ end
563
+
564
+ def write_long(value)
565
+ begin
566
+ self.stream_.write_long(value)
567
+ rescue ::NativeException
568
+ CORBA::Exception.native2r($!)
569
+ end
570
+ end
571
+
572
+ def write_long_array(value, offset, length)
573
+ begin
574
+ self.stream_.write_long_array(value.to_java(:int), offset, length)
575
+ rescue ::NativeException
576
+ CORBA::Exception.native2r($!)
577
+ end
578
+ end
579
+
580
+ def write_ulong(value)
581
+ begin
582
+ self.stream_.write_ulong([value].pack('L').unpack('l').first)
583
+ rescue ::NativeException
584
+ CORBA::Exception.native2r($!)
585
+ end
586
+ end
587
+
588
+ def write_ulong_array(value, offset, length)
589
+ begin
590
+ self.stream_.write_ulong_array(value.pack('L*').unpack('l*').to_java(:int), offset, length)
591
+ rescue ::NativeException
592
+ CORBA::Exception.native2r($!)
593
+ end
594
+ end
595
+
596
+ def write_longlong(value)
597
+ begin
598
+ self.stream_.write_longlong(value)
599
+ rescue ::NativeException
600
+ CORBA::Exception.native2r($!)
601
+ end
602
+ end
603
+
604
+ def write_longlong_array(value, offset, length)
605
+ begin
606
+ self.stream_.write_longlong_array(value.to_java(:long), offset, length)
607
+ rescue ::NativeException
608
+ CORBA::Exception.native2r($!)
609
+ end
610
+ end
611
+
612
+ def write_ulonglong(value)
613
+ begin
614
+ self.stream_.write_ulonglong([value].pack('Q').unpack('q').first)
615
+ rescue ::NativeException
616
+ CORBA::Exception.native2r($!)
617
+ end
618
+ end
619
+
620
+ def write_ulonglong_array(value, offset, length)
621
+ begin
622
+ self.stream_.write_ulonglong_array(value.pack('Q*').unpack('q*').to_java(:long), offset, length)
623
+ rescue ::NativeException
624
+ CORBA::Exception.native2r($!)
625
+ end
626
+ end
627
+
628
+ def write_float(value)
629
+ begin
630
+ self.stream_.write_float(value)
631
+ rescue ::NativeException
632
+ CORBA::Exception.native2r($!)
633
+ end
634
+ end
635
+
636
+ def write_float_array(value, offset, length)
637
+ begin
638
+ self.stream_.write_float_array(value.to_java(:float), offset, length)
639
+ rescue ::NativeException
640
+ CORBA::Exception.native2r($!)
641
+ end
642
+ end
643
+
644
+ def write_double(value)
645
+ begin
646
+ self.stream_.write_double(value)
647
+ rescue ::NativeException
648
+ CORBA::Exception.native2r($!)
649
+ end
650
+ end
651
+
652
+ def write_double_array(value, offset, length)
653
+ begin
654
+ self.stream_.write_double_array(value.to_java(:double), offset, length)
655
+ rescue ::NativeException
656
+ CORBA::Exception.native2r($!)
657
+ end
658
+ end
659
+
660
+ def write_string(value)
661
+ begin
662
+ self.stream_.write_string(value)
663
+ rescue ::NativeException
664
+ CORBA::Exception.native2r($!)
665
+ end
666
+ end
667
+
668
+ def write_wstring(value)
669
+ begin
670
+ self.stream_.write_wstring(value.inject('') {|s, b| s << b.chr})
671
+ rescue ::NativeException
672
+ CORBA::Exception.native2r($!)
673
+ end
674
+ end
675
+
676
+ def write_fixed(value)
677
+ begin
678
+ self.stream_.write_fixed(java.math.BigDecimal.new(value.to_s))
679
+ rescue ::NativeException
680
+ CORBA::Exception.native2r($!)
681
+ end
682
+ end
683
+
684
+ def write_Object(value)
685
+ begin
686
+ self.stream_.write_Object(value.objref_)
687
+ rescue ::NativeException
688
+ CORBA::Exception.native2r($!)
689
+ end
690
+ end
691
+
692
+ def write_TypeCode(value)
693
+ begin
694
+ self.stream_.write_TypeCode(value.tc_)
695
+ rescue ::NativeException
696
+ CORBA::Exception.native2r($!)
697
+ end
698
+ end
699
+
700
+ def write_construct(value, tc)
701
+ begin
702
+ CORBA::Any.to_any(value, tc).to_java(self.stream_().orb()).write_value(self.stream_)
703
+ rescue ::NativeException
704
+ CORBA::Exception.native2r($!)
705
+ end
706
+ end
707
+
708
+ def write_Abstract(value)
709
+ begin
710
+ self.stream_().write_abstract_interface(value.is_a?(CORBA::Object) ? value.objref_ : value)
711
+ rescue ::NativeException
712
+ CORBA::Exception.native2r($!)
713
+ end
714
+ end
715
+
716
+ def write_value(value)
717
+ begin
718
+ self.stream_.write_value(value)
719
+ rescue ::NativeException
720
+ CORBA::Exception.native2r($!)
721
+ end
722
+ end
723
+ alias :write_Value :write_value
724
+ def write_valuebox(value, boxedvalue_helper)
725
+ begin
726
+ self.stream_.write_value(value, boxedvalue_helper)
727
+ rescue ::NativeException
728
+ CORBA::Exception.native2r($!)
729
+ end
730
+ end
731
+ end
732
+ end
733
+ end
734
+ end