GY-63_MS5611/libraries/Set
2021-05-28 13:17:38 +02:00
..
.github/workflows add arduino-lint 2021-05-28 13:17:38 +02:00
examples update SET 0.2.3 2021-05-05 13:46:09 +02:00
test add Set 0.2.4 2021-05-08 09:51:40 +02:00
.arduino-ci.yml 2021-01-29 2021-01-29 12:31:58 +01:00
keywords.txt add Set 0.2.4 2021-05-08 09:51:40 +02:00
library.json add Set 0.2.4 2021-05-08 09:51:40 +02:00
library.properties add Set 0.2.4 2021-05-08 09:51:40 +02:00
LICENSE 2021-01-29 2021-01-29 12:31:58 +01:00
README.md add Set 0.2.4 2021-05-08 09:51:40 +02:00
Set.cpp add Set 0.2.4 2021-05-08 09:51:40 +02:00
Set.h add Set 0.2.4 2021-05-08 09:51:40 +02:00

Arduino CI License: MIT GitHub release

SET

Arduino library to implement a simple SET data structure.

Description

The set library implements the set data structure for integers 0..255. This limit is chosen because of the memory limitations of an Arduino UNO, however these numbers can be used as indices to a table of strings or other datatypes.

Interface

Constructor

  • Set(bool clear = true) creates an empty set, default it is cleared.
  • Set(&Set) copies a set.

Set level

  • clear() empty the set.
  • invert() flip all elements in the set.
  • addAll(n) add all 256 elements to the set.
  • count() returns the number of elements.
  • isEmpty() idem
  • isFull() idem

Element level

  • add(n) add element n to the Set.
  • sub(n) remove element n from the Set.
  • invert(n) flip element n in the Set.
  • has(n) check if element n is in the Set.

Operators

  • union + +=
  • diff - -=
  • intersection * *=

Equality

  • equal ==
  • not equal !=
  • is subSet <=

A superSet B is not implemented as one could say B subSet A (B <= A)

Iterators

all iterator-functions returns the current element or -1 if not exist.

  • setCurrent(n) if n is in the Set, n will be the current
  • first() find the first element
  • next() find the next element. Will not wrap zround when 'end' of the set is reached.
  • prev() find the previous element. Will not wrap zround when 'begin' of the set is reached.
  • last() find the last element.
  • getNth(n) find the Nth element in a set if it exist.

Operational

See examples