| 148 | } |
| 149 | |
| 150 | void Param::from_bytes(const std::string& bytes) { |
| 151 | std::map<std::string, ParamVal> ordered_vals( |
| 152 | TypedRef(ParamImpl, m_impl.get()).m_vals.begin(), |
| 153 | TypedRef(ParamImpl, m_impl.get()).m_vals.end()); |
| 154 | size_t offset = 0; |
| 155 | for (auto& kv : ordered_vals) { |
| 156 | kv.second = ParamVal::from_bytes(bytes, offset); |
| 157 | } |
| 158 | TypedRef(ParamImpl, m_impl.get()).m_vals.clear(); |
| 159 | TypedRef(ParamImpl, m_impl.get()) |
| 160 | .m_vals.insert(ordered_vals.begin(), ordered_vals.end()); |
| 161 | mgb_assert(offset == bytes.size(), "wrong data loader"); |
| 162 | } |
| 163 | |
| 164 | bool operator==(const Param& lhs, const Param& rhs) { |
| 165 | if (lhs.raw().size() != rhs.raw().size()) |