Class: R2CORBA::CORBA::TypeCode::Array
- Inherits:
-
R2CORBA::CORBA::TypeCode
- Object
- R2CORBA::CORBA::TypeCode
- R2CORBA::CORBA::TypeCode::Array
- Defined in:
- lib/corba/cbase/Typecode.rb,
lib/corba/jbase/Typecode.rb,
lib/corba/common/Typecode.rb
Constant Summary
Constants inherited from R2CORBA::CORBA::TypeCode
LongLongRange, LongRange, OctetRange, ShortRange, ULongLongRange, ULongRange, UShortRange
Instance Attribute Summary
Attributes inherited from R2CORBA::CORBA::TypeCode
Instance Method Summary collapse
- #get_type ⇒ Object
-
#initialize(*args) ⇒ Array
constructor
A new instance of Array.
- #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) ⇒ Array
Returns a new instance of Array.
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/corba/cbase/Typecode.rb', line 103 def initialize(*args) if CORBA::Native::TypeCode === args.first @tc_ = args.first else content_tc = args.shift length = args raise ArgumentError, 'expected CORBA::TypeCode' unless content_tc.is_a?(CORBA::TypeCode) if length.size > 1 this_len = length.shift content_tc = self.class.new(content_tc, *length) else this_len = length.first end begin @tc_ = CORBA::Native::TypeCode.create_tc(TK_ARRAY, this_len.to_i, content_tc.tc_) rescue ::NativeException CORBA::Exception.native2r($!) end end end |
Instance Method Details
#get_type ⇒ Object
583 584 585 |
# File 'lib/corba/common/Typecode.rb', line 583 def get_type ::Array end |
#needs_conversion(val) ⇒ Object
600 601 602 |
# File 'lib/corba/common/Typecode.rb', line 600 def needs_conversion(val) val.any? { |e| self.content_type.needs_conversion(e) } end |
#validate(val) ⇒ Object
587 588 589 590 591 592 593 594 595 596 597 598 |
# File 'lib/corba/common/Typecode.rb', line 587 def validate(val) return val if val.nil? super(val) raise ::CORBA::MARSHAL.new( "array size exceeds bound: #{self.length.to_s}", 1, ::CORBA::COMPLETED_NO) unless val.nil? || val.size <= self.length raise ::CORBA::MARSHAL.new( "array size too small: #{self.length.to_s}", 1, ::CORBA::COMPLETED_NO) unless val.nil? || val.size >= self.length val.any? { |e| self.content_type.needs_conversion(e) } ? val.collect { |e| self.content_type.validate(e) } : val.each { |e| self.content_type.validate(e) } end |