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

Function deserialize

dlib/graph/graph_kernel_1.h:384–425  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

382 bool is_checked
383 >
384 void deserialize (
385 graph_kernel_1<T,E,mem_manager,is_checked>& item,
386 std::istream& in
387 )
388 {
389 try
390 {
391 unsigned long size;
392 deserialize(size, in);
393
394 item.clear();
395 item.set_number_of_nodes(size);
396
397 // deserialize each node
398 for (unsigned long i = 0; i < item.number_of_nodes(); ++i)
399 {
400 deserialize(item.node(i).data, in);
401
402 const unsigned long stop_mark = 0xFFFFFFFF;
403 // Add all the edges going to this node's neighbors
404 unsigned long index;
405 deserialize(index, in);
406 while (index != stop_mark)
407 {
408 item.add_edge(i, index);
409 // find the edge
410 unsigned long j = 0;
411 for (j = 0; j < item.node(i).number_of_neighbors(); ++j)
412 if (item.node(i).neighbor(j).index() == index)
413 break;
414
415 deserialize(item.node(i).edge(j), in);
416 deserialize(index, in);
417 }
418
419 }
420 }
421 catch (serialization_error& e)
422 {
423 throw serialization_error(e.info + "\n while deserializing object of type graph_kernel_1");
424 }
425 }
426
427// ----------------------------------------------------------------------------------------
428// ----------------------------------------------------------------------------------------

Callers

nothing calls this directly

Calls 6

serialization_errorClass · 0.85
neighborMethod · 0.80
clearMethod · 0.45
number_of_nodesMethod · 0.45
number_of_neighborsMethod · 0.45
indexMethod · 0.45

Tested by

no test coverage detected