class Hwloc::Distances

Public Class Methods

release(ptr) click to toggle source
# File lib/hwloc/Obj.rb, line 168
def self.release(ptr)
  Hwloc.hwloc_distances_release(@topology.ptr, ptr)
end

Public Instance Methods

kind() click to toggle source
# File lib/hwloc/Obj.rb, line 158
def kind
  self[:kind]
end
obj_index(obj) click to toggle source
# 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) click to toggle source
# 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() click to toggle source
# 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() click to toggle source
# 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