class IDL::Type::Sequence

Attributes

basetype[R]
recursive[RW]
size[R]

Public Class Methods

new(t, size) click to toggle source
# File lib/ridl/type.rb, line 335
def initialize(t, size)
  raise "Anonymous type definitions are not allowed!" if t.is_anonymous?

  @basetype = t
  @size = size
  @typename = format("sequence<%s%s>", t.typename,
                     if @size.nil? then
                        ""
                     else
                        ", #{IDL::Expression::ScopedName === size ? size.node.name : size.to_s}"
                     end)
  @recursive = false
end

Public Instance Methods

instantiate(instantiation_context) click to toggle source
# File lib/ridl/type.rb, line 381
def instantiate(instantiation_context)
  if self.is_template?
    Type::Sequence.new(@basetype.instantiate(instantiation_context), @size ? @size.instantiate(instantiation_context).value : nil)
  else
    self
  end
end
is_anonymous?() click to toggle source
# File lib/ridl/type.rb, line 369
def is_anonymous?
  true
end
is_complete?() click to toggle source
# File lib/ridl/type.rb, line 357
def is_complete?
  @basetype.resolved_type.is_complete?
end
is_local?(recurstk = []) click to toggle source
# File lib/ridl/type.rb, line 361
def is_local?(recurstk = [])
  @basetype.resolved_type.is_local?(recurstk)
end
is_recursive?() click to toggle source
# File lib/ridl/type.rb, line 365
def is_recursive?
  @recursive
end
is_template?() click to toggle source
# File lib/ridl/type.rb, line 373
def is_template?
  (@size && @size.is_a?(IDL::Expression::ScopedName) && @size.node.is_a?(IDL::AST::TemplateParam)) || @basetype.is_template?
end
length() click to toggle source
# File lib/ridl/type.rb, line 331
def length
  @size
end
matches?(idltype) click to toggle source
Calls superclass method IDL::Type#matches?
# File lib/ridl/type.rb, line 377
def matches?(idltype)
  super && self.size == idltype.size && self.basetype.resolved_type.matches?(idltype.basetype.resolved_type)
end
narrow(obj) click to toggle source
# File lib/ridl/type.rb, line 353
def narrow(obj)
  typeerror(obj)
end
typename() click to toggle source
# File lib/ridl/type.rb, line 349
def typename
  @typename
end