Class: IDL::Type::Fixed

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(digits = nil, scale = nil) ⇒ Fixed

Returns a new instance of Fixed.

Raises:

  • (RuntimeError)


219
220
221
222
223
# File 'lib/ridl/type.rb', line 219

def initialize(digits=nil, scale=nil)
  raise RuntimeError, "significant digits for Fixed should be in the range 0-31" unless digits.nil? || (0..31) === digits.to_i
  @digits = digits.nil? ? digits : digits.to_i
  @scale = scale.nil? ? scale : scale.to_i
end

Instance Attribute Details

#digitsObject (readonly)

Returns the value of attribute digits.



218
219
220
# File 'lib/ridl/type.rb', line 218

def digits
  @digits
end

#scaleObject (readonly)

Returns the value of attribute scale.



218
219
220
# File 'lib/ridl/type.rb', line 218

def scale
  @scale
end

Instance Method Details

#instantiate(_context) ⇒ Object



234
235
236
# File 'lib/ridl/type.rb', line 234

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

#is_anonymous?Boolean

Returns:



228
229
230
# File 'lib/ridl/type.rb', line 228

def is_anonymous?
  false
end

#is_template?Boolean

Returns:



231
232
233
# File 'lib/ridl/type.rb', line 231

def is_template?
  (@size && @size.is_a?(IDL::Expression) && @size.is_template?)
end

#narrow(obj) ⇒ Object



224
225
226
227
# File 'lib/ridl/type.rb', line 224

def narrow(obj)
  #typeerror(obj)
  obj
end