Skip to content

Commit

Permalink
hard code TLeafB
Browse files Browse the repository at this point in the history
  • Loading branch information
Moelf committed Jul 2, 2021
1 parent c40da32 commit 5474dc6
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions src/bootstrap.jl
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,41 @@ end

primitivetype(l::TLeafF) = Float32

# FIXME this should be generated and inherited from TLeaf
# https://root.cern/doc/master/TLeafB_8h_source.html#l00026
@with_kw struct TLeafB
# from TNamed
fName
fTitle

# from TLeaf
fLen
fLenType
fOffset
fIsRange
fIsUnsigned
fLeafCount

# own fields
fMinimum
fMaximum
end

function parsefields!(io, fields, T::Type{TLeafB})
preamble = Preamble(io, T)
parsefields!(io, fields, TLeaf)
fields[:fMinimum] = readtype(io, UInt8)
fields[:fMaximum] = readtype(io, UInt8)
endcheck(io, preamble)
end

function unpack(io, tkey::TKey, refs::Dict{Int32, Any}, T::Type{TLeafB})
@initparse
parsefields!(io, fields, T)
T(;fields...)
end

primitivetype(l::TLeafB) = UInt8
# FIXME this should be generated and inherited from TLeaf
@with_kw struct TLeafD
# from TNamed
Expand Down
Binary file added test/samples/NanoAODv5_sample.root
Binary file not shown.

0 comments on commit 5474dc6

Please sign in to comment.