Skip to content

Commit

Permalink
[serialize] add fromH5 for ref objects
Browse files Browse the repository at this point in the history
  • Loading branch information
Vindaar committed Sep 21, 2024
1 parent d901672 commit 769b3a3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/nimhdf5/serialize.nim
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,11 @@ proc fromH5*[T: object](h5f: H5File, res: var T, name = "", path = "/", exclude:
for field, val in fieldPairs(res):
if field notin exclude:
h5f.fromH5(val, field, grp)
proc fromH5*[T: ref object](h5f: H5File, res: var T, name = "", path = "/", exclude: seq[string] = @[]) =
bind `/`
let grp = path / name
res = T()
fromH5(h5f, res[], name, path, exclude)

proc deserializeH5*[T](h5f: H5File, name = "", path = "/", exclude: seq[string] = @[]): T =
## Cannot name it same as `fromH5` because that causes the compiler to get confused. I don't understand,
Expand Down

0 comments on commit 769b3a3

Please sign in to comment.