Class: IDL::Type::Integer
Constant Summary
Constants inherited
from IDL::Type
Long, LongLong, Octet, Short, TinyShort, ULong, ULongLong, UShort, UTinyShort
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from IDL::Type
#instantiate, #is_anonymous?, #is_complete?, #is_local?, #is_node?, #is_template?, #matches?, #resolved_node, #resolved_type, #typeerror, #typename
Class Method Details
155
156
157
|
# File 'lib/ridl/type.rb', line 155
def self.bits
self::BITS
end
|
.is_unsigned? ⇒ Boolean
151
152
153
|
# File 'lib/ridl/type.rb', line 151
def self.is_unsigned?
self::Range.first.zero?
end
|
.newclass(range, bits) ⇒ Object
183
184
185
186
187
188
|
# File 'lib/ridl/type.rb', line 183
def Integer.newclass(range, bits)
k = Class.new(self)
k.const_set('Range', range)
k.const_set('BITS', bits)
k
end
|
Instance Method Details
179
180
181
|
# File 'lib/ridl/type.rb', line 179
def default
0
end
|
#in_range?(val) ⇒ Boolean
171
172
173
|
# File 'lib/ridl/type.rb', line 171
def in_range?(val)
val >= self.min && val <= self.max
end
|
167
168
169
|
# File 'lib/ridl/type.rb', line 167
def max
self.class::Range.last
end
|
163
164
165
|
# File 'lib/ridl/type.rb', line 163
def min
self.class::Range.first
end
|
#narrow(obj) ⇒ Object
145
146
147
148
149
|
# File 'lib/ridl/type.rb', line 145
def narrow(obj)
typeerror(obj) unless ::Integer === obj
typeerror(obj) unless self.class::Range === obj
obj
end
|
#next(val) ⇒ Object
175
176
177
|
# File 'lib/ridl/type.rb', line 175
def next(val)
val < self.max ? val + 1 : self.min
end
|
#range_length ⇒ Object
159
160
161
|
# File 'lib/ridl/type.rb', line 159
def range_length
1 + (self.class::Range.last - self.class::Range.first)
end
|