r2corba 1.4.1-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (267) 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/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 +33 -0
  14. data/lib/corba/cbase/ORB.rb +231 -0
  15. data/lib/corba/cbase/Request.rb +134 -0
  16. data/lib/corba/cbase/Streams.rb +129 -0
  17. data/lib/corba/cbase/Stub.rb +19 -0
  18. data/lib/corba/cbase/Typecode.rb +441 -0
  19. data/lib/corba/cbase/Values.rb +129 -0
  20. data/lib/corba/cbase/exception.rb +66 -0
  21. data/lib/corba/cbase/poa.rb +23 -0
  22. data/lib/corba/cbase/policies.rb +78 -0
  23. data/lib/corba/cbase/post_require.rb +14 -0
  24. data/lib/corba/cbase/require.rb +28 -0
  25. data/lib/corba/cmds/base.rb +85 -0
  26. data/lib/corba/cmds/test.rb +30 -0
  27. data/lib/corba/common/Any.rb +91 -0
  28. data/lib/corba/common/IDL.rb +104 -0
  29. data/lib/corba/common/ORB.rb +368 -0
  30. data/lib/corba/common/Object.rb +208 -0
  31. data/lib/corba/common/Request.rb +20 -0
  32. data/lib/corba/common/Servant.rb +108 -0
  33. data/lib/corba/common/Struct.rb +22 -0
  34. data/lib/corba/common/Stub.rb +79 -0
  35. data/lib/corba/common/Typecode.rb +1121 -0
  36. data/lib/corba/common/Union.rb +56 -0
  37. data/lib/corba/common/Values.rb +92 -0
  38. data/lib/corba/common/const.rb +22 -0
  39. data/lib/corba/common/exception.rb +68 -0
  40. data/lib/corba/common/require.rb +27 -0
  41. data/lib/corba/common/version.rb +22 -0
  42. data/lib/corba/idl/BiDirPolicyC.rb +63 -0
  43. data/lib/corba/idl/CosNamingC.rb +461 -0
  44. data/lib/corba/idl/CosNamingS.rb +309 -0
  45. data/lib/corba/idl/IDL.rb +21 -0
  46. data/lib/corba/idl/IORTable.pidl +62 -0
  47. data/lib/corba/idl/IORTableC.rb +117 -0
  48. data/lib/corba/idl/MessagingC.rb +904 -0
  49. data/lib/corba/idl/POAC.rb +930 -0
  50. data/lib/corba/idl/TAO_Ext.pidl +46 -0
  51. data/lib/corba/idl/TAO_ExtC.rb +179 -0
  52. data/lib/corba/idl/r2c_orb.rb +572 -0
  53. data/lib/corba/idl/require.rb +20 -0
  54. data/lib/corba/jbase/Any.rb +273 -0
  55. data/lib/corba/jbase/IORMap.rb +36 -0
  56. data/lib/corba/jbase/ORB.rb +99 -0
  57. data/lib/corba/jbase/Object.rb +98 -0
  58. data/lib/corba/jbase/Request.rb +226 -0
  59. data/lib/corba/jbase/Servant.rb +247 -0
  60. data/lib/corba/jbase/ServerRequest.rb +128 -0
  61. data/lib/corba/jbase/Streams.rb +671 -0
  62. data/lib/corba/jbase/Stub.rb +38 -0
  63. data/lib/corba/jbase/Typecode.rb +520 -0
  64. data/lib/corba/jbase/Values.rb +173 -0
  65. data/lib/corba/jbase/exception.rb +106 -0
  66. data/lib/corba/jbase/poa.rb +229 -0
  67. data/lib/corba/jbase/policies.rb +300 -0
  68. data/lib/corba/jbase/post_require.rb +14 -0
  69. data/lib/corba/jbase/require.rb +86 -0
  70. data/lib/corba/naming.rb +14 -0
  71. data/lib/corba/naming_service.rb +15 -0
  72. data/lib/corba/poa.rb +15 -0
  73. data/lib/corba/policies.rb +18 -0
  74. data/lib/corba/require.rb +17 -0
  75. data/lib/corba/svcs/ins/cos_naming.rb +426 -0
  76. data/lib/corba/svcs/ins/ins.rb +526 -0
  77. data/lib/corba/svcs/ins/naming_service.rb +119 -0
  78. data/lib/corba.rb +16 -0
  79. data/lib/ridlbe/ruby/config.rb +336 -0
  80. data/lib/ridlbe/ruby/orb.pidlc +0 -0
  81. data/lib/ridlbe/ruby/require.rb +16 -0
  82. data/lib/ridlbe/ruby/walker.rb +1582 -0
  83. data/mkrf_conf_bingem.rb +101 -0
  84. data/rakelib/bin.rake +80 -0
  85. data/rakelib/bin.rb +146 -0
  86. data/rakelib/build.rake +87 -0
  87. data/rakelib/config.rake +52 -0
  88. data/rakelib/config.rb +450 -0
  89. data/rakelib/ext.rake +242 -0
  90. data/rakelib/ext.rb +308 -0
  91. data/rakelib/ext_r2tao.rb +232 -0
  92. data/rakelib/gem.rake +212 -0
  93. data/rakelib/gem.rb +146 -0
  94. data/rakelib/package.rake +26 -0
  95. data/rakelib/test.rake +23 -0
  96. data/test/BiDirectional/Test.idl +34 -0
  97. data/test/BiDirectional/client.rb +132 -0
  98. data/test/BiDirectional/run_test.rb +68 -0
  99. data/test/BiDirectional/server.ior +1 -0
  100. data/test/BiDirectional/server.rb +169 -0
  101. data/test/CORBA_Services/Naming/BindingIterator/Test.idl +27 -0
  102. data/test/CORBA_Services/Naming/BindingIterator/client.rb +121 -0
  103. data/test/CORBA_Services/Naming/BindingIterator/ins.ior +1 -0
  104. data/test/CORBA_Services/Naming/BindingIterator/run_test.rb +82 -0
  105. data/test/CORBA_Services/Naming/BindingIterator/server.rb +109 -0
  106. data/test/CORBA_Services/Naming/Corbaname/Test.idl +27 -0
  107. data/test/CORBA_Services/Naming/Corbaname/client.rb +85 -0
  108. data/test/CORBA_Services/Naming/Corbaname/corbaname.ior +1 -0
  109. data/test/CORBA_Services/Naming/Corbaname/ins.ior +1 -0
  110. data/test/CORBA_Services/Naming/Corbaname/run_test.rb +88 -0
  111. data/test/CORBA_Services/Naming/Corbaname/server.rb +135 -0
  112. data/test/CORBA_Services/Naming/Simple/Test.idl +27 -0
  113. data/test/CORBA_Services/Naming/Simple/client.rb +84 -0
  114. data/test/CORBA_Services/Naming/Simple/ins.ior +1 -0
  115. data/test/CORBA_Services/Naming/Simple/run_test.rb +82 -0
  116. data/test/CORBA_Services/Naming/Simple/server.rb +109 -0
  117. data/test/Collocation/Diamond.idl +39 -0
  118. data/test/Collocation/run_test.rb +52 -0
  119. data/test/Collocation/test.rb +195 -0
  120. data/test/Connect_Timeout/Test.idl +27 -0
  121. data/test/Connect_Timeout/client.rb +111 -0
  122. data/test/Connect_Timeout/run_test.rb +52 -0
  123. data/test/DII/Test.idl +27 -0
  124. data/test/DII/client.rb +115 -0
  125. data/test/DII/run_test.rb +69 -0
  126. data/test/DII/server.ior +1 -0
  127. data/test/DII/server.rb +95 -0
  128. data/test/DSI/Test.idl +27 -0
  129. data/test/DSI/client.rb +66 -0
  130. data/test/DSI/run_test.rb +69 -0
  131. data/test/DSI/server.ior +1 -0
  132. data/test/DSI/server.rb +106 -0
  133. data/test/Exceptions/Test.idl +48 -0
  134. data/test/Exceptions/client.rb +118 -0
  135. data/test/Exceptions/run_test.rb +69 -0
  136. data/test/Exceptions/server.ior +1 -0
  137. data/test/Exceptions/server.rb +131 -0
  138. data/test/Hello/Test.idl +27 -0
  139. data/test/Hello/client.rb +78 -0
  140. data/test/Hello/run_test.rb +71 -0
  141. data/test/Hello/server.rb +95 -0
  142. data/test/IDL_Test/Test.idl +113 -0
  143. data/test/IDL_Test/Test_inc.idl +17 -0
  144. data/test/IDL_Test/client.rb +102 -0
  145. data/test/IDL_Test/run_test.rb +69 -0
  146. data/test/IDL_Test/server.ior +1 -0
  147. data/test/IDL_Test/server.rb +99 -0
  148. data/test/IORMap/Test.idl +27 -0
  149. data/test/IORMap/client.rb +73 -0
  150. data/test/IORMap/run_test.rb +69 -0
  151. data/test/IORMap/server.ior +1 -0
  152. data/test/IORMap/server.rb +114 -0
  153. data/test/IORTable/Test.idl +27 -0
  154. data/test/IORTable/client.rb +75 -0
  155. data/test/IORTable/run_test.rb +69 -0
  156. data/test/IORTable/server.ior +1 -0
  157. data/test/IORTable/server.rb +130 -0
  158. data/test/Implicit_Conversion/Test.idl +31 -0
  159. data/test/Implicit_Conversion/client.rb +110 -0
  160. data/test/Implicit_Conversion/run_test.rb +69 -0
  161. data/test/Implicit_Conversion/server.ior +1 -0
  162. data/test/Implicit_Conversion/server.rb +99 -0
  163. data/test/Multi_Threading/Multiple_ORB/Test.idl +27 -0
  164. data/test/Multi_Threading/Multiple_ORB/client.rb +82 -0
  165. data/test/Multi_Threading/Multiple_ORB/run_test.rb +71 -0
  166. data/test/Multi_Threading/Multiple_ORB/server.rb +108 -0
  167. data/test/Multi_Threading/Multiple_ORB/server0.ior +1 -0
  168. data/test/Multi_Threading/Multiple_ORB/server1.ior +1 -0
  169. data/test/Multi_Threading/Simple/Test.idl +27 -0
  170. data/test/Multi_Threading/Simple/client.rb +88 -0
  171. data/test/Multi_Threading/Simple/run_test.rb +69 -0
  172. data/test/Multi_Threading/Simple/server.ior +1 -0
  173. data/test/Multi_Threading/Simple/server.rb +118 -0
  174. data/test/Multi_Threading/Threads/Test.idl +31 -0
  175. data/test/Multi_Threading/Threads/client.rb +80 -0
  176. data/test/Multi_Threading/Threads/run_test.rb +76 -0
  177. data/test/Multi_Threading/Threads/server.ior +1 -0
  178. data/test/Multi_Threading/Threads/server.rb +119 -0
  179. data/test/Multi_Threading/Threads/watchdog.ior +1 -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.ior +1 -0
  185. data/test/Multiple_Servant_Interfaces/server.rb +102 -0
  186. data/test/Nil/Test.idl +27 -0
  187. data/test/Nil/run_test.rb +52 -0
  188. data/test/Nil/test.rb +78 -0
  189. data/test/OBV/AbstractInterface/client.rb +179 -0
  190. data/test/OBV/AbstractInterface/run_test.rb +69 -0
  191. data/test/OBV/AbstractInterface/server.ior +1 -0
  192. data/test/OBV/AbstractInterface/server.rb +149 -0
  193. data/test/OBV/AbstractInterface/test.idl +53 -0
  194. data/test/OBV/Custom/OBV.idl +18 -0
  195. data/test/OBV/Custom/OBV_impl.rb +40 -0
  196. data/test/OBV/Custom/client.rb +86 -0
  197. data/test/OBV/Custom/run_test.rb +69 -0
  198. data/test/OBV/Custom/server.ior +1 -0
  199. data/test/OBV/Custom/server.rb +100 -0
  200. data/test/OBV/Simple/OBV.idl +15 -0
  201. data/test/OBV/Simple/OBV_impl.rb +26 -0
  202. data/test/OBV/Simple/client.rb +86 -0
  203. data/test/OBV/Simple/run_test.rb +69 -0
  204. data/test/OBV/Simple/server.ior +1 -0
  205. data/test/OBV/Simple/server.rb +100 -0
  206. data/test/OBV/Simple_Event/Event.idl +15 -0
  207. data/test/OBV/Simple_Event/Event_impl.rb +26 -0
  208. data/test/OBV/Simple_Event/client.rb +86 -0
  209. data/test/OBV/Simple_Event/run_test.rb +69 -0
  210. data/test/OBV/Simple_Event/server.ior +1 -0
  211. data/test/OBV/Simple_Event/server.rb +100 -0
  212. data/test/OBV/Supports/client.rb +116 -0
  213. data/test/OBV/Supports/run_test.rb +69 -0
  214. data/test/OBV/Supports/server.ior +1 -0
  215. data/test/OBV/Supports/server.rb +103 -0
  216. data/test/OBV/Supports/supports.idl +33 -0
  217. data/test/OBV/Supports/supports_impl.rb +57 -0
  218. data/test/OBV/Tree/client.rb +116 -0
  219. data/test/OBV/Tree/run_test.rb +69 -0
  220. data/test/OBV/Tree/server.ior +1 -0
  221. data/test/OBV/Tree/server.rb +117 -0
  222. data/test/OBV/Tree/test.idl +32 -0
  223. data/test/OBV/Truncatable/Extra.idl +27 -0
  224. data/test/OBV/Truncatable/Truncatable.idl +105 -0
  225. data/test/OBV/Truncatable/Truncatable_impl.rb +86 -0
  226. data/test/OBV/Truncatable/client.rb +279 -0
  227. data/test/OBV/Truncatable/run_test.rb +69 -0
  228. data/test/OBV/Truncatable/server.ior +1 -0
  229. data/test/OBV/Truncatable/server.rb +89 -0
  230. data/test/OBV/ValueBox/client.rb +497 -0
  231. data/test/OBV/ValueBox/run_test.rb +69 -0
  232. data/test/OBV/ValueBox/server.ior +1 -0
  233. data/test/OBV/ValueBox/server.rb +271 -0
  234. data/test/OBV/ValueBox/valuebox.idl +101 -0
  235. data/test/OBV/ValueBox/vb_basic.idl +75 -0
  236. data/test/OBV/ValueBox/vb_struct.idl +68 -0
  237. data/test/OBV/ValueBox/vb_union.idl +21 -0
  238. data/test/Object/Test.idl +27 -0
  239. data/test/Object/client.rb +103 -0
  240. data/test/Object/run_test.rb +69 -0
  241. data/test/Object/server.ior +1 -0
  242. data/test/Object/server.rb +126 -0
  243. data/test/POA/Test.idl +27 -0
  244. data/test/POA/run_test.rb +52 -0
  245. data/test/POA/test.rb +112 -0
  246. data/test/Param_Test/Test.idl +182 -0
  247. data/test/Param_Test/client.rb +277 -0
  248. data/test/Param_Test/run_test.rb +69 -0
  249. data/test/Param_Test/server.ior +1 -0
  250. data/test/Param_Test/server.rb +296 -0
  251. data/test/Performance/Simple/Test.idl +27 -0
  252. data/test/Performance/Simple/client.rb +90 -0
  253. data/test/Performance/Simple/run_test.rb +69 -0
  254. data/test/Performance/Simple/server.ior +1 -0
  255. data/test/Performance/Simple/server.rb +95 -0
  256. data/test/Policies/Test.idl +27 -0
  257. data/test/Policies/run_test.rb +52 -0
  258. data/test/Policies/test.rb +144 -0
  259. data/test/Timeout/client.rb +207 -0
  260. data/test/Timeout/run_test.rb +69 -0
  261. data/test/Timeout/server.ior +1 -0
  262. data/test/Timeout/server.rb +109 -0
  263. data/test/Timeout/test.idl +19 -0
  264. data/test/lib/assert.rb +43 -0
  265. data/test/lib/test.rb +542 -0
  266. data/test/test_runner.rb +193 -0
  267. metadata +342 -0
