11.11. Bitfield name traits¶
The BITFIELD_TRAIT module implements reflection utilities for bitfield types: converting bitfield values to and from human-readable strings, iterating over individual set bits, and constructing bitfield values from string names.
All functions and symbols are in “bitfield_trait” module, use require to get access to it.
require daslib/bitfield_trait
11.11.1. Function annotations¶
- EachBitfieldMacro¶
- This macro converts each(bitfield) to the following code::
- generator<string>() <|
yield field1 yield field2 … return false
- EachBitNameBitfieldMacro¶
- This macro converts each(bitfield) to the following code::
- generator<string>() <|
yield “field1” yield “field2” … return false
11.11.2. Iteration¶
- each(argT: auto): auto¶
Iterates over the names of a bitfield type, yielding each bit as a bitfield value (1ul << bitIndex).
- Arguments:
argT : auto
- each_bit_name(argT: auto): auto¶
Iterates over the names of a bitfield type, yielding each bit name as a string.
- Arguments:
argT : auto