Skip to content

Commit

Permalink
add TLeafS (JuliaHEP#161)
Browse files Browse the repository at this point in the history
  • Loading branch information
Moelf committed Jun 23, 2022
1 parent 7d1572b commit d5b1ca2
Showing 1 changed file 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 @@ -202,6 +202,41 @@ end

primitivetype(l::TLeafI) = l.fIsUnsigned ? UInt32 : Int32

# FIXME this should be generated and inherited from TLeaf
@with_kw struct TLeafS
# from TNamed
fName
fTitle

# from TLeaf
fLen
fLenType
fOffset
fIsRange
fIsUnsigned
fLeafCount

# own fields
fMinimum
fMaximum
end

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

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

primitivetype(l::TLeafS) = l.fIsUnsigned ? UInt16 : Int16

# FIXME this should be generated and inherited from TLeaf
@with_kw struct TLeafL
# from TNamed
Expand Down

0 comments on commit d5b1ca2

Please sign in to comment.