Class: IDL::Type::WString

Inherits:
IDL::Type show all
Defined in:
lib/ridl/type.rb

Constant Summary

Constants inherited from IDL::Type

Long, LongLong, Octet, Short, TinyShort, ULong, ULongLong, UShort, UTinyShort

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from IDL::Type

#is_complete?, #is_local?, #is_node?, #resolved_node, #resolved_type, #typeerror, #typename

Constructor Details

#initialize(size = nil) ⇒ WString

Returns a new instance of WString.



521
522
523
# File 'lib/ridl/type.rb', line 521

def initialize(size = nil)
  @size = size
end

Instance Attribute Details

#sizeObject (readonly)

Returns the value of attribute size.



515
516
517
# File 'lib/ridl/type.rb', line 515

def size
  @size
end

Instance Method Details

#instantiate(instantiation_context) ⇒ Object



548
549
550
# File 'lib/ridl/type.rb', line 548

def instantiate(instantiation_context)
  self.is_template? ? Type::WString.new(@size.instantiate(instantiation_context).value) : self
end

#is_anonymous?Boolean

Returns:



536
537
538
# File 'lib/ridl/type.rb', line 536

def is_anonymous?
  @size ? true : false
end

#is_template?Boolean

Returns:



540
541
542
# File 'lib/ridl/type.rb', line 540

def is_template?
  (@size && @size.is_a?(IDL::Expression::ScopedName) && @size.node.is_a?(IDL::AST::TemplateParam))
end

#lengthObject



517
518
519
# File 'lib/ridl/type.rb', line 517

def length
  @size
end

#matches?(idltype) ⇒ Boolean

Returns:



544
545
546
# File 'lib/ridl/type.rb', line 544

def matches?(idltype)
  super && self.size == idltype.size
end

#narrow(obj) ⇒ Object



525
526
527
528
529
530
531
532
533
534
# File 'lib/ridl/type.rb', line 525

def narrow(obj)
  typeerror(obj) unless ::Array === obj
  if @size.nil?
    obj
  elsif @size < obj.size
    typeerror(obj)
  else
    obj
  end
end