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

Function deserialize

dlib/directed_graph/directed_graph_kernel_1.h:447–492  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

445 bool is_checked
446 >
447 void deserialize (
448 directed_graph_kernel_1<T,E,mem_manager,is_checked>& item,
449 std::istream& in
450 )
451 {
452 try
453 {
454 unsigned long size;
455 deserialize(size, in);
456
457 item.clear();
458 item.set_number_of_nodes(size);
459
460 // deserialize each node
461 for (unsigned long i = 0; i < item.number_of_nodes(); ++i)
462 {
463 deserialize(item.node(i).data, in);
464
465 unsigned long num_children;
466 deserialize(num_children, in);
467
468 // Add all the edges going to this nodes children nodes
469 for (unsigned long c = 0; c < num_children; ++c)
470 {
471 unsigned long child_index;
472 deserialize(child_index, in);
473
474 item.add_edge(i, child_index);
475
476 // find the edge we just added
477 for (unsigned long j = 0; j < item.node(i).number_of_children(); ++j)
478 {
479 if (item.node(i).child(j).index() == child_index)
480 {
481 deserialize(item.node(i).child_edge(j), in);
482 break;
483 }
484 }
485 }
486 }
487 }
488 catch (serialization_error& e)
489 {
490 throw serialization_error(e.info + "\n while deserializing object of type directed_graph_kernel_1");
491 }
492 }
493
494// ----------------------------------------------------------------------------------------
495// ----------------------------------------------------------------------------------------

Callers

nothing calls this directly

Calls 5

serialization_errorClass · 0.85
number_of_childrenMethod · 0.80
clearMethod · 0.45
number_of_nodesMethod · 0.45
indexMethod · 0.45

Tested by

no test coverage detected