class AutoC::HashSet::Range

Public Instance Methods

_bin(= iterable._bin.range) click to toggle source
# File lib/autoc/hash_set.rb, line 274
  def _bin = iterable._bin.range

private

  def configure
    super
    method(:void, :_advance, { range: rvalue }, visibility: :internal ).configure do
      code %{
        assert(range);
        while(1) {
          if(#{_slot.empty.('range->slot')}) {
            /* current slot's range is empty - iterate forward to the next one */
            #{_bin.pop_front.('range->bin')};
            if(#{_bin.empty.('range->bin')}) {
              /* all bin are iterated through, slot range is also empty - end of set */
              break;
            } else {
              /* advance to the new (possibly empty) slot */
              #{iterable._slot.const_lvalue} b = #{_bin.view_front.('range->bin')};
              range->slot = #{_slot.new.('*b')};
            }
          } else {
            /* current slot's range is not empty - no need to proceed */
            break;
          }
        }
      }
    end
    custom_create.configure do
      code %{
        #{_iterable._slot.const_lvalue} s;
        assert(range);
        assert(iterable);
        range->bin = #{_bin.new.('iterable->bin')};
        /* get the first slot's range regardless of its emptiness status */
        s = #{_bin.view_front.('range->bin')};
        range->slot = #{_slot.new.('*s')};
        /* actually advance to the first non-empty slot */
        #{_advance.(range)};
      }
    end
    empty.configure do
      code %{
        assert(range);
        return #{_slot.empty.('range->slot')};
      }
    end
    pop_front.configure do
      code %{
        assert(range);
        #{_slot.pop_front.('range->slot')};
        #{_advance.(range)};
      }
    end
    view_front.configure do
      code %{
        assert(range);
        assert(!#{empty.(range)});
        return #{_slot.view_front.('range->slot')};
      }
    end
  end

end
_slot(= iterable._slot.range) click to toggle source
# File lib/autoc/hash_set.rb, line 272
    def _slot = iterable._slot.range

    def _bin = iterable._bin.range

  private

    def configure
      super
      method(:void, :_advance, { range: rvalue }, visibility: :internal ).configure do
        code %{
          assert(range);
          while(1) {
            if(#{_slot.empty.('range->slot')}) {
              /* current slot's range is empty - iterate forward to the next one */
              #{_bin.pop_front.('range->bin')};
              if(#{_bin.empty.('range->bin')}) {
                /* all bin are iterated through, slot range is also empty - end of set */
                break;
              } else {
                /* advance to the new (possibly empty) slot */
                #{iterable._slot.const_lvalue} b = #{_bin.view_front.('range->bin')};
                range->slot = #{_slot.new.('*b')};
              }
            } else {
              /* current slot's range is not empty - no need to proceed */
              break;
            }
          }
        }
      end
      custom_create.configure do
        code %{
          #{_iterable._slot.const_lvalue} s;
          assert(range);
          assert(iterable);
          range->bin = #{_bin.new.('iterable->bin')};
          /* get the first slot's range regardless of its emptiness status */
          s = #{_bin.view_front.('range->bin')};
          range->slot = #{_slot.new.('*s')};
          /* actually advance to the first non-empty slot */
          #{_advance.(range)};
        }
      end
      empty.configure do
        code %{
          assert(range);
          return #{_slot.empty.('range->slot')};
        }
      end
      pop_front.configure do
        code %{
          assert(range);
          #{_slot.pop_front.('range->slot')};
          #{_advance.(range)};
        }
      end
      view_front.configure do
        code %{
          assert(range);
          assert(!#{empty.(range)});
          return #{_slot.view_front.('range->slot')};
        }
      end
    end

  end # Range


end
configure() click to toggle source
Calls superclass method
# File lib/autoc/hash_set.rb, line 278
def configure
  super
  method(:void, :_advance, { range: rvalue }, visibility: :internal ).configure do
    code %{
      assert(range);
      while(1) {
        if(#{_slot.empty.('range->slot')}) {
          /* current slot's range is empty - iterate forward to the next one */
          #{_bin.pop_front.('range->bin')};
          if(#{_bin.empty.('range->bin')}) {
            /* all bin are iterated through, slot range is also empty - end of set */
            break;
          } else {
            /* advance to the new (possibly empty) slot */
            #{iterable._slot.const_lvalue} b = #{_bin.view_front.('range->bin')};
            range->slot = #{_slot.new.('*b')};
          }
        } else {
          /* current slot's range is not empty - no need to proceed */
          break;
        }
      }
    }
  end
  custom_create.configure do
    code %{
      #{_iterable._slot.const_lvalue} s;
      assert(range);
      assert(iterable);
      range->bin = #{_bin.new.('iterable->bin')};
      /* get the first slot's range regardless of its emptiness status */
      s = #{_bin.view_front.('range->bin')};
      range->slot = #{_slot.new.('*s')};
      /* actually advance to the first non-empty slot */
      #{_advance.(range)};
    }
  end
  empty.configure do
    code %{
      assert(range);
      return #{_slot.empty.('range->slot')};
    }
  end
  pop_front.configure do
    code %{
      assert(range);
      #{_slot.pop_front.('range->slot')};
      #{_advance.(range)};
    }
  end
  view_front.configure do
    code %{
      assert(range);
      assert(!#{empty.(range)});
      return #{_slot.view_front.('range->slot')};
    }
  end
end
render_interface(stream) click to toggle source
# File lib/autoc/hash_set.rb, line 251
def render_interface(stream)
  if public?
    render_type_description(stream)
    stream << %{
      /**
        #{ingroup}
        @brief Opaque structure holding state of the hash set's range
        @since 2.0
      */
    }
  else
    stream << PRIVATE
  end
  stream << %{
    typedef struct {
      #{_bin} bin; /**< @private */
      #{_slot} slot; /**< @private */
    } #{signature};
  }
end