@@ -0,0 +1,441 @@
1
+ #--------------------------------------------------------------------
2
+ # Typecode.rb - C++/TAO specific CORBA TypeCode definitions
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
+ module R2CORBA
15
+ module CORBA
16
+ class TypeCode
17
+
18
+ def kind
19
+ begin
20
+ self.tc_.kind
21
+ rescue ::NativeException
22
+ CORBA::Exception.native2r($!)
23
+ end
24
+ end
25
+
26
+ def member_label(index)
27
+ begin
28
+ self.tc_.member_label(index.to_i)
29
+ rescue ::NativeException
30
+ CORBA::Exception.native2r($!)
31
+ end
32
+ end
33
+
34
+ class Recursive < CORBA::TypeCode
35
+
36
+ def initialize(id)
37
+ begin
38
+ @tc_ = CORBA::Native::TypeCode.create_recursive_tc(id)
39
+ rescue ::NativeException
40
+ CORBA::Exception.native2r($!)
41
+ end
42
+ end
43
+
44
+ end # Recursive
45
+
46
+ class String < CORBA::TypeCode
47
+
48
+ def initialize(*args)
49
+ if CORBA::Native::TypeCode === args.first
50
+ @tc_ = args.first
51
+ else
52
+ begin
53
+ @tc_ = CORBA::Native::TypeCode.create_tc(TK_STRING, args.shift.to_i)
54
+ rescue ::NativeException
55
+ CORBA::Exception.native2r($!)
56
+ end
57
+ end
58
+ end
59
+
60
+ end # String
61
+
62
+ class WString < CORBA::TypeCode
63
+
64
+ def initialize(*args)
65
+ if CORBA::Native::TypeCode === args.first
66
+ @tc_ = args.first
67
+ else
68
+ begin
69
+ @tc_ = CORBA::Native::TypeCode.create_tc(TK_WSTRING, args.shift.to_i)
70
+ rescue ::NativeException
71
+ CORBA::Exception.native2r($!)
72
+ end
73
+ end
74
+ end
75
+
76
+ end # WString
77
+
78
+ class Fixed < CORBA::TypeCode
79
+
80
+ def initialize(*args)
81
+ if CORBA::Native::TypeCode === args.first
82
+ @tc_ = args.first
83
+ else
84
+ digits, scale = args
85
+ begin
86
+ @tc_ = CORBA::Native::TypeCode.create_tc(TK_FIXED, digits.to_i, scale.to_i)
87
+ rescue ::NativeException
88
+ CORBA::Exception.native2r($!)
89
+ end
90
+ end
91
+ end
92
+
93
+ end # Fixed
94
+
95
+ class Sequence < CORBA::TypeCode
96
+
97
+ def initialize(*args)
98
+ if CORBA::Native::TypeCode === args.first
99
+ @tc_ = args.first
100
+ else
101
+ element_tc, bound = args
102
+ raise ArgumentError, 'expected CORBA::TypeCode' unless element_tc.is_a?(CORBA::TypeCode)
103
+ begin
104
+ @tc_ = CORBA::Native::TypeCode.create_tc(TK_SEQUENCE, bound.to_i, element_tc.tc_)
105
+ rescue ::NativeException
106
+ CORBA::Exception.native2r($!)
107
+ end
108
+ end
109
+ end
110
+
111
+ end
112
+
113
+ class Array < CORBA::TypeCode
114
+
115
+ def initialize(*args)
116
+ if CORBA::Native::TypeCode === args.first
117
+ @tc_ = args.first
118
+ else
119
+ content_tc = args.shift
120
+ length = args
121
+ raise ArgumentError, 'expected CORBA::TypeCode' unless content_tc.is_a?(CORBA::TypeCode)
122
+ if length.size>1
123
+ this_len = length.shift
124
+ content_tc = self.class.new(content_tc, *length)
125
+ else
126
+ this_len = length.first
127
+ end
128
+ begin
129
+ @tc_ = CORBA::Native::TypeCode.create_tc(TK_ARRAY, this_len.to_i, content_tc.tc_)
130
+ rescue ::NativeException
131
+ CORBA::Exception.native2r($!)
132
+ end
133
+ end
134
+ end
135
+
136
+ end # Array
137
+
138
+ class IdentifiedTypeCode < CORBA::TypeCode
139
+
140
+ def initialize(id)
141
+ CORBA::TypeCode.register_id_type(id.to_s, self)
142
+ end
143
+
144
+ end # IdentifiedTypeCode
145
+
146
+ class Alias < IdentifiedTypeCode
147
+
148
+ def initialize(*args)
149
+ if CORBA::Native::TypeCode === args.first
150
+ @tc_ = args.first
151
+ @type = nil
152
+ super(@tc_.id)
153
+ else
154
+ id, name, orig_tc, type = args
155
+ raise ArgumentError, 'expected CORBA::TypeCode' unless orig_tc.is_a?(CORBA::TypeCode)
156
+ begin
157
+ @tc_ = CORBA::Native::TypeCode.create_tc(TK_ALIAS, id.to_s, name.to_s, orig_tc.tc_)
158
+ rescue ::NativeException
159
+ CORBA::Exception.native2r($!)
160
+ end
161
+ @type = type
162
+ super(id)
163
+ end
164
+ end
165
+
166
+ end # Alias
167
+
168
+ class Valuetype < IdentifiedTypeCode
169
+
170
+ def initialize(*args)
171
+ if CORBA::Native::TypeCode === args.first
172
+ @tc_ = args.first
173
+ @type = nil
174
+ @members = []
175
+ @tc_.member_count.times do |i|
176
+ @members << [@tc_.member_name(i), TypeCode.from_native(@tc_.member_type(i))]
177
+ end
178
+ super(id)
179
+ else
180
+ id, name, modifier, base, members_, type_ = args
181
+ raise ArgumentError, 'expected CORBA::Typecode' unless base.nil? || base.is_a?(CORBA::TypeCode)
182
+ raise ArgumentError, 'expected members Array' unless members_.is_a?(::Array) || type_.nil?
183
+ if type_.nil? && !members_.is_a?(::Array)
184
+ type_ = members_
185
+ members_ = []
186
+ end
187
+ @type = type_
188
+ @members = []
189
+ members_.each { |n, tc, access| add_member(n, tc, access) }
190
+ n_members = @members.collect do |n, tc, access|
191
+ [n.to_s, tc.tc_, access == :public ? CORBA::PUBLIC_MEMBER : CORBA::PRIVATE_MEMBER]
192
+ end
193
+ @tc_ = _create_tc(id, name, modifier, base, n_members)
194
+ super(id)
195
+ end
196
+ end
197
+
198
+ protected
199
+
200
+ def _create_tc(id,name,modifier,base,members)
201
+ begin
202
+ CORBA::Native::TypeCode.create_tc(TK_VALUE, id.to_s, name.to_s,
203
+ CORBA::VT_MODIFIERS[modifier],
204
+ base.nil? ? nil : base.tc_,
205
+ members)
206
+ rescue ::NativeException
207
+ CORBA::Exception.native2r($!)
208
+ end
209
+ end
210
+
211
+ end # Valuetype
212
+
213
+ class Eventtype < Valuetype
214
+
215
+ protected
216
+
217
+ def _create_tc(id,name,modifier,base,members)
218
+ begin
219
+ CORBA::Native::TypeCode.create_tc(TK_EVENT, id.to_s, name.to_s,
220
+ CORBA::VT_MODIFIERS[modifier],
221
+ base.nil? ? nil : base.tc_,
222
+ members)
223
+ rescue ::NativeException
224
+ CORBA::Exception.native2r($!)
225
+ end
226
+ end
227
+
228
+ end # Eventtype
229
+
230
+ class Valuebox < IdentifiedTypeCode
231
+
232
+ def initialize(*args)
233
+ if CORBA::Native::TypeCode === args.first
234
+ @tc_ = args.first
235
+ @type = nil
236
+ super(@tc_.id)
237
+ else
238
+ id, name, boxed_tc, type = args
239
+ raise ArgumentError, 'expected CORBA::TypeCode' unless boxed_tc.is_a?(CORBA::TypeCode)
240
+ begin
241
+ @tc_ = CORBA::Native::TypeCode.create_tc(TK_VALUE_BOX, id.to_s, name.to_s, boxed_tc.tc_)
242
+ rescue ::NativeException
243
+ CORBA::Exception.native2r($!)
244
+ end
245
+ @type = type
246
+ super(id)
247
+ ## autoregister
248
+ CORBA::ORB._check_value_factory(@type::Factory) if @type < CORBA::Portable::BoxedValueBase
249
+ end
250
+ end
251
+
252
+ end # Valuebox
253
+
254
+ class ObjectRef < IdentifiedTypeCode
255
+
256
+ def initialize(*args)
257
+ if CORBA::Native::TypeCode === args.first
258
+ @tc_ = args.first
259
+ @type = CORBA::Object
260
+ super(@tc_.id)
261
+ else
262
+ id, name, type = args
263
+ begin
264
+ @tc_ = CORBA::Native::TypeCode.create_tc(TK_OBJREF, id.to_s, name.to_s)
265
+ rescue ::NativeException
266
+ CORBA::Exception.native2r($!)
267
+ end
268
+ @type = type
269
+ super(id)
270
+ end
271
+ end
272
+
273
+ end # ObjectRef
274
+
275
+ class AbstractInterface < IdentifiedTypeCode
276
+
277
+ def initialize(*args)
278
+ if CORBA::Native::TypeCode === args.first
279
+ @tc_ = args.first
280
+ @type = CORBA::AbstractBase
281
+ super(@tc_.id)
282
+ else
283
+ id, name, type = args
284
+ begin
285
+ @tc_ = CORBA::Native::TypeCode.create_tc(TK_ABSTRACT_INTERFACE, id.to_s, name.to_s)
286
+ rescue ::NativeException
287
+ CORBA::Exception.native2r($!)
288
+ end
289
+ @type = type
290
+ super(id)
291
+ end
292
+ end
293
+
294
+ end # AbstractInterface
295
+
296
+ class Struct < IdentifiedTypeCode
297
+
298
+ def initialize(*args)
299
+ if CORBA::Native::TypeCode === args.first
300
+ @tc_ = args.first
301
+ @type = nil
302
+ @members = []
303
+ @tc_.member_count.times do |i|
304
+ @members << [@tc_.member_name(i), TypeCode.from_native(@tc_.member_type(i))]
305
+ end
306
+ super(id)
307
+ else
308
+ id, name, members_, type_ = args
309
+ raise ArgumentError, 'expected members Array' unless members_.is_a?(::Array) || type_.nil?
310
+ if type_.nil? && !members_.is_a?(::Array)
311
+ type_ = members_
312
+ members_ = []
313
+ end
314
+ @type = type_
315
+ @members = []
316
+ members_.each { |n, tc| add_member(n, tc) }
317
+ n_members = @members.collect {|n, tc| [n.to_s(), tc.tc_] }
318
+ @tc_ = _create_tc(id, name, n_members)
319
+ super(id)
320
+ end
321
+ end
322
+
323
+ protected
324
+
325
+ def _create_tc(id,name,members)
326
+ begin
327
+ CORBA::Native::TypeCode.create_tc(TK_STRUCT, id.to_s, name.to_s, members)
328
+ rescue ::NativeException
329
+ CORBA::Exception.native2r($!)
330
+ end
331
+ end
332
+
333
+ end # Struct
334
+
335
+ class Except < Struct
336
+
337
+ protected
338
+
339
+ def _create_tc(id,name,members)
340
+ begin
341
+ CORBA::Native::TypeCode.create_tc(TK_EXCEPT, id.to_s, name.to_s, members)
342
+ rescue ::NativeException
343
+ CORBA::Exception.native2r($!)
344
+ end
345
+ end
346
+
347
+ end # Except
348
+
349
+ class Union < IdentifiedTypeCode
350
+
351
+ def initialize(*args)
352
+ if CORBA::Native::TypeCode === args.first
353
+ @tc_ = args.first
354
+ @type = nil
355
+ @switchtype = TypeCode.from_native(@tc_.discriminator_type)
356
+ @labels = {}
357
+ @members = []
358
+ def_inx = @tc_.default_index
359
+ @tc_.member_count.times do |i|
360
+ if def_inx < 0 || def_inx != i
361
+ ml_ = @tc_.member_label(i)
362
+ else
363
+ ml_ = :default
364
+ end
365
+ @labels[ml] = i
366
+ @members << [ml, @tc_.member_name(i), TypeCode.from_native(@tc_.member_type(i))]
367
+ end
368
+ super(id)
369
+ else
370
+ id, name, switchtype_, members_, type_, implicit_default_ = args
371
+ raise ::CORBA::BAD_PARAM unless members_.is_a? ::Array
372
+ raise ::CORBA::BAD_PARAM unless switchtype_.is_a?(CORBA::TypeCode)
373
+ @type = type_
374
+ @implicit_default = implicit_default_
375
+ @switchtype = switchtype_.resolved_tc
376
+ @labels = {}
377
+ @members = []
378
+ members_.each { |mlabel, mname, mtc|
379
+ add_member(mlabel, mname, mtc)
380
+ }
381
+ @id = id
382
+ @name = name
383
+ n_members = @members.collect do |ml, mn, mtc|
384
+ [ml, mn.to_s, mtc.tc_]
385
+ end
386
+ @tc = _create_tc(@id, @name, @switchtype, n_members)
387
+ super(id)
388
+ end
389
+ end
390
+
391
+ def tc_
392
+ @tc
393
+ end
394
+
395
+ protected
396
+
397
+ def _create_tc(id, name, disctc, members)
398
+ begin
399
+ CORBA::Native::TypeCode.create_tc(TK_UNION, id.to_s, name.to_s, disctc.tc_, members)
400
+ rescue ::NativeException
401
+ CORBA::Exception.native2r($!)
402
+ end
403
+ end
404
+
405
+ end # Union
406
+
407
+ class Enum < IdentifiedTypeCode
408
+
409
+ def initialize(*args)
410
+ if CORBA::Native::TypeCode === args.first
411
+ @tc_ = args.first
412
+ @range = (0..@tc_.member_count).freeze
413
+ @members = @range.to_a.collect {|i| @tc_.member_name(i) }
414
+ super(@tc_.id)
415
+ else
416
+ id, name, members_ = args
417
+ raise CORBA::BAD_PARAM unless members_.is_a? ::Array
418
+ @members = members_.collect {|m| m.to_s}
419
+ @range = (0...@members.size).freeze
420
+ begin
421
+ @tc_ = CORBA::Native::TypeCode.create_tc(TK_ENUM, id.to_s, name.to_s, @members)
422
+ rescue ::NativeException
423
+ CORBA::Exception.native2r($!)
424
+ end
425
+ super(id)
426
+ end
427
+ end
428
+
429
+ end # Enum
430
+
431
+ def TypeCode.get_primitive_tc(kind)
432
+ TypeCode._wrap_native(CORBA::Native::TypeCode.get_primitive_tc(kind.to_i))
433
+ end
434
+
435
+ # final initialization
436
+ self._init()
437
+
438
+ end # TypeCode
439
+
440
+ end ## module CORBA
441
+ end ## module R2CORBA
@@ -0,0 +1,129 @@
1
+ #--------------------------------------------------------------------
2
+ # Values.rb - C++/Value CORBA Value and ValueBox 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
+ module R2CORBA
15
+ module CORBA
16
+ module AbstractValueBase
17
+ def self.included(mod)
18
+ mod.module_eval do
19
+ def self.===(obj)
20
+ obj.kind_of?(self)
21
+ end
22
+ end
23
+ end
24
+ end
25
+ module ValueBase
26
+ def self.included(mod)
27
+ mod.module_eval do
28
+ include CORBA::AbstractValueBase unless self.include?(CORBA::AbstractValueBase)
29
+
30
+ alias :org_kind_of? :kind_of?
31
+ def kind_of?(mod)
32
+ if mod < CORBA::AbstractValueBase && mod.const_defined?(:Intf)
33
+ org_kind_of?(mod::Intf)
34
+ #super(mod::Intf) ## problematic with Ruby 1.9.2 (known bug)
35
+ else
36
+ org_kind_of?(mod)
37
+ #super ## problematic with Ruby 1.9.2 (known bug)
38
+ end
39
+ end
40
+ alias :is_a? :kind_of?
41
+ end
42
+ end
43
+
44
+ def _marshal_with(os, &block)
45
+ self.pre_marshal(os)
46
+ self.instance_eval(&block)
47
+ self.post_marshal(os)
48
+ end
49
+
50
+ def _unmarshal_with(is, &block)
51
+ self.pre_unmarshal(is)
52
+ self.instance_eval(&block)
53
+ self.post_unmarshal(is)
54
+ end
55
+ end # ValueBase
56
+
57
+ module Portable
58
+ class ValueFactoryBase
59
+
60
+ def self.inherited(value_factory_base)
61
+ # value_factory_base is the <valuetype>Factory base class
62
+ # generated from IDL
63
+ value_factory_base.module_eval do
64
+ def self.value_id
65
+ self::VALUE_ID
66
+ end
67
+ end
68
+ end
69
+
70
+ def self._check_factory
71
+ f = self._lookup_value_factory(self.value_id)
72
+ self._register_value_factory(self.value_id(), self.new) if f.nil?
73
+ end
74
+
75
+ end # ValueFactoryBase
76
+
77
+ module CustomValueBase
78
+ def self.included(mod)
79
+ mod.module_eval do
80
+ include CORBA::ValueBase unless self.include?(CORBA::ValueBase)
81
+
82
+ def do_marshal(os)
83
+ self.pre_marshal(os)
84
+ self.marshal(os)
85
+ self.post_marshal(os)
86
+ end
87
+
88
+ def do_unmarshal(is)
89
+ self.pre_unmarshal(is)
90
+ self.unmarshal(is)
91
+ self.post_unmarshal(is)
92
+ end
93
+ end
94
+ end
95
+ end # CustomValueBase
96
+
97
+ module BoxedValueBase
98
+ class FactoryBase < CORBA::Portable::ValueFactoryBase
99
+ ## generic factory base
100
+ end
101
+ def self.included(mod)
102
+ mod.module_eval do
103
+ include CORBA::ValueBase unless self.include?(CORBA::ValueBase)
104
+
105
+ def marshal(os)
106
+ os.write_member(self.class._tc.content_type.resolved_tc, self.value)
107
+ end
108
+
109
+ def unmarshal(is)
110
+ self.value = is.read_member(self.class._tc.content_type.resolved_tc)
111
+ end
112
+
113
+ self.const_set(:Factory, Class.new(CORBA::Portable::BoxedValueBase::FactoryBase))
114
+ self::Factory.class_eval(%Q{
115
+ def self.value_id
116
+ #{self.name}::TRUNCATABLE_IDS.first
117
+ end
118
+
119
+ def _create_default
120
+ #{self.name}.new
121
+ end
122
+ })
123
+ end
124
+ end
125
+ end
126
+
127
+ end # Portable
128
+ end # CORBA
129
+ end # R2CORBA
@@ -0,0 +1,66 @@
1
+ #--------------------------------------------------------------------
2
+ # exception.rb - C++/TAO ORB specific CORBA Exception definitions
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
+ # import all java CORBA exceptions into the R2CORBA::CORBA namespace
15
+ module R2CORBA
16
+ module CORBA
17
+
18
+ class Exception
19
+ def self.native2r(nex)
20
+ raise nex
21
+ end
22
+ end
23
+
24
+ class InternalError
25
+ def initialize(ex_or_str)
26
+ if ex_or_str.is_a?(String)
27
+ super(ex_or_str)
28
+ else
29
+ @ex_ = ex_or_str
30
+ super(@ex_.message)
31
+ self.set_backtrace(@ex_.backtrace)
32
+ end
33
+ end
34
+ end
35
+
36
+ class SystemException
37
+ def SystemException._raise(id, reason, minor, completed)
38
+ name = id.to_s.split(':')[1]
39
+ exklass = name.split('/').last
40
+ exklass = CORBA.const_defined?(exklass) ? CORBA.const_get(exklass) : nil
41
+ if exklass.nil? || !(CORBA::SystemException > exklass)
42
+ Kernel.raise InternalError,
43
+ "Unknown SystemException raised: " +
44
+ id.to_s+' ['+reason.to_s+']'
45
+ else
46
+ Kernel.raise exklass.new(reason,minor,completed)
47
+ end
48
+ end
49
+ def initialize(reason="", minor=0, completed=nil)
50
+ super(reason)
51
+ @minor = minor
52
+ @completed = completed
53
+ @ids = [self.class::Id]
54
+ end
55
+ attr_accessor :ids
56
+ def _ids; @ids; end
57
+ def _interface_repository_id
58
+ self.class::Id
59
+ end
60
+ end
61
+
62
+ end # CORBA
63
+ end # R2CORBA
64
+
65
+ # NativeException mockup for JRuby compatibility
66
+ NativeException = Exception
@@ -0,0 +1,23 @@
1
+ #--------------------------------------------------------------------
2
+ # poa.rb - C++/TAO R2CORBA POA loader
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
+ require 'corba/common/Servant.rb'
15
+ require 'corba/idl/POAC.rb'
16
+ require 'corba/idl/IORTableC'
17
+
18
+ begin
19
+ require RUBY_PLATFORM =~ /mingw32/ ? "librpoaw" : "librpoa"
20
+ rescue LoadError
21
+ $stderr.puts $!.to_s if $VERBOSE
22
+ raise
23
+ end