Skip to content

Commit 769b3a3

Browse files
committed
[serialize] add fromH5 for ref objects
1 parent d901672 commit 769b3a3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/nimhdf5/serialize.nim

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,11 @@ proc fromH5*[T: object](h5f: H5File, res: var T, name = "", path = "/", exclude:
292292
for field, val in fieldPairs(res):
293293
if field notin exclude:
294294
h5f.fromH5(val, field, grp)
295+
proc fromH5*[T: ref object](h5f: H5File, res: var T, name = "", path = "/", exclude: seq[string] = @[]) =
296+
bind `/`
297+
let grp = path / name
298+
res = T()
299+
fromH5(h5f, res[], name, path, exclude)
295300
296301
proc deserializeH5*[T](h5f: H5File, name = "", path = "/", exclude: seq[string] = @[]): T =
297302
## Cannot name it same as `fromH5` because that causes the compiler to get confused. I don't understand,

0 commit comments

Comments
 (0)