Class: IDL::Type::BitMask

Inherits:
NodeType 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

Attributes inherited from NodeType

#node

Instance Method Summary collapse

Methods inherited from NodeType

#initialize, #is_local?, #is_node?, #matches?, #resolved_node

Methods inherited from IDL::Type

#instantiate, #is_anonymous?, #is_complete?, #is_local?, #is_node?, #is_template?, #matches?, #resolved_node, #resolved_type, #typeerror, #typename

Constructor Details

This class inherits a constructor from IDL::Type::NodeType

Instance Method Details

#in_range?(val) ⇒ Boolean

Returns:



677
678
679
# File 'lib/ridl/type.rb', line 677

def in_range?(val)
  val >= self.min && val <= self.max
end

#maxObject



673
674
675
# File 'lib/ridl/type.rb', line 673

def max
  @node.bitvalues.length - 1
end

#minObject



669
670
671
# File 'lib/ridl/type.rb', line 669

def min
  0
end

#narrow(obj) ⇒ Object



659
660
661
662
663
# File 'lib/ridl/type.rb', line 659

def narrow(obj)
  typeerror(obj) unless ::Integer === obj
  typeerror(obj) unless (0...@node.bitvalues.length) === obj
  obj
end

#next(val) ⇒ Object



681
682
683
# File 'lib/ridl/type.rb', line 681

def next(val)
  val < self.max ? val + 1 : self.min
end

#range_lengthObject



665
666
667
# File 'lib/ridl/type.rb', line 665

def range_length
  @node.bitvalues.length
end