class RbBCC::ArrayTable
Public Class Methods
new(bpf, map_id, map_fd, keytype, leaftype, name: nil)
click to toggle source
Calls superclass method
RbBCC::TableBase::new
# File lib/rbbcc/table.rb, line 235 def initialize(bpf, map_id, map_fd, keytype, leaftype, name: nil) super @max_entries = Clib.bpf_table_max_entries_id(bpf.module, map_id) end
Public Instance Methods
clearitem(key)
click to toggle source
# File lib/rbbcc/table.rb, line 246 def clearitem(key) self[key] = byref(0, @leafsize) end
delete(key)
click to toggle source
# File lib/rbbcc/table.rb, line 250 def delete(key) # Delete in Array type does not have an effect, so zero out instead clearitem(key) end
each(&b)
click to toggle source
# File lib/rbbcc/table.rb, line 255 def each(&b) each_value do |v| b.call(v.to_bcc_value) end end
size()
click to toggle source
We now emulate the Array class of Ruby
# File lib/rbbcc/table.rb, line 241 def size @max_entries end
Also aliased as: length