IndexedOrderedSetLib

library IndexedOrderedSetLib
Title:Library implementing an array type which allows O(1) lookups on values.
Author:Piper Merriam <pipermerriam@gmail.com>
modifier requireValue(IndexedOrderedSet storage self, bytes32 value)
function size(IndexedOrderedSet storage self)
public
view
returns (uint)

Returns the size of the set

Parameters:
  • self – The set
function contains(IndexedOrderedSet storage self, bytes32 value)
public
view
returns (bool)

Returns boolean if the key is in the set

Parameters:
  • self – The set
  • value – The value to check
function indexOf(IndexedOrderedSet storage self, bytes32 value)
public
view
 requireValue(self, value)
returns (uint)

Returns the index of the value in the set.

Parameters:
  • self – The set
  • value – The value to look up the index for.
function pop(IndexedOrderedSet storage self, uint idx)
public
returns (bytes32)

Removes the element at index idx from the set and returns it.

Parameters:
  • self – The set
  • idx – The index to remove and return.
function remove(IndexedOrderedSet storage self, bytes32 value)
public
 requireValue(self, value)
returns (bool)

Removes the element at index idx from the set

Parameters:
  • self – The set
  • value – The value to remove from the set.
function get(IndexedOrderedSet storage self, uint idx)
public
view
returns (bytes32)

Retrieves the element at the provided index.

Parameters:
  • self – The set
  • idx – The index to retrieve.
function add(IndexedOrderedSet storage self, bytes32 value)
public
returns (bool)

Pushes the new value onto the set

Parameters:
  • self – The set
  • value – The value to push.