A Bit Set is a BiskitDef integer property that uses a special sort of Mapped Integer. To be used as a Bit Set, a Mapped Integer must map integer values that are between 0 and 31. It doesn't need to map all 32 possible values, but the values mapped must be within that range.
A Bit Set works by using binary values. Each Bit Set has a particular value, and when a number of bits have been set the value of the integer is the total of each of the individual bits values added up.
Bit |
0 |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
...... |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Value |
1 |
2 |
4 |
8 |
16 |
32 |
64 |
128 |
256 |
512 |
1024 |
2048 |
4096 |
8192 |
16384 |
32768 |
...... |
Therefore if bits 1, 5 and 7 are set, the value is 162. (2+32+128)
Bit Sets allow the user to combine up to 32 options in any combination required. In Exprodo SDM we have one default bit set and that is for User Roles.
There can be as many Bit Sets as needed in the database. Once the Bit Set is created as a Mapped Integer, to use it, create an integer property on a BiskitDef and set its Integer Type to be Bit Set and chose the Mapped Integer that has been created.