Class: R2CORBA::CORBA::TypeCode::Valuebox
- Inherits:
-
IdentifiedTypeCode
- Object
- R2CORBA::CORBA::TypeCode
- IdentifiedTypeCode
- R2CORBA::CORBA::TypeCode::Valuebox
- Defined in:
- lib/corba/cbase/Typecode.rb,
lib/corba/jbase/Typecode.rb,
lib/corba/common/Typecode.rb
Overview
Eventtype
Constant Summary
Constants inherited from R2CORBA::CORBA::TypeCode
LongLongRange, LongRange, OctetRange, ShortRange, ULongLongRange, ULongRange, UShortRange
Instance Attribute Summary
Attributes inherited from R2CORBA::CORBA::TypeCode
Class Method Summary collapse
Instance Method Summary collapse
- #get_type ⇒ Object
-
#initialize(*args) ⇒ Valuebox
constructor
A new instance of Valuebox.
- #needs_conversion(val) ⇒ Object
- #validate(val) ⇒ Object
Methods inherited from R2CORBA::CORBA::TypeCode
_tc, _wrap_native, #concrete_base_type, #content_type, #default_index, #discriminator_type, #equal?, #equivalent?, #fixed_digits, #fixed_scale, from_native, #get_compact_typecode, get_primitive_tc, #id, #is_recursive_tc?, #kind, #length, #member_count, #member_label, #member_name, #member_type, #member_visibility, #name, native_kind, register_id_type, #resolved_tc, #type_modifier, typecode_for_id, typecodes_for_name
Constructor Details
#initialize(*args) ⇒ Valuebox
Returns a new instance of Valuebox.
213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 |
# File 'lib/corba/cbase/Typecode.rb', line 213 def initialize(*args) if CORBA::Native::TypeCode === args.first @tc_ = args.first @type = nil super(@tc_.id) else id, name, boxed_tc, type = args raise ArgumentError, 'expected CORBA::TypeCode' unless boxed_tc.is_a?(CORBA::TypeCode) begin @tc_ = CORBA::Native::TypeCode.create_tc(TK_VALUE_BOX, id.to_s, name.to_s, boxed_tc.tc_) rescue ::NativeException CORBA::Exception.native2r($!) end @type = type super(id) ## autoregister CORBA::ORB._check_value_factory(@type::Factory) if @type < CORBA::Portable::BoxedValueBase end end |
Class Method Details
.define_type(tc) ⇒ Object
728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 |
# File 'lib/corba/common/Typecode.rb', line 728 def Valuebox.define_type(tc) code = %Q{ class #{tc.name} < ::CORBA::Portable::BoxedValueBase def self._tc @@tc_#{tc.name} ||= TypeCode.typecode_for_id('#{tc.id}') end attr_accessor :value def initialize(val) @value = val end end #{tc.name} } ::Object.module_eval(code) end |
Instance Method Details
#get_type ⇒ Object
744 745 746 |
# File 'lib/corba/common/Typecode.rb', line 744 def get_type @type || CORBA::TypeCode::Valuebox.define_type(self) end |
#needs_conversion(val) ⇒ Object
760 761 762 763 764 765 766 767 768 |
# File 'lib/corba/common/Typecode.rb', line 760 def needs_conversion(val) return false if val.nil? if CORBA::Portable::BoxedValueBase === val self.content_type.needs_conversion(val.value) else self.content_type.needs_conversion(val) end end |
#validate(val) ⇒ Object
748 749 750 751 752 753 754 755 756 757 758 |
# File 'lib/corba/common/Typecode.rb', line 748 def validate(val) return val if val.nil? if CORBA::Portable::BoxedValueBase === val super(val) val.value = self.content_type.validate(val.value) else val = self.content_type.validate(val) end val end |