rustorb 0.7.0
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.
- checksums.yaml +7 -0
- data/README.md +42 -0
- data/ext/rustorb_ext/extconf.rb +33 -0
- data/ext/rustorb_ext/rustorb_ext.c +3805 -0
- data/lib/CosNamingC.rb +275 -0
- data/lib/CosNamingS.rb +74 -0
- data/lib/corba.rb +4 -0
- data/lib/rustorb/dii.rb +337 -0
- data/lib/rustorb/dynamic_any.rb +285 -0
- data/lib/rustorb/exceptions.rb +112 -0
- data/lib/rustorb/marshal.rb +405 -0
- data/lib/rustorb/messaging.rb +207 -0
- data/lib/rustorb/object.rb +278 -0
- data/lib/rustorb/orb.rb +152 -0
- data/lib/rustorb/pi.rb +526 -0
- data/lib/rustorb/portable_server.rb +453 -0
- data/lib/rustorb/servant_managers.rb +172 -0
- data/lib/rustorb/typecode.rb +448 -0
- data/lib/rustorb/types.rb +324 -0
- data/lib/rustorb/values.rb +389 -0
- data/lib/rustorb/version.rb +5 -0
- data/lib/rustorb.rb +30 -0
- data/vendor/include/rustorb/rustorb.h +1429 -0
- data/vendor/linux-aarch64/librustorb_ffi.a +4 -0
- data/vendor/linux-x86_64/librustorb_ffi.a +4 -0
- data/vendor/macos-aarch64/librustorb_ffi.a +0 -0
- metadata +84 -0
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# DynamicAny: building and taking apart values of types known only by
|
|
4
|
+
# their TypeCode.
|
|
5
|
+
#
|
|
6
|
+
# factory = orb.resolve_initial_references("DynAnyFactory")
|
|
7
|
+
# d = factory.create_dyn_any_from_type_code(tc) # a DynStruct...
|
|
8
|
+
# d.insert_long(1)
|
|
9
|
+
# d.next
|
|
10
|
+
# d.insert_string("x")
|
|
11
|
+
# any = d.to_any
|
|
12
|
+
#
|
|
13
|
+
# The factory gives the DynAny of the class its type calls for: DynFixed,
|
|
14
|
+
# DynEnum, DynStruct (structs and exceptions), DynUnion, DynSequence,
|
|
15
|
+
# DynArray, DynValue, DynValueBox or plain DynAny. The operations have
|
|
16
|
+
# their IDL names; values are Ruby values, anys CORBA::Any, TCKinds the
|
|
17
|
+
# CORBA::TK_ Integers. Components share their state with the DynAny they
|
|
18
|
+
# belong to. See docs/dynany.md.
|
|
19
|
+
#
|
|
20
|
+
# Licensed under MIT OR Apache-2.0, like the rest of the rustorb core.
|
|
21
|
+
|
|
22
|
+
module DynamicAny
|
|
23
|
+
# A member and its value: id (the name) and value (a CORBA::Any).
|
|
24
|
+
class NameValuePair < Rustorb::Struct
|
|
25
|
+
ID = "IDL:omg.org/DynamicAny/NameValuePair:1.0"
|
|
26
|
+
MEMBERS = %w[id value].freeze
|
|
27
|
+
attr_accessor :id, :value
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# A member and its DynAny: id and value.
|
|
31
|
+
class NameDynAnyPair < Rustorb::Struct
|
|
32
|
+
ID = "IDL:omg.org/DynamicAny/NameDynAnyPair:1.0"
|
|
33
|
+
MEMBERS = %w[id value].freeze
|
|
34
|
+
attr_accessor :id, :value
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def self._exception(scope, name, id, code)
|
|
38
|
+
klass = Class.new(CORBA::UserException)
|
|
39
|
+
scope.const_set(name, klass)
|
|
40
|
+
klass.const_set(:ID, id)
|
|
41
|
+
klass.const_set(:MEMBERS, [].freeze)
|
|
42
|
+
Rustorb::Native::LOCAL_EXCEPTIONS[code] = ->(_) { klass.new }
|
|
43
|
+
klass
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Ruby values as anys of the native layer, and back.
|
|
47
|
+
module Values
|
|
48
|
+
module_function
|
|
49
|
+
|
|
50
|
+
def any(value, tc) = CORBA::Any.to_any(value, tc)._native
|
|
51
|
+
|
|
52
|
+
def value(native) = CORBA::Any._from_native(native).value
|
|
53
|
+
|
|
54
|
+
def any_of(a)
|
|
55
|
+
raise CORBA::BAD_PARAM.new("a CORBA::Any expected, got #{a.inspect}") unless a.is_a?(CORBA::Any)
|
|
56
|
+
|
|
57
|
+
a._native
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
class DynAny
|
|
62
|
+
ID = "IDL:omg.org/DynamicAny/DynAny:1.0"
|
|
63
|
+
|
|
64
|
+
def initialize(native)
|
|
65
|
+
@n = native
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def _n = @n
|
|
69
|
+
|
|
70
|
+
def self._wrap(native)
|
|
71
|
+
native && CLASSES.fetch(native.kind, DynAny).new(native)
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def _is_equivalent(other) = other.is_a?(DynAny) && @n.same(other._n)
|
|
75
|
+
alias _is_equivalent? _is_equivalent
|
|
76
|
+
|
|
77
|
+
def _is_a(id) = self.class.ancestors.any? { |k| k.const_defined?(:ID, false) && k::ID == id }
|
|
78
|
+
alias _is_a? _is_a
|
|
79
|
+
|
|
80
|
+
def type = CORBA::TypeCode._wrap(@n.type)
|
|
81
|
+
def assign(dyn_any) = @n.assign(dyn_any._n)
|
|
82
|
+
def from_any(value) = @n.from_any(Values.any_of(value))
|
|
83
|
+
def to_any = CORBA::Any._from_native(@n.to_any)
|
|
84
|
+
def equal(dyn_any) = @n.equal(dyn_any._n)
|
|
85
|
+
def destroy = @n.destroy
|
|
86
|
+
def copy = DynAny._wrap(@n.copy)
|
|
87
|
+
|
|
88
|
+
def insert_reference(value) = @n.insert(CORBA::TK_OBJREF, Values.any(value, CORBA._tc_Object))
|
|
89
|
+
def get_reference = Values.value(@n.get(CORBA::TK_OBJREF))
|
|
90
|
+
def insert_any(value) = @n.insert(CORBA::TK_ANY, Values.any(value, CORBA._tc_any))
|
|
91
|
+
def get_any = Values.value(@n.get(CORBA::TK_ANY))
|
|
92
|
+
def insert_typecode(value) = @n.insert(CORBA::TK_TYPECODE, Values.any(value, CORBA._tc_TypeCode))
|
|
93
|
+
def get_typecode = Values.value(@n.get(CORBA::TK_TYPECODE))
|
|
94
|
+
def insert_dyn_any(value) = @n.insert_dyn_any(value._n)
|
|
95
|
+
def get_dyn_any = DynAny._wrap(@n.get_dyn_any)
|
|
96
|
+
|
|
97
|
+
def insert_val(value)
|
|
98
|
+
tc = value.respond_to?(:_tc) ? value._tc : CORBA::Any.infer(value)
|
|
99
|
+
@n.insert(CORBA::TK_VALUE, Values.any(value, tc))
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def get_val = Values.value(@n.get(CORBA::TK_VALUE))
|
|
103
|
+
def insert_abstract(_value) = @n.no_implement
|
|
104
|
+
def get_abstract = @n.no_implement
|
|
105
|
+
|
|
106
|
+
def seek(index) = @n.seek(index)
|
|
107
|
+
def rewind = @n.rewind
|
|
108
|
+
def next = @n.next
|
|
109
|
+
def component_count = @n.component_count
|
|
110
|
+
def current_component = DynAny._wrap(@n.current_component)
|
|
111
|
+
|
|
112
|
+
BASIC = {
|
|
113
|
+
"boolean" => :_tc_boolean, "octet" => :_tc_octet, "char" => :_tc_char,
|
|
114
|
+
"short" => :_tc_short, "ushort" => :_tc_ushort, "long" => :_tc_long,
|
|
115
|
+
"ulong" => :_tc_ulong, "float" => :_tc_float, "double" => :_tc_double,
|
|
116
|
+
"longdouble" => :_tc_longdouble, "longlong" => :_tc_longlong,
|
|
117
|
+
"ulonglong" => :_tc_ulonglong, "wchar" => :_tc_wchar
|
|
118
|
+
}.freeze
|
|
119
|
+
|
|
120
|
+
(BASIC.to_a + [%w[string _tc_string], %w[wstring _tc_wstring]]).each do |name, tc_name|
|
|
121
|
+
define_method("insert_#{name}") do |value|
|
|
122
|
+
tc = CORBA.public_send(tc_name)
|
|
123
|
+
@n.insert(tc.kind, Values.any(value, tc))
|
|
124
|
+
end
|
|
125
|
+
define_method("get_#{name}") { Values.value(@n.get(CORBA.public_send(tc_name).kind)) }
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
BASIC.each do |name, tc_name|
|
|
129
|
+
define_method("insert_#{name}_seq") do |value|
|
|
130
|
+
tc = CORBA.public_send(tc_name)
|
|
131
|
+
@n.insert_seq(tc.kind, Values.any(value, CORBA::TypeCode.create_sequence_tc(0, tc)))
|
|
132
|
+
end
|
|
133
|
+
define_method("get_#{name}_seq") { Values.value(@n.get_seq(CORBA.public_send(tc_name).kind)) }
|
|
134
|
+
end
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
DynamicAny._exception(DynAny, :InvalidValue, "IDL:omg.org/DynamicAny/DynAny/InvalidValue:1.0", 17)
|
|
138
|
+
DynamicAny._exception(DynAny, :TypeMismatch, "IDL:omg.org/DynamicAny/DynAny/TypeMismatch:1.0", 18)
|
|
139
|
+
DynamicAny._exception(self, :MustTruncate, "IDL:omg.org/DynamicAny/MustTruncate:1.0", 20)
|
|
140
|
+
|
|
141
|
+
# DynFixed: the value as a String, such as "-12.5".
|
|
142
|
+
class DynFixed < DynAny
|
|
143
|
+
ID = "IDL:omg.org/DynamicAny/DynFixed:1.0"
|
|
144
|
+
|
|
145
|
+
def get_value = @n.get_fixed_value
|
|
146
|
+
def set_value(val) = @n.set_fixed_value(val.is_a?(BigDecimal) ? val.to_s("F") : val.to_s)
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
class DynEnum < DynAny
|
|
150
|
+
ID = "IDL:omg.org/DynamicAny/DynEnum:1.0"
|
|
151
|
+
|
|
152
|
+
def get_as_string = @n.get_as_string
|
|
153
|
+
def set_as_string(value) = @n.set_as_string(value)
|
|
154
|
+
def get_as_ulong = @n.get_as_ulong
|
|
155
|
+
def set_as_ulong(value) = @n.set_as_ulong(value)
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
# The member operations of DynStruct and DynValue.
|
|
159
|
+
module Members
|
|
160
|
+
def current_member_name = @n.current_member_name
|
|
161
|
+
def current_member_kind = @n.current_member_kind
|
|
162
|
+
|
|
163
|
+
def get_members
|
|
164
|
+
Array.new(@n.member_count) do |i|
|
|
165
|
+
name, d = @n.member_at(i)
|
|
166
|
+
NameValuePair.new(name, CORBA::Any._from_native(d.to_any))
|
|
167
|
+
end
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
def set_members(value)
|
|
171
|
+
@n.set_members(value.map(&:id), value.map { |p| Values.any_of(p.value) })
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
def get_members_as_dyn_any
|
|
175
|
+
Array.new(@n.member_count) do |i|
|
|
176
|
+
name, d = @n.member_at(i)
|
|
177
|
+
NameDynAnyPair.new(name, DynAny._wrap(d))
|
|
178
|
+
end
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
def set_members_as_dyn_any(value)
|
|
182
|
+
@n.set_members_as_dyn_any(value.map(&:id), value.map { |p| p.value._n })
|
|
183
|
+
end
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
# For structs and exceptions.
|
|
187
|
+
class DynStruct < DynAny
|
|
188
|
+
ID = "IDL:omg.org/DynamicAny/DynStruct:1.0"
|
|
189
|
+
include Members
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
class DynUnion < DynAny
|
|
193
|
+
ID = "IDL:omg.org/DynamicAny/DynUnion:1.0"
|
|
194
|
+
|
|
195
|
+
def get_discriminator = DynAny._wrap(@n.get_discriminator)
|
|
196
|
+
def set_discriminator(d) = @n.set_discriminator(d._n)
|
|
197
|
+
def set_to_default_member = @n.set_to_default_member
|
|
198
|
+
def set_to_no_active_member = @n.set_to_no_active_member
|
|
199
|
+
def has_no_active_member = @n.has_no_active_member
|
|
200
|
+
def discriminator_kind = @n.discriminator_kind
|
|
201
|
+
def member = DynAny._wrap(@n.member)
|
|
202
|
+
def member_name = @n.member_name
|
|
203
|
+
def member_kind = @n.member_kind
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
# The element operations of DynSequence and DynArray.
|
|
207
|
+
module Elements
|
|
208
|
+
def get_elements = Array.new(@n.element_count) { |i| CORBA::Any._from_native(@n.element_at(i).to_any) }
|
|
209
|
+
def set_elements(value) = @n.set_elements(value.map { |a| Values.any_of(a) })
|
|
210
|
+
def get_elements_as_dyn_any = Array.new(@n.element_count) { |i| DynAny._wrap(@n.element_at(i)) }
|
|
211
|
+
def set_elements_as_dyn_any(value) = @n.set_elements_as_dyn_any(value.map(&:_n))
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
class DynSequence < DynAny
|
|
215
|
+
ID = "IDL:omg.org/DynamicAny/DynSequence:1.0"
|
|
216
|
+
include Elements
|
|
217
|
+
|
|
218
|
+
def get_length = @n.get_length
|
|
219
|
+
def set_length(len) = @n.set_length(len)
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
class DynArray < DynAny
|
|
223
|
+
ID = "IDL:omg.org/DynamicAny/DynArray:1.0"
|
|
224
|
+
include Elements
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
class DynValueCommon < DynAny
|
|
228
|
+
ID = "IDL:omg.org/DynamicAny/DynValueCommon:1.0"
|
|
229
|
+
|
|
230
|
+
def is_null = @n.is_null
|
|
231
|
+
def set_to_null = @n.set_to_null
|
|
232
|
+
def set_to_value = @n.set_to_value
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
# For valuetypes and eventtypes.
|
|
236
|
+
class DynValue < DynValueCommon
|
|
237
|
+
ID = "IDL:omg.org/DynamicAny/DynValue:1.0"
|
|
238
|
+
include Members
|
|
239
|
+
end
|
|
240
|
+
|
|
241
|
+
class DynValueBox < DynValueCommon
|
|
242
|
+
ID = "IDL:omg.org/DynamicAny/DynValueBox:1.0"
|
|
243
|
+
|
|
244
|
+
def get_boxed_value = CORBA::Any._from_native(@n.get_boxed_value)
|
|
245
|
+
def set_boxed_value(boxed) = @n.set_boxed_value(Values.any_of(boxed))
|
|
246
|
+
def get_boxed_value_as_dyn_any = DynAny._wrap(@n.get_boxed_value_as_dyn_any)
|
|
247
|
+
def set_boxed_value_as_dyn_any(boxed) = @n.set_boxed_value_as_dyn_any(boxed._n)
|
|
248
|
+
end
|
|
249
|
+
|
|
250
|
+
DynAny::CLASSES = {
|
|
251
|
+
CORBA::TK_FIXED => DynFixed, CORBA::TK_ENUM => DynEnum, CORBA::TK_STRUCT => DynStruct,
|
|
252
|
+
CORBA::TK_EXCEPT => DynStruct, CORBA::TK_UNION => DynUnion, CORBA::TK_SEQUENCE => DynSequence,
|
|
253
|
+
CORBA::TK_ARRAY => DynArray, CORBA::TK_VALUE => DynValue, CORBA::TK_EVENT => DynValue,
|
|
254
|
+
CORBA::TK_VALUE_BOX => DynValueBox
|
|
255
|
+
}.freeze
|
|
256
|
+
|
|
257
|
+
# The initial reference "DynAnyFactory".
|
|
258
|
+
class DynAnyFactory
|
|
259
|
+
ID = "IDL:omg.org/DynamicAny/DynAnyFactory:1.0"
|
|
260
|
+
|
|
261
|
+
def self.instance = @instance ||= new
|
|
262
|
+
|
|
263
|
+
def _is_a(id) = id == ID
|
|
264
|
+
alias _is_a? _is_a
|
|
265
|
+
|
|
266
|
+
def _non_existent = false
|
|
267
|
+
alias _non_existent? _non_existent
|
|
268
|
+
|
|
269
|
+
def create_dyn_any(value) = DynAny._wrap(Rustorb::Native::DynAny.create(Values.any_of(value), true))
|
|
270
|
+
def create_dyn_any_from_type_code(type) = DynAny._wrap(Rustorb::Native::DynAny.from_type_code(type.resolve.native))
|
|
271
|
+
|
|
272
|
+
def create_dyn_any_without_truncation(value)
|
|
273
|
+
DynAny._wrap(Rustorb::Native::DynAny.create(Values.any_of(value), false))
|
|
274
|
+
end
|
|
275
|
+
|
|
276
|
+
def create_multiple_dyn_anys(values, allow_truncate)
|
|
277
|
+
values.map { |v| DynAny._wrap(Rustorb::Native::DynAny.create(Values.any_of(v), allow_truncate)) }
|
|
278
|
+
end
|
|
279
|
+
|
|
280
|
+
def create_multiple_anys(values) = values.map(&:to_any)
|
|
281
|
+
end
|
|
282
|
+
|
|
283
|
+
DynamicAny._exception(DynAnyFactory, :InconsistentTypeCode,
|
|
284
|
+
"IDL:omg.org/DynamicAny/DynAnyFactory/InconsistentTypeCode:1.0", 19)
|
|
285
|
+
end
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# CORBA exceptions (RCLM): CORBA::Exception, the system exceptions with
|
|
4
|
+
# their minor code and completion status, CORBA::UserException, and the
|
|
5
|
+
# exceptions of the local interfaces (ORB, TypeCode, POA, POAManager,
|
|
6
|
+
# Current), which the native extension raises through system_exception
|
|
7
|
+
# and local_exception below.
|
|
8
|
+
#
|
|
9
|
+
# Licensed under MIT OR Apache-2.0, like the rest of the rustorb core.
|
|
10
|
+
|
|
11
|
+
module CORBA
|
|
12
|
+
COMPLETED_YES = 0
|
|
13
|
+
COMPLETED_NO = 1
|
|
14
|
+
COMPLETED_MAYBE = 2
|
|
15
|
+
|
|
16
|
+
class Exception < StandardError
|
|
17
|
+
def self._id
|
|
18
|
+
self::ID
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def _id
|
|
22
|
+
self.class._id
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
class SystemException < CORBA::Exception
|
|
27
|
+
attr_reader :minor, :completed
|
|
28
|
+
|
|
29
|
+
def initialize(reason = "", minor = 0, completed = CORBA::COMPLETED_NO)
|
|
30
|
+
@reason = reason.to_s
|
|
31
|
+
@minor = minor
|
|
32
|
+
@completed = completed
|
|
33
|
+
super(message_text)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def message_text
|
|
37
|
+
done = %w[COMPLETED_YES COMPLETED_NO COMPLETED_MAYBE][@completed] || @completed.to_s
|
|
38
|
+
text = format("%s (minor 0x%x, %s)", self.class.name.sub("CORBA::", ""), @minor, done)
|
|
39
|
+
@reason.empty? ? text : "#{text}: #{@reason}"
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def ==(other)
|
|
43
|
+
other.class == self.class && other.minor == @minor && other.completed == @completed
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
SYSTEM_EXCEPTIONS = {}
|
|
48
|
+
|
|
49
|
+
%w[UNKNOWN BAD_PARAM NO_MEMORY IMP_LIMIT COMM_FAILURE INV_OBJREF NO_PERMISSION INTERNAL
|
|
50
|
+
MARSHAL INITIALIZE NO_IMPLEMENT BAD_TYPECODE BAD_OPERATION NO_RESOURCES NO_RESPONSE
|
|
51
|
+
PERSIST_STORE BAD_INV_ORDER TRANSIENT FREE_MEM INV_IDENT INV_FLAG INTF_REPOS BAD_CONTEXT
|
|
52
|
+
OBJ_ADAPTER DATA_CONVERSION OBJECT_NOT_EXIST TRANSACTION_REQUIRED TRANSACTION_ROLLEDBACK
|
|
53
|
+
INVALID_TRANSACTION INV_POLICY CODESET_INCOMPATIBLE REBIND TIMEOUT TRANSACTION_UNAVAILABLE
|
|
54
|
+
TRANSACTION_MODE BAD_QOS INVALID_ACTIVITY ACTIVITY_COMPLETED ACTIVITY_REQUIRED
|
|
55
|
+
THREAD_CANCELLED].each do |name|
|
|
56
|
+
klass = Class.new(SystemException)
|
|
57
|
+
klass.const_set(:ID, "IDL:omg.org/CORBA/#{name}:1.0")
|
|
58
|
+
const_set(name, klass)
|
|
59
|
+
SYSTEM_EXCEPTIONS[klass::ID] = klass
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# A user exception: generated classes derive from it, with attr_accessor
|
|
63
|
+
# members and a positional initialize.
|
|
64
|
+
class UserException < CORBA::Exception
|
|
65
|
+
def initialize(*args)
|
|
66
|
+
super(self.class.name.to_s)
|
|
67
|
+
self.class::MEMBERS.each_with_index { |m, i| instance_variable_set("@#{m}", args[i]) }
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def _values
|
|
71
|
+
self.class::MEMBERS.map { |m| instance_variable_get("@#{m}") }
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def ==(other)
|
|
75
|
+
other.class == self.class && other._values == _values
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# PolicyError (the reason is a PolicyErrorCode).
|
|
80
|
+
BAD_POLICY = 0
|
|
81
|
+
UNSUPPORTED_POLICY = 1
|
|
82
|
+
BAD_POLICY_TYPE = 2
|
|
83
|
+
BAD_POLICY_VALUE = 3
|
|
84
|
+
UNSUPPORTED_POLICY_VALUE = 4
|
|
85
|
+
|
|
86
|
+
class PolicyError < UserException
|
|
87
|
+
ID = "IDL:omg.org/CORBA/PolicyError:1.0"
|
|
88
|
+
MEMBERS = %w[reason].freeze
|
|
89
|
+
attr_accessor :reason
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
module Rustorb
|
|
94
|
+
module Native
|
|
95
|
+
# Called by the extension: the exception object to raise for a system
|
|
96
|
+
# exception.
|
|
97
|
+
def self.system_exception(id, minor, completed)
|
|
98
|
+
klass = CORBA::SYSTEM_EXCEPTIONS[id] || CORBA::UNKNOWN
|
|
99
|
+
klass.new("", minor, completed)
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
# rorb_exception.local codes, filled in as the classes are defined.
|
|
103
|
+
LOCAL_EXCEPTIONS = {}
|
|
104
|
+
|
|
105
|
+
def self.local_exception(code, index)
|
|
106
|
+
maker = LOCAL_EXCEPTIONS[code]
|
|
107
|
+
return CORBA::INTERNAL.new("local exception #{code}") unless maker
|
|
108
|
+
|
|
109
|
+
maker.call(index)
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
end
|