-
Notifications
You must be signed in to change notification settings - Fork 1
Closed
Description
I want to use this as a packed representation for a structure (or a named tuple) with bool fields.
Can I transform this into such a structure?
@bitflag BitFlagName::UInt32 begin
flag_x
flag_y
flag_z
end
inp = flag_x | flag_y
out1 = (flag_x = true, flag_y = true, flag_z = false)
struct Foo
flag_x::Bool
flag_y::Bool
flag_z::Bool
end
out2 = Foo(true, true, false)
# how can I convert inp into out1 and out2?
do_something1(inp) === out1
do_something2(inp) === out2And then I need to wrap an array of bitflags into a StructArray with fields stored as BitVectors:
vec = [flag_x, flag_y, flag_x | flag_y]
svec1 = StructVector(vec)
svec1.flag_x isa BitVector === true
svec1[1] isa BitFlagName == true # or maybe a named tuple?
svec2 = StructVector{Foo}(vec)
svec2[1] isa Foo # struct
svec2.flag_x isa BitVector === trueMetadata
Metadata
Assignees
Labels
No labels