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, ULong, ULongLong, UShort

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.



350
351
352
# File 'lib/ridl/type.rb', line 350

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

Instance Attribute Details

#sizeObject (readonly)

Returns the value of attribute size.



347
348
349
# File 'lib/ridl/type.rb', line 347

def size
  @size
end

Instance Method Details

#instantiate(_context) ⇒ Object



369
370
371
# File 'lib/ridl/type.rb', line 369

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

#is_anonymous?Boolean

Returns:



363
364
365
# File 'lib/ridl/type.rb', line 363

def is_anonymous?
  @size ? true : false
end

#is_template?Boolean

Returns:



366
367
368
# File 'lib/ridl/type.rb', line 366

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

#lengthObject



348
# File 'lib/ridl/type.rb', line 348

def length; @size; end

#narrow(obj) ⇒ Object



353
354
355
356
357
358
359
360
361
362
# File 'lib/ridl/type.rb', line 353

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