class AutoC::HashMap::HashSet

Public Class Methods

new(*args, **kws) click to toggle source
Calls superclass method
# File lib/autoc/hash_map.rb, line 195
def initialize(*args, **kws)
  super
  _map = _master # this set is a subcomponent of the map
  @_index = _map.index
end

Public Instance Methods

_slot_class(= HashMap::List) click to toggle source
# File lib/autoc/hash_map.rb, line 191
  def _slot_class = HashMap::List

  attr_reader :_index

  def initialize(*args, **kws)
    super
    _map = _master # this set is a subcomponent of the map
    @_index = _map.index
  end

private

  def configure
    super
    method(_slot.const_lvalue, :_find_index_slot, { target: const_rvalue, index: _index.const_rvalue }, visibility: :internal).configure do
      # Find slot based on the index hash code only bypassing element
      dependencies << _find_slot
      inline_code _find_slot_hash(_index.hash_code.(index))
    end
    method(element.lvalue, :_find_index_node, { target: const_rvalue, index: _index.const_rvalue }, visibility: :internal).configure do
      code %{
        #{_slot._node_p} curr;
        #{_slot._node_p} prev;
        #{_slot.const_lvalue} s = #{_find_index_slot.(target, index)};
        return #{_slot._find_index_node.('*s', index, :prev, :curr)} ? &curr->element : NULL;
      }
    end
    method(:int, :_remove_index_node, { target: rvalue, index: _index.const_rvalue }, visibility: :internal).configure do
      code %{
        int c;
        #{_slot.lvalue} s = (#{_slot.lvalue})#{_find_index_slot.(target, index)};
        c = #{_slot._remove_index_node.('*s', index)};
        if(c) --target->size;
        return c;
      }
    end
  end

end
configure() click to toggle source
Calls superclass method
# File lib/autoc/hash_map.rb, line 203
def configure
  super
  method(_slot.const_lvalue, :_find_index_slot, { target: const_rvalue, index: _index.const_rvalue }, visibility: :internal).configure do
    # Find slot based on the index hash code only bypassing element
    dependencies << _find_slot
    inline_code _find_slot_hash(_index.hash_code.(index))
  end
  method(element.lvalue, :_find_index_node, { target: const_rvalue, index: _index.const_rvalue }, visibility: :internal).configure do
    code %{
      #{_slot._node_p} curr;
      #{_slot._node_p} prev;
      #{_slot.const_lvalue} s = #{_find_index_slot.(target, index)};
      return #{_slot._find_index_node.('*s', index, :prev, :curr)} ? &curr->element : NULL;
    }
  end
  method(:int, :_remove_index_node, { target: rvalue, index: _index.const_rvalue }, visibility: :internal).configure do
    code %{
      int c;
      #{_slot.lvalue} s = (#{_slot.lvalue})#{_find_index_slot.(target, index)};
      c = #{_slot._remove_index_node.('*s', index)};
      if(c) --target->size;
      return c;
    }
  end
end