MCPcopy Create free account
hub / github.com/davisking/dlib / deserialize

Function deserialize

dlib/svm/one_vs_one_decision_function.h:241–283  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

239 typename DF10
240 >
241 void deserialize(
242 one_vs_one_decision_function<T,DF1,DF2,DF3,DF4,DF5,DF6,DF7,DF8,DF9,DF10>& item,
243 std::istream& in
244 )
245 {
246 try
247 {
248 type_safe_union<DF1,DF2,DF3,DF4,DF5,DF6,DF7,DF8,DF9,DF10> temp;
249 typedef typename T::label_type result_type;
250 typedef typename T::sample_type sample_type;
251 typedef typename T::scalar_type scalar_type;
252 typedef impl::copy_to_df_helper<sample_type, scalar_type> copy_to;
253
254 unsigned long version;
255 deserialize(version, in);
256
257 if (version != 1)
258 throw serialization_error("Can't deserialize one_vs_one_decision_function. Wrong version.");
259
260 unsigned long size;
261 deserialize(size, in);
262
263 typedef std::map<unordered_pair<result_type>, any_decision_function<sample_type, scalar_type> > binary_function_table;
264 binary_function_table dfs;
265
266 unordered_pair<result_type> p;
267 for (unsigned long i = 0; i < size; ++i)
268 {
269 deserialize(p, in);
270 deserialize(temp, in);
271 if (temp.template contains<null_df>())
272 throw serialization_error("A sub decision function of unknown type was encountered.");
273
274 temp.apply_to_contents(copy_to(dfs[p]));
275 }
276
277 item = one_vs_one_decision_function<T,DF1,DF2,DF3,DF4,DF5,DF6,DF7,DF8,DF9,DF10>(dfs);
278 }
279 catch (serialization_error& e)
280 {
281 throw serialization_error(e.info + "\n while deserializing an object of type one_vs_one_decision_function");
282 }
283 }
284
285// ----------------------------------------------------------------------------------------
286

Callers

nothing calls this directly

Calls 2

serialization_errorClass · 0.85
apply_to_contentsMethod · 0.80

Tested by

no test coverage detected