Skip to content

Commit cb647b7

Browse files
committed
+ 0.1.02 updated comments (archive only)
1 parent 7060dc7 commit cb647b7

File tree

2 files changed

+42
-30
lines changed

2 files changed

+42
-30
lines changed

libraries/set/set.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
//
22
// FILE: set.cpp
33
// AUTHOR: Rob Tillaart
4-
// VERSION: 0.1.01
4+
// VERSION: 0.1.02
55
// PURPOSE: SET library for Arduino
66
// URL:
77
//
88
// HISTORY:
9+
// 0.1.02 documentation
910
// 0.1.01 extending/refactor etc (09/11/2014)
1011
// 0.1.00 initial version by Rob Tillaart (09/11/2014)
1112
//
@@ -72,6 +73,18 @@ uint8_t set::count()
7273
if ( has(i) ) cnt++;
7374
}
7475
return cnt;
76+
// uint8_t cnt = 0;
77+
// for (int i=0; i<32; i++)
78+
// {
79+
// if (_mem[i] != 0)
80+
// {
81+
// for (int j=0; j<8; j++)
82+
// {
83+
// if ( has(i*8+j) ) cnt++;
84+
// }
85+
// }
86+
// }
87+
// return cnt;
7588
}
7689

7790
void set::clr()

libraries/set/set.h

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// FILE: set.h
33
// AUTHOR: Rob Tillaart
4-
// VERSION: 0.1.01
4+
// VERSION: 0.1.02
55
// PURPOSE: SET library for Arduino
66
// URL:
77
//
@@ -18,46 +18,45 @@
1818
#include <Arduino.h>
1919
#endif
2020

21-
#define SET_LIB_VERSION "0.1.01"
21+
#define SET_LIB_VERSION "0.1.02"
2222

2323
class set
2424
{
2525
public:
26-
set();
27-
set(set&);
26+
set(); // create empty set
27+
set(set &t); // create copy set
2828

29-
void clr();
30-
void invert();
31-
uint8_t count();
29+
void clr(); // clear the set
30+
void invert(); // flip all elements in the set
31+
uint8_t count(); // return the #elements
3232

33-
void add(uint8_t);
34-
void sub(uint8_t);
35-
void invert(uint8_t);
36-
bool has(uint8_t);
33+
void add(uint8_t); // add element to the set
34+
void sub(uint8_t); // remove element from set
35+
void invert(uint8_t); // flip element in set
36+
bool has(uint8_t); // element is in set
3737

38-
void operator = (set &t); // assign
39-
void operator += (set &t);
40-
void operator -= (set &t);
41-
void operator &= (set &t);
38+
void operator = (set &t); // assignment
39+
void operator += (set &t); // union
40+
void operator -= (set &t); // diff
41+
void operator &= (set &t); // intersection
4242

43-
bool operator == (set&);
44-
bool operator != (set&);
45-
bool operator <= (set&);
43+
bool operator == (set&); // equal
44+
bool operator != (set&); // not equal
45+
bool operator <= (set&); // is subset
4646

47-
int first();
48-
int next();
49-
int prev();
50-
int last();
47+
// iterating through the set
48+
// returns value
49+
// or -1 if not exist
50+
int first(); // find first element
51+
int next(); // find next element
52+
int prev(); // find previous element
53+
int last(); // find last element
5154

52-
// TODO
55+
// TODO ??
5356
// set(uint8_t*, uint8_t); // constructor from uint8_t array
54-
// uint8_t size();
55-
// iterator - begin, next
56-
57-
// uint8_t max();
58-
// uint8_t min();
57+
// inline uint8_t size() { return _size; };
5958
// inline bool empty() { return count() == 0; };
60-
// inline bool full() { return count() == 256; };
59+
// inline bool full() { return count() == _size; };
6160

6261
private:
6362
uint8_t _mem[32]; // can hold 0..255

0 commit comments

Comments
 (0)