r2corba 1.4.1-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGES +159 -0
- data/LICENSE +59 -0
- data/README +62 -0
- data/THANKS +52 -0
- data/bin/r2corba +8 -0
- data/bin/r2corba.bat +20 -0
- data/bin/ridlc +11 -0
- data/bin/ridlc.bat +23 -0
- data/bin/rins +7 -0
- data/bin/rins.bat +19 -0
- data/ext/.keep +0 -0
- data/lib/corba/cbase/IORMap.rb +33 -0
- data/lib/corba/cbase/ORB.rb +231 -0
- data/lib/corba/cbase/Request.rb +134 -0
- data/lib/corba/cbase/Streams.rb +129 -0
- data/lib/corba/cbase/Stub.rb +19 -0
- data/lib/corba/cbase/Typecode.rb +441 -0
- data/lib/corba/cbase/Values.rb +129 -0
- data/lib/corba/cbase/exception.rb +66 -0
- data/lib/corba/cbase/poa.rb +23 -0
- data/lib/corba/cbase/policies.rb +78 -0
- data/lib/corba/cbase/post_require.rb +14 -0
- data/lib/corba/cbase/require.rb +28 -0
- data/lib/corba/cmds/base.rb +85 -0
- data/lib/corba/cmds/test.rb +30 -0
- data/lib/corba/common/Any.rb +91 -0
- data/lib/corba/common/IDL.rb +104 -0
- data/lib/corba/common/ORB.rb +368 -0
- data/lib/corba/common/Object.rb +208 -0
- data/lib/corba/common/Request.rb +20 -0
- data/lib/corba/common/Servant.rb +108 -0
- data/lib/corba/common/Struct.rb +22 -0
- data/lib/corba/common/Stub.rb +79 -0
- data/lib/corba/common/Typecode.rb +1121 -0
- data/lib/corba/common/Union.rb +56 -0
- data/lib/corba/common/Values.rb +92 -0
- data/lib/corba/common/const.rb +22 -0
- data/lib/corba/common/exception.rb +68 -0
- data/lib/corba/common/require.rb +27 -0
- data/lib/corba/common/version.rb +22 -0
- data/lib/corba/idl/BiDirPolicyC.rb +63 -0
- data/lib/corba/idl/CosNamingC.rb +461 -0
- data/lib/corba/idl/CosNamingS.rb +309 -0
- data/lib/corba/idl/IDL.rb +21 -0
- data/lib/corba/idl/IORTable.pidl +62 -0
- data/lib/corba/idl/IORTableC.rb +117 -0
- data/lib/corba/idl/MessagingC.rb +904 -0
- data/lib/corba/idl/POAC.rb +930 -0
- data/lib/corba/idl/TAO_Ext.pidl +46 -0
- data/lib/corba/idl/TAO_ExtC.rb +179 -0
- data/lib/corba/idl/r2c_orb.rb +572 -0
- data/lib/corba/idl/require.rb +20 -0
- data/lib/corba/jbase/Any.rb +273 -0
- data/lib/corba/jbase/IORMap.rb +36 -0
- data/lib/corba/jbase/ORB.rb +99 -0
- data/lib/corba/jbase/Object.rb +98 -0
- data/lib/corba/jbase/Request.rb +226 -0
- data/lib/corba/jbase/Servant.rb +247 -0
- data/lib/corba/jbase/ServerRequest.rb +128 -0
- data/lib/corba/jbase/Streams.rb +671 -0
- data/lib/corba/jbase/Stub.rb +38 -0
- data/lib/corba/jbase/Typecode.rb +520 -0
- data/lib/corba/jbase/Values.rb +173 -0
- data/lib/corba/jbase/exception.rb +106 -0
- data/lib/corba/jbase/poa.rb +229 -0
- data/lib/corba/jbase/policies.rb +300 -0
- data/lib/corba/jbase/post_require.rb +14 -0
- data/lib/corba/jbase/require.rb +86 -0
- data/lib/corba/naming.rb +14 -0
- data/lib/corba/naming_service.rb +15 -0
- data/lib/corba/poa.rb +15 -0
- data/lib/corba/policies.rb +18 -0
- data/lib/corba/require.rb +17 -0
- data/lib/corba/svcs/ins/cos_naming.rb +426 -0
- data/lib/corba/svcs/ins/ins.rb +526 -0
- data/lib/corba/svcs/ins/naming_service.rb +119 -0
- data/lib/corba.rb +16 -0
- data/lib/ridlbe/ruby/config.rb +336 -0
- data/lib/ridlbe/ruby/orb.pidlc +0 -0
- data/lib/ridlbe/ruby/require.rb +16 -0
- data/lib/ridlbe/ruby/walker.rb +1582 -0
- data/mkrf_conf_bingem.rb +101 -0
- data/rakelib/bin.rake +80 -0
- data/rakelib/bin.rb +146 -0
- data/rakelib/build.rake +87 -0
- data/rakelib/config.rake +52 -0
- data/rakelib/config.rb +450 -0
- data/rakelib/ext.rake +242 -0
- data/rakelib/ext.rb +308 -0
- data/rakelib/ext_r2tao.rb +232 -0
- data/rakelib/gem.rake +212 -0
- data/rakelib/gem.rb +146 -0
- data/rakelib/package.rake +26 -0
- data/rakelib/test.rake +23 -0
- data/test/BiDirectional/Test.idl +34 -0
- data/test/BiDirectional/client.rb +132 -0
- data/test/BiDirectional/run_test.rb +68 -0
- data/test/BiDirectional/server.ior +1 -0
- data/test/BiDirectional/server.rb +169 -0
- data/test/CORBA_Services/Naming/BindingIterator/Test.idl +27 -0
- data/test/CORBA_Services/Naming/BindingIterator/client.rb +121 -0
- data/test/CORBA_Services/Naming/BindingIterator/ins.ior +1 -0
- data/test/CORBA_Services/Naming/BindingIterator/run_test.rb +82 -0
- data/test/CORBA_Services/Naming/BindingIterator/server.rb +109 -0
- data/test/CORBA_Services/Naming/Corbaname/Test.idl +27 -0
- data/test/CORBA_Services/Naming/Corbaname/client.rb +85 -0
- data/test/CORBA_Services/Naming/Corbaname/corbaname.ior +1 -0
- data/test/CORBA_Services/Naming/Corbaname/ins.ior +1 -0
- data/test/CORBA_Services/Naming/Corbaname/run_test.rb +88 -0
- data/test/CORBA_Services/Naming/Corbaname/server.rb +135 -0
- data/test/CORBA_Services/Naming/Simple/Test.idl +27 -0
- data/test/CORBA_Services/Naming/Simple/client.rb +84 -0
- data/test/CORBA_Services/Naming/Simple/ins.ior +1 -0
- data/test/CORBA_Services/Naming/Simple/run_test.rb +82 -0
- data/test/CORBA_Services/Naming/Simple/server.rb +109 -0
- data/test/Collocation/Diamond.idl +39 -0
- data/test/Collocation/run_test.rb +52 -0
- data/test/Collocation/test.rb +195 -0
- data/test/Connect_Timeout/Test.idl +27 -0
- data/test/Connect_Timeout/client.rb +111 -0
- data/test/Connect_Timeout/run_test.rb +52 -0
- data/test/DII/Test.idl +27 -0
- data/test/DII/client.rb +115 -0
- data/test/DII/run_test.rb +69 -0
- data/test/DII/server.ior +1 -0
- data/test/DII/server.rb +95 -0
- data/test/DSI/Test.idl +27 -0
- data/test/DSI/client.rb +66 -0
- data/test/DSI/run_test.rb +69 -0
- data/test/DSI/server.ior +1 -0
- data/test/DSI/server.rb +106 -0
- data/test/Exceptions/Test.idl +48 -0
- data/test/Exceptions/client.rb +118 -0
- data/test/Exceptions/run_test.rb +69 -0
- data/test/Exceptions/server.ior +1 -0
- data/test/Exceptions/server.rb +131 -0
- data/test/Hello/Test.idl +27 -0
- data/test/Hello/client.rb +78 -0
- data/test/Hello/run_test.rb +71 -0
- data/test/Hello/server.rb +95 -0
- data/test/IDL_Test/Test.idl +113 -0
- data/test/IDL_Test/Test_inc.idl +17 -0
- data/test/IDL_Test/client.rb +102 -0
- data/test/IDL_Test/run_test.rb +69 -0
- data/test/IDL_Test/server.ior +1 -0
- data/test/IDL_Test/server.rb +99 -0
- data/test/IORMap/Test.idl +27 -0
- data/test/IORMap/client.rb +73 -0
- data/test/IORMap/run_test.rb +69 -0
- data/test/IORMap/server.ior +1 -0
- data/test/IORMap/server.rb +114 -0
- data/test/IORTable/Test.idl +27 -0
- data/test/IORTable/client.rb +75 -0
- data/test/IORTable/run_test.rb +69 -0
- data/test/IORTable/server.ior +1 -0
- data/test/IORTable/server.rb +130 -0
- data/test/Implicit_Conversion/Test.idl +31 -0
- data/test/Implicit_Conversion/client.rb +110 -0
- data/test/Implicit_Conversion/run_test.rb +69 -0
- data/test/Implicit_Conversion/server.ior +1 -0
- data/test/Implicit_Conversion/server.rb +99 -0
- data/test/Multi_Threading/Multiple_ORB/Test.idl +27 -0
- data/test/Multi_Threading/Multiple_ORB/client.rb +82 -0
- data/test/Multi_Threading/Multiple_ORB/run_test.rb +71 -0
- data/test/Multi_Threading/Multiple_ORB/server.rb +108 -0
- data/test/Multi_Threading/Multiple_ORB/server0.ior +1 -0
- data/test/Multi_Threading/Multiple_ORB/server1.ior +1 -0
- data/test/Multi_Threading/Simple/Test.idl +27 -0
- data/test/Multi_Threading/Simple/client.rb +88 -0
- data/test/Multi_Threading/Simple/run_test.rb +69 -0
- data/test/Multi_Threading/Simple/server.ior +1 -0
- data/test/Multi_Threading/Simple/server.rb +118 -0
- data/test/Multi_Threading/Threads/Test.idl +31 -0
- data/test/Multi_Threading/Threads/client.rb +80 -0
- data/test/Multi_Threading/Threads/run_test.rb +76 -0
- data/test/Multi_Threading/Threads/server.ior +1 -0
- data/test/Multi_Threading/Threads/server.rb +119 -0
- data/test/Multi_Threading/Threads/watchdog.ior +1 -0
- data/test/Multi_Threading/Threads/watchdog.rb +87 -0
- data/test/Multiple_Servant_Interfaces/Test.idl +34 -0
- data/test/Multiple_Servant_Interfaces/client.rb +70 -0
- data/test/Multiple_Servant_Interfaces/run_test.rb +69 -0
- data/test/Multiple_Servant_Interfaces/server.ior +1 -0
- data/test/Multiple_Servant_Interfaces/server.rb +102 -0
- data/test/Nil/Test.idl +27 -0
- data/test/Nil/run_test.rb +52 -0
- data/test/Nil/test.rb +78 -0
- data/test/OBV/AbstractInterface/client.rb +179 -0
- data/test/OBV/AbstractInterface/run_test.rb +69 -0
- data/test/OBV/AbstractInterface/server.ior +1 -0
- data/test/OBV/AbstractInterface/server.rb +149 -0
- data/test/OBV/AbstractInterface/test.idl +53 -0
- data/test/OBV/Custom/OBV.idl +18 -0
- data/test/OBV/Custom/OBV_impl.rb +40 -0
- data/test/OBV/Custom/client.rb +86 -0
- data/test/OBV/Custom/run_test.rb +69 -0
- data/test/OBV/Custom/server.ior +1 -0
- data/test/OBV/Custom/server.rb +100 -0
- data/test/OBV/Simple/OBV.idl +15 -0
- data/test/OBV/Simple/OBV_impl.rb +26 -0
- data/test/OBV/Simple/client.rb +86 -0
- data/test/OBV/Simple/run_test.rb +69 -0
- data/test/OBV/Simple/server.ior +1 -0
- data/test/OBV/Simple/server.rb +100 -0
- data/test/OBV/Simple_Event/Event.idl +15 -0
- data/test/OBV/Simple_Event/Event_impl.rb +26 -0
- data/test/OBV/Simple_Event/client.rb +86 -0
- data/test/OBV/Simple_Event/run_test.rb +69 -0
- data/test/OBV/Simple_Event/server.ior +1 -0
- data/test/OBV/Simple_Event/server.rb +100 -0
- data/test/OBV/Supports/client.rb +116 -0
- data/test/OBV/Supports/run_test.rb +69 -0
- data/test/OBV/Supports/server.ior +1 -0
- data/test/OBV/Supports/server.rb +103 -0
- data/test/OBV/Supports/supports.idl +33 -0
- data/test/OBV/Supports/supports_impl.rb +57 -0
- data/test/OBV/Tree/client.rb +116 -0
- data/test/OBV/Tree/run_test.rb +69 -0
- data/test/OBV/Tree/server.ior +1 -0
- data/test/OBV/Tree/server.rb +117 -0
- data/test/OBV/Tree/test.idl +32 -0
- data/test/OBV/Truncatable/Extra.idl +27 -0
- data/test/OBV/Truncatable/Truncatable.idl +105 -0
- data/test/OBV/Truncatable/Truncatable_impl.rb +86 -0
- data/test/OBV/Truncatable/client.rb +279 -0
- data/test/OBV/Truncatable/run_test.rb +69 -0
- data/test/OBV/Truncatable/server.ior +1 -0
- data/test/OBV/Truncatable/server.rb +89 -0
- data/test/OBV/ValueBox/client.rb +497 -0
- data/test/OBV/ValueBox/run_test.rb +69 -0
- data/test/OBV/ValueBox/server.ior +1 -0
- data/test/OBV/ValueBox/server.rb +271 -0
- data/test/OBV/ValueBox/valuebox.idl +101 -0
- data/test/OBV/ValueBox/vb_basic.idl +75 -0
- data/test/OBV/ValueBox/vb_struct.idl +68 -0
- data/test/OBV/ValueBox/vb_union.idl +21 -0
- data/test/Object/Test.idl +27 -0
- data/test/Object/client.rb +103 -0
- data/test/Object/run_test.rb +69 -0
- data/test/Object/server.ior +1 -0
- data/test/Object/server.rb +126 -0
- data/test/POA/Test.idl +27 -0
- data/test/POA/run_test.rb +52 -0
- data/test/POA/test.rb +112 -0
- data/test/Param_Test/Test.idl +182 -0
- data/test/Param_Test/client.rb +277 -0
- data/test/Param_Test/run_test.rb +69 -0
- data/test/Param_Test/server.ior +1 -0
- data/test/Param_Test/server.rb +296 -0
- data/test/Performance/Simple/Test.idl +27 -0
- data/test/Performance/Simple/client.rb +90 -0
- data/test/Performance/Simple/run_test.rb +69 -0
- data/test/Performance/Simple/server.ior +1 -0
- data/test/Performance/Simple/server.rb +95 -0
- data/test/Policies/Test.idl +27 -0
- data/test/Policies/run_test.rb +52 -0
- data/test/Policies/test.rb +144 -0
- data/test/Timeout/client.rb +207 -0
- data/test/Timeout/run_test.rb +69 -0
- data/test/Timeout/server.ior +1 -0
- data/test/Timeout/server.rb +109 -0
- data/test/Timeout/test.idl +19 -0
- data/test/lib/assert.rb +43 -0
- data/test/lib/test.rb +542 -0
- data/test/test_runner.rb +193 -0
- 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
|