MCPcopy Create free account
hub / github.com/Niko1221/Strata / restore

Method restore

engine/src/split/src/model.cpp:1694–1708  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1692}
1693
1694void Model::restore(const std::string& image, const Store& store) {
1695 Img m{image};
1696 uint32_t magic = 0;
1697 m.get(magic);
1698 if (magic != 0x31474d49) throw std::runtime_error("fnx: not a holder's image");
1699 for (CardW& c : cards) {
1700 card_fields(c, [&](auto& v) { m.get(v); });
1701 m.get_vec(c.L);
1702 m.get_vec(c.ec_host_gu);
1703 m.get_vec(c.ec_host_dn);
1704 if (c.L.size() != (size_t) NL) throw std::runtime_error("fnx: the holder's image has another layer count");
1705 card_ptrs(c, [&](auto& p) { store.move_ptr(p); });
1706 }
1707 if (m.at != image.size()) throw std::runtime_error("fnx: the holder's image is longer than its cards");
1708}
1709
1710} // namespace fnx

Calls 6

card_fieldsFunction · 0.85
card_ptrsFunction · 0.85
get_vecMethod · 0.80
move_ptrMethod · 0.80
getMethod · 0.65
sizeMethod · 0.45

Tested by

no test coverage detected