Class: Hwloc::Distances
- Inherits:
-
Struct
- Object
- FFI::Struct
- Struct
- Hwloc::Distances
show all
- Defined in:
- lib/hwloc/Obj.rb,
lib/hwloc/Obj.rb
Instance Attribute Summary
Attributes inherited from Struct
#topology
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Struct
#[], #method_missing
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Hwloc::Struct
Class Method Details
.release(ptr) ⇒ Object
168
169
170
|
# File 'lib/hwloc/Obj.rb', line 168
def self.release(ptr)
Hwloc.hwloc_distances_release(@topology.ptr, ptr)
end
|
Instance Method Details
#kind ⇒ Object
158
159
160
|
# File 'lib/hwloc/Obj.rb', line 158
def kind
self[:kind]
end
|
#obj_index(obj) ⇒ Object
172
173
174
175
176
|
# File 'lib/hwloc/Obj.rb', line 172
def obj_index(obj)
arity = self[:nbobjs]
return nil if arity == 0
self[:objs].read_array_of_pointer(arity).index(obj.to_ptr)
end
|
#obj_pair_values(obj1, obj2) ⇒ Object
178
179
180
181
182
183
184
|
# File 'lib/hwloc/Obj.rb', line 178
def obj_pair_values(obj1, obj2)
i1 = obj_index(obj1)
i2 = obj_index(obj2)
return nil unless i1 && i2
v = values
return [v[i1][i2], v[i2][i1]]
end
|
#objs ⇒ Object
148
149
150
151
152
153
154
155
156
|
# File 'lib/hwloc/Obj.rb', line 148
def objs
arity = self[:nbobjs]
return [] if arity == 0
return self[:objs].read_array_of_pointer(arity).collect { |p|
c = Obj::new(p)
c.instance_variable_set(:@topology, @topology)
c
}
end
|
#values ⇒ Object
162
163
164
165
166
|
# File 'lib/hwloc/Obj.rb', line 162
def values
arity = self[:nbobjs]
return [] if arity == 0
return self[:values].read_array_of_uint64(arity*arity).each_slice(arity).to_a
end
